#include <perfmon/pfmlib.h> #include <perfmon/pfmlib_gen_x86_64.h>
When X86-64 processor specific features are needed to support a measurement their descriptions must be passed as model-specific input arguments to the pfm_dispatch_events call. The X86-64 processors specific input arguments are described in the pfmlib_gen_x86_64_input_param_t structure and the output parameters in pfmlib_gen_x86_64_output_param_t. They are defined as follows:
typedef struct {
unsigned int cnt_mask;
unsigned int flags;
} pfmlib_gen_x86_64_counter_t;
typedef struct {
pfmlib_gen_x86_64_counter_t pfp_gen_x86_64_counters[PMU_GEN_X86_64_NUM_COUNTERS];
uint64_t reserved[4];
} pfmlib_gen_x86_64_input_param_t;
typedef struct {
uint64_t reserved[8];
} pfmlib_gen_x86_64_output_param_t;
The X86-64 processor provides a few additional per-event features for counters: thresholding, inversion, edge detection. They can be set using the pfp_gen_x86_64_counters data structure for each event. The flags field can be initialized as follows:
The cnt_mask field contains is used to set the event threshold. The value of the counter is incremented each time the number of occurrences per cycle of the event is greater or equal to the value of the field. When zero all occurrences are counted.