libpfm_i386_p6(3) support for AMD X86-64 processor family


#include <perfmon/pfmlib.h>
#include <perfmon/pfmlib_gen_x86_64.h>


The libpfm library provides full support for the X86-64 processor family when running in 64-bit mode. The interface is defined in pfmlib_gen_x86_64.h. It consists of a set of functions and structures which describe and allow access to the X86-64 specific PMU features. Note that it does not support Intel EM64T processors.

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:

Inverse the results of the cnt_mask comparison when set
Enables edge detection of events.

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.


Refer to the description of pfm_dispatch_events() for errors.


Stephane Eranian <[email protected]>