| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

# perfmon_v2.h

Go to the documentation of this file.

    00001 /*
    00002  * This file contains the user level interface description for
    00003  * the perfmon-2.x interface on Linux.
    00004  *
    00005  * Copyright (c) 2001-2006 Hewlett-Packard Development Company, L.P.
    00006  * Contributed by Stephane Eranian <eranian@hpl.hp.com>
    00007  */
    00008 #ifndef __PERFMON_V2_H__
    00009 #define __PERFMON_V2_H__
    00010
    00011 #ifndef __PERFMON_H__
    00012 #error "this file should never be included directly, use perfmon.h instead"
    00013 #endif
    00014
    00015 /*
    00016  * argument to v2.3 and onward pfm_create_context()
    00017  */
    00018 typedef struct {
    00019         uint32_t        ctx_flags;         /* noblock/block/syswide */
    00020         uint32_t        ctx_reserved1;     /* for future use */
    00021         uint64_t        ctx_reserved3[7];  /* for future use */
    00022 } pfarg_ctx_t;
    00023
    00024 /*
    00025  * argument for pfm_write_pmcs()
    00026  */
    00027 typedef struct {
    00028         uint16_t reg_num;                               /* which register */
    00029         uint16_t reg_set;                               /* event set for this register */
    00030         uint32_t reg_flags;                             /* REGFL flags */
    00031         uint64_t reg_value;                             /* pmc value */
    00032         uint64_t reg_reserved2[4];                      /* for future use */
    00033 } pfarg_pmc_t;
    00034
    00035 /*
    00036  * argument pfm_write_pmds() and pfm_read_pmds()
    00037  */
    00038 typedef struct {
    00039         uint16_t reg_num;               /* which register */
    00040         uint16_t reg_set;               /* event set for this register */
    00041         uint32_t reg_flags;             /* REGFL flags */
    00042         uint64_t reg_value;             /* initial pmc/pmd value */
    00043         uint64_t reg_long_reset;        /* reset after buffer overflow notification */
    00044         uint64_t reg_short_reset;       /* reset after counter overflow */
    00045         uint64_t reg_last_reset_val;    /* return: PMD last reset value */
    00046         uint64_t reg_ovfl_switch_cnt;   /* how many overflow before switch for next set */
    00047         uint64_t reg_reset_pmds[PFM_PMD_BV]; /* which other PMDS to reset on overflow */
    00048         uint64_t reg_smpl_pmds[PFM_PMD_BV];  /* which other PMDS to record when the associated PMD overflows */
    00049         uint64_t reg_smpl_eventid;      /* opaque sampling event identifier */
    00050         uint64_t reg_random_mask;       /* bitmask used to limit random value */
    00051         uint32_t reg_random_seed;       /* seed for randomization (DEPRECATED) */
    00052         uint32_t reg_reserved2[7];      /* for future use */
    00053 } pfarg_pmd_t;
    00054
    00055 /*
    00056  * optional argument to pfm_start(), pass NULL if no arg needed
    00057  */
    00058 typedef struct {
    00059         uint16_t start_set;             /* event set to start with */
    00060         uint16_t start_reserved1;       /* for future use */
    00061         uint32_t start_reserved2;       /* for future use */
    00062         uint64_t reserved3[3];          /* for future use */
    00063 } pfarg_start_t;
    00064
    00065 /*
    00066  * argument to pfm_load_context()
    00067  */
    00068 typedef struct {
    00069         uint32_t        load_pid;          /* thread or CPU to attach to */
    00070         uint16_t        load_set;          /* set to load first */
    00071         uint16_t        load_reserved1;    /* for future use */
    00072         uint64_t        load_reserved2[3]; /* for future use */
    00073 } pfarg_load_t;
    00074
    00075 #ifndef PFMLIB_OLD_PFMV2
    00076 typedef struct {
    00077         uint16_t        set_id;           /* which set */
    00078         uint16_t        set_reserved1;    /* for future use */
    00079         uint32_t        set_flags;        /* SETFL flags */
    00080         uint64_t        set_timeout;      /* requested/effective switch timeout in nsecs */
    00081         uint64_t        reserved[6];      /* for future use */
    00082 } pfarg_setdesc_t;
    00083
    00084 typedef struct {
    00085         uint16_t        set_id;             /* which set */
    00086         uint16_t        set_reserved1;      /* for future use */
    00087         uint32_t        set_flags;          /* for future use */
    00088         uint64_t        set_ovfl_pmds[PFM_PMD_BV]; /* out: last ovfl PMDs */
    00089         uint64_t        set_runs;           /* out: #times set was active */
    00090         uint64_t        set_timeout;        /* out: leftover switch timeout (nsecs) */
    00091         uint64_t        set_act_duration;           /* out: time set was active (nsecs) */
    00092         uint64_t        set_avail_pmcs[PFM_PMC_BV]; /* out: available PMCs */
    00093         uint64_t        set_avail_pmds[PFM_PMD_BV]; /* out: available PMDs */
    00094         uint64_t        set_reserved3[6];   /* for future use */
    00095 } pfarg_setinfo_t;
    00096 #endif
    00097
    00098
    00099 #ifdef PFMLIB_OLD_PFMV2
    00100
    00101 /*
    00102  * argument to pfm_create_evtsets()/pfm_delete_evtsets()
    00103  */
    00104 typedef struct {
    00105         uint16_t        set_id;           /* which set */
    00106         uint16_t        set_id_next;      /* next set to go to (must use PFM_SETFL_EXPL_NEXT) */
    00107         uint32_t        set_flags;        /* SETFL flags */
    00108         uint64_t        set_timeout;      /* requested switch timeout in nsecs */
    00109         uint64_t        set_mmap_offset;  /* cookie to pass as mmap offset to access 64-bit virtual PMD */
    00110         uint64_t        reserved[5];      /* for future use */
    00111 } pfarg_setdesc_t;
    00112
    00113 /*
    00114  * argument to pfm_getinfo_evtsets()
    00115  */
    00116 typedef struct {
    00117         uint16_t        set_id;             /* which set */
    00118         uint16_t        set_id_next;        /* output: next set to go to (must use PFM_SETFL_EXPL_NEXT) */
    00119         uint32_t        set_flags;          /* output: SETFL flags */
    00120         uint64_t        set_ovfl_pmds[PFM_PMD_BV]; /* output: last ovfl PMDs which triggered a switch from set */
    00121         uint64_t        set_runs;           /* output: number of times the set was active */
    00122         uint64_t        set_timeout;        /* output:effective/leftover switch timeout in nsecs */
    00123         uint64_t        set_act_duration;   /* number of cycles set was active (syswide only) */
    00124         uint64_t        set_mmap_offset;    /* cookie to pass as mmap offset to access 64-bit virtual PMD */
    00125         uint64_t        set_avail_pmcs[PFM_PMC_BV];
    00126         uint64_t        set_avail_pmds[PFM_PMD_BV];
    00127         uint64_t        reserved[4];        /* for future use */
    00128 } pfarg_setinfo_t;
    00129
    00130 #ifdef __crayx2
    00131 #define PFM_MAX_HW_PMDS 512
    00132 #else
    00133 #define PFM_MAX_HW_PMDS 256
    00134 #endif
    00135 #define PFM_HW_PMD_BV   PFM_BVSIZE(PFM_MAX_HW_PMDS)
    00136
    00137 typedef struct {
    00138         uint32_t        msg_type;               /* PFM_MSG_OVFL */
    00139         uint32_t        msg_ovfl_pid;           /* process id */
    00140         uint64_t        msg_ovfl_pmds[PFM_HW_PMD_BV];/* which PMDs overflowed */
    00141         uint16_t        msg_active_set;         /* active set at the time of overflow */
    00142         uint16_t        msg_ovfl_cpu;           /* cpu on which the overflow occurred */
    00143         uint32_t        msg_ovfl_tid;           /* thread id */
    00144         uint64_t        msg_ovfl_ip;            /* instruction pointer where overflow interrupt happened */
    00145 } pfarg_ovfl_msg_t;
    00146
    00147 #endif /* PFMLIB_OLD_PFMV2 */
    00148
    00149 extern os_err_t pfm_create_context(pfarg_ctx_t *ctx, char *smpl_name,
    00150                                     void *smpl_arg, size_t smpl_size);
    00151 extern os_err_t pfm_write_pmcs(int fd, pfarg_pmc_t *pmcs, int count);
    00152 extern os_err_t pfm_write_pmds(int fd, pfarg_pmd_t *pmds, int count);
    00153 extern os_err_t pfm_read_pmds(int fd, pfarg_pmd_t *pmds, int count);
    00154 extern os_err_t pfm_load_context(int fd, pfarg_load_t *load);
    00155 extern os_err_t pfm_start(int fd, pfarg_start_t *start);
    00156 extern os_err_t pfm_stop(int fd);
    00157 extern os_err_t pfm_restart(int fd);
    00158 extern os_err_t pfm_create_evtsets(int fd, pfarg_setdesc_t *setd, int count);
    00159 extern os_err_t pfm_getinfo_evtsets(int fd, pfarg_setinfo_t *info, int count);
    00160 extern os_err_t pfm_delete_evtsets(int fd, pfarg_setdesc_t *setd, int count);
    00161 extern os_err_t pfm_unload_context(int fd);
    00162
    00163 #endif /* _PERFMON_V2_H */

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines