Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/pmc.h
Show First 20 Lines • Show All 618 Lines • ▼ Show 20 Lines | |||||
#include <machine/frame.h> | #include <machine/frame.h> | ||||
#define PMC_HASH_SIZE 1024 | #define PMC_HASH_SIZE 1024 | ||||
#define PMC_MTXPOOL_SIZE 2048 | #define PMC_MTXPOOL_SIZE 2048 | ||||
#define PMC_LOG_BUFFER_SIZE 4 | #define PMC_LOG_BUFFER_SIZE 4 | ||||
#define PMC_NLOGBUFFERS 1024 | #define PMC_NLOGBUFFERS 1024 | ||||
#define PMC_NSAMPLES 1024 | #define PMC_NSAMPLES 1024 | ||||
#define PMC_THREADLIST_MAX 64 | |||||
#define PMC_CALLCHAIN_DEPTH 32 | #define PMC_CALLCHAIN_DEPTH 32 | ||||
#define PMC_SYSCTL_NAME_PREFIX "kern." PMC_MODULE_NAME "." | #define PMC_SYSCTL_NAME_PREFIX "kern." PMC_MODULE_NAME "." | ||||
/* | /* | ||||
* Locking keys | * Locking keys | ||||
* | * | ||||
* (b) - pmc_bufferlist_mtx (spin lock) | * (b) - pmc_bufferlist_mtx (spin lock) | ||||
▲ Show 20 Lines • Show All 120 Lines • ▼ Show 20 Lines | |||||
* Accessor macros for 'struct pmc' | * Accessor macros for 'struct pmc' | ||||
*/ | */ | ||||
#define PMC_TO_MODE(P) PMC_ID_TO_MODE((P)->pm_id) | #define PMC_TO_MODE(P) PMC_ID_TO_MODE((P)->pm_id) | ||||
#define PMC_TO_CLASS(P) PMC_ID_TO_CLASS((P)->pm_id) | #define PMC_TO_CLASS(P) PMC_ID_TO_CLASS((P)->pm_id) | ||||
#define PMC_TO_ROWINDEX(P) PMC_ID_TO_ROWINDEX((P)->pm_id) | #define PMC_TO_ROWINDEX(P) PMC_ID_TO_ROWINDEX((P)->pm_id) | ||||
#define PMC_TO_CPU(P) PMC_ID_TO_CPU((P)->pm_id) | #define PMC_TO_CPU(P) PMC_ID_TO_CPU((P)->pm_id) | ||||
/* | |||||
* struct pmc_threadpmcstate | |||||
* | |||||
* Record per-PMC, per-thread state. | |||||
*/ | |||||
struct pmc_threadpmcstate { | |||||
pmc_value_t pt_pmcval; /* per-thread reload count */ | |||||
}; | |||||
/* | /* | ||||
* struct pmc_thread | |||||
* | |||||
* Record a 'target' thread being profiled. | |||||
*/ | |||||
struct pmc_thread { | |||||
LIST_ENTRY(pmc_thread) pt_next; /* linked list */ | |||||
struct thread *pt_td; /* target thread */ | |||||
struct pmc_threadpmcstate pt_pmcs[]; /* per-PMC state */ | |||||
}; | |||||
/* | |||||
* struct pmc_process | * struct pmc_process | ||||
* | * | ||||
* Record a 'target' process being profiled. | * Record a 'target' process being profiled. | ||||
* | * | ||||
* The target process being profiled could be different from the owner | * The target process being profiled could be different from the owner | ||||
* process which allocated the PMCs. Each target process descriptor | * process which allocated the PMCs. Each target process descriptor | ||||
* is associated with NHWPMC 'struct pmc *' pointers. Each PMC at a | * is associated with NHWPMC 'struct pmc *' pointers. Each PMC at a | ||||
* given hardware row-index 'n' will use slot 'n' of the 'pp_pmcs[]' | * given hardware row-index 'n' will use slot 'n' of the 'pp_pmcs[]' | ||||
* array. The size of this structure is thus PMC architecture | * array. The size of this structure is thus PMC architecture | ||||
* dependent. | * dependent. | ||||
* | * | ||||
*/ | */ | ||||
struct pmc_targetstate { | struct pmc_targetstate { | ||||
struct pmc *pp_pmc; /* target PMC */ | struct pmc *pp_pmc; /* target PMC */ | ||||
pmc_value_t pp_pmcval; /* per-process value */ | pmc_value_t pp_pmcval; /* per-process value */ | ||||
}; | }; | ||||
struct pmc_process { | struct pmc_process { | ||||
LIST_ENTRY(pmc_process) pp_next; /* hash chain */ | LIST_ENTRY(pmc_process) pp_next; /* hash chain */ | ||||
LIST_HEAD(,pmc_thread) pp_tds; /* list of threads */ | |||||
struct mtx *pp_tdslock; /* lock on pp_tds thread list */ | |||||
int pp_refcnt; /* reference count */ | int pp_refcnt; /* reference count */ | ||||
uint32_t pp_flags; /* flags PMC_PP_* */ | uint32_t pp_flags; /* flags PMC_PP_* */ | ||||
struct proc *pp_proc; /* target thread */ | struct proc *pp_proc; /* target process */ | ||||
struct pmc_targetstate pp_pmcs[]; /* NHWPMCs */ | struct pmc_targetstate pp_pmcs[]; /* NHWPMCs */ | ||||
}; | }; | ||||
#define PMC_PP_ENABLE_MSR_ACCESS 0x00000001 | #define PMC_PP_ENABLE_MSR_ACCESS 0x00000001 | ||||
/* | /* | ||||
* struct pmc_owner | * struct pmc_owner | ||||
* | * | ||||
▲ Show 20 Lines • Show All 364 Lines • Show Last 20 Lines |