FreeBSD kernel kern code
kern_pmc.c File Reference
#include <sys/cdefs.h>
#include "opt_hwpmc_hooks.h"
#include <sys/types.h>
#include <sys/ctype.h>
#include <sys/param.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/pmc.h>
#include <sys/pmckern.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
Include dependency graph for kern_pmc.c:

Go to the source code of this file.

Macros

#define PMC_KERNEL_VERSION   0
 

Functions

 __FBSDID ("$BSDSUniX$")
 
 MALLOC_DECLARE (M_PMCHOOKS)
 
 MALLOC_DEFINE (M_PMCHOOKS,"pmchooks","Memory space for PMC hooks")
 
 SYSCTL_NODE (_kern, OID_AUTO, hwpmc, CTLFLAG_RW, 0,"HWPMC parameters")
 
 TUNABLE_INT (PMC_SYSCTL_NAME_PREFIX"softevents",&pmc_softevents)
 
 SYSCTL_INT (_kern_hwpmc, OID_AUTO, softevents, CTLFLAG_TUN|CTLFLAG_RD,&pmc_softevents, 0,"maximum number of soft events")
 
 MTX_SYSINIT (pmc_soft_mtx,&pmc_softs_mtx,"pmc-softs", MTX_SPIN)
 
static void pmc_init_sx (void)
 
 SYSINIT (pmcsx, SI_SUB_LOCK, SI_ORDER_MIDDLE, pmc_init_sx, NULL)
 
int pmc_cpu_is_active (int cpu)
 
int pmc_cpu_is_disabled (int cpu)
 
int pmc_cpu_is_present (int cpu)
 
int pmc_cpu_is_primary (int cpu)
 
unsigned int pmc_cpu_max (void)
 
static void pmc_soft_namecleanup (char *name)
 
void pmc_soft_ev_register (struct pmc_soft *ps)
 
void pmc_soft_ev_deregister (struct pmc_soft *ps)
 
struct pmc_soft * pmc_soft_ev_acquire (enum pmc_event ev)
 
void pmc_soft_ev_release (struct pmc_soft *ps)
 
static void init_hwpmc (void *dummy __unused)
 
 SYSINIT (hwpmc, SI_SUB_KDTRACE, SI_ORDER_FIRST, init_hwpmc, NULL)
 

Variables

const int pmc_kernel_version = PMC_KERNEL_VERSION
 
int(* pmc_hook )(struct thread *td, int function, void *arg) = NULL
 
int(* pmc_intr )(int cpu, struct trapframe *tf) = NULL
 
volatile cpuset_t pmc_cpumask
 
volatile int pmc_ss_count
 
struct sx pmc_sx
 
struct trapframe pmc_tf [MAXCPU]
 
static int pmc_softevents = 16
 
struct mtx pmc_softs_mtx
 
int pmc_softs_count
 
struct pmc_soft ** pmc_softs
 

Macro Definition Documentation

#define PMC_KERNEL_VERSION   0

Definition at line 53 of file kern_pmc.c.

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static void init_hwpmc ( void *dummy  __unused)
static

Definition at line 332 of file kern_pmc.c.

References malloc(), pmc_softevents, pmc_softs, and printf().

Here is the call graph for this function:

MALLOC_DECLARE ( M_PMCHOOKS  )
MALLOC_DEFINE ( M_PMCHOOKS  ,
"pmchooks"  ,
"Memory space for PMC hooks"   
)
MTX_SYSINIT ( pmc_soft_mtx  ,
pmc_softs_mtx,
"pmc-softs"  ,
MTX_SPIN   
)
int pmc_cpu_is_active ( int  cpu)

Definition at line 143 of file kern_pmc.c.

References pmc_cpu_is_present().

Referenced by pmc_cpu_is_disabled().

Here is the call graph for this function:

Here is the caller graph for this function:

int pmc_cpu_is_disabled ( int  cpu)

Definition at line 155 of file kern_pmc.c.

References pmc_cpu_is_active().

Here is the call graph for this function:

int pmc_cpu_is_present ( int  cpu)

Definition at line 161 of file kern_pmc.c.

Referenced by pmc_cpu_is_active().

Here is the caller graph for this function:

int pmc_cpu_is_primary ( int  cpu)

Definition at line 171 of file kern_pmc.c.

unsigned int pmc_cpu_max ( void  )

Definition at line 187 of file kern_pmc.c.

References mp_maxid.

static void pmc_init_sx ( void  )
static

Definition at line 110 of file kern_pmc.c.

References pmc_sx, and sx_init_flags().

Here is the call graph for this function:

struct pmc_soft* pmc_soft_ev_acquire ( enum pmc_event  ev)

Definition at line 301 of file kern_pmc.c.

References pmc_softevents, pmc_softs, and pmc_softs_mtx.

void pmc_soft_ev_deregister ( struct pmc_soft *  ps)

Definition at line 282 of file kern_pmc.c.

References pmc_softevents, pmc_softs, and pmc_softs_mtx.

void pmc_soft_ev_register ( struct pmc_soft *  ps)

Definition at line 242 of file kern_pmc.c.

References pmc_soft_namecleanup(), pmc_softevents, pmc_softs, pmc_softs_count, pmc_softs_mtx, and printf().

Here is the call graph for this function:

void pmc_soft_ev_release ( struct pmc_soft *  ps)

Definition at line 322 of file kern_pmc.c.

References pmc_softs_mtx.

static void pmc_soft_namecleanup ( char *  name)
static

Definition at line 224 of file kern_pmc.c.

References name.

Referenced by pmc_soft_ev_register().

Here is the caller graph for this function:

SYSCTL_INT ( _kern_hwpmc  ,
OID_AUTO  ,
softevents  ,
CTLFLAG_TUN|  CTLFLAG_RD,
pmc_softevents,
,
"maximum number of soft events"   
)
SYSCTL_NODE ( _kern  ,
OID_AUTO  ,
hwpmc  ,
CTLFLAG_RW  ,
,
"HWPMC parameters"   
)
SYSINIT ( pmcsx  ,
SI_SUB_LOCK  ,
SI_ORDER_MIDDLE  ,
pmc_init_sx  ,
NULL   
)
SYSINIT ( hwpmc  ,
SI_SUB_KDTRACE  ,
SI_ORDER_FIRST  ,
init_hwpmc  ,
NULL   
)
TUNABLE_INT ( PMC_SYSCTL_NAME_PREFIX"softevents"  ,
pmc_softevents 
)

Variable Documentation

volatile cpuset_t pmc_cpumask

Definition at line 68 of file kern_pmc.c.

int(* pmc_hook) (struct thread *td, int function, void *arg) = NULL

Definition at line 62 of file kern_pmc.c.

int(* pmc_intr) (int cpu, struct trapframe *tf) = NULL

Definition at line 65 of file kern_pmc.c.

const int pmc_kernel_version = PMC_KERNEL_VERSION

Definition at line 59 of file kern_pmc.c.

int pmc_softevents = 16
static
struct pmc_soft** pmc_softs
int pmc_softs_count

Definition at line 104 of file kern_pmc.c.

Referenced by pmc_soft_ev_register().

struct mtx pmc_softs_mtx
volatile int pmc_ss_count

Definition at line 74 of file kern_pmc.c.

struct sx pmc_sx

Definition at line 85 of file kern_pmc.c.

Referenced by pmc_init_sx().

struct trapframe pmc_tf[MAXCPU]

Definition at line 90 of file kern_pmc.c.