| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

# pfmlib_intel_atom.h

Go to the documentation of this file.

    00001 /*
    00002  * Intel Atom : architectural perfmon v3 + PEBS
    00003  *
    00004  * Copyright (c) 2008 Google, Inc
    00005  * Contributed by Stephane Eranian <eranian@gmail.com>
    00006  *
    00007  * Based on pfmlib_intel_atom.h with
    00008  * Copyright (c) 2006-2007 Hewlett-Packard Development Company, L.P.
    00009  * Contributed by Stephane Eranian <eranian@hpl.hp.com>
    00010  *
    00011  * Permission is hereby granted, free of charge, to any person obtaining a copy
    00012  * of this software and associated documentation files (the "Software"), to deal
    00013  * in the Software without restriction, including without limitation the rights
    00014  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
    00015  * of the Software, and to permit persons to whom the Software is furnished to do so,
    00016  * subject to the following conditions:
    00017  *
    00018  * The above copyright notice and this permission notice shall be included in all
    00019  * copies or substantial portions of the Software.
    00020  *
    00021  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
    00022  * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
    00023  * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    00024  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
    00025  * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
    00026  * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    00027  */
    00028 #ifndef __PFMLIB_INTEL_ATOM_H__
    00029 #define __PFMLIB_INTEL_ATOM_H__
    00030
    00031 #include <perfmon/pfmlib.h>
    00032 /*
    00033  * privilege level mask usage for architected PMU:
    00034  *
    00035  * PFM_PLM0 = OS (kernel, hypervisor, ..)
    00036  * PFM_PLM1 = unused (ignored)
    00037  * PFM_PLM2 = unused (ignored)
    00038  * PFM_PLM3 = USR (user level)
    00039  */
    00040
    00041 #ifdef __cplusplus
    00042 extern "C" {
    00043 #endif
    00044
    00045 #define PMU_INTEL_ATOM_NUM_COUNTERS     5 /* 2 generic + 3 fixed */
    00046
    00047 typedef union {
    00048         unsigned long long val;                 /* complete register value */
    00049         struct {
    00050                 unsigned long sel_event_select:8;       /* event mask */
    00051                 unsigned long sel_unit_mask:8;          /* unit mask */
    00052                 unsigned long sel_usr:1;                /* user level */
    00053                 unsigned long sel_os:1;                 /* system level */
    00054                 unsigned long sel_edge:1;               /* edge detec */
    00055                 unsigned long sel_pc:1;                 /* pin control */
    00056                 unsigned long sel_int:1;                /* enable APIC intr */
    00057                 unsigned long sel_any:1;                /* any thread */
    00058                 unsigned long sel_en:1;                 /* enable */
    00059                 unsigned long sel_inv:1;                /* invert counter mask */
    00060                 unsigned long sel_cnt_mask:8;           /* counter mask */
    00061                 unsigned long sel_res2:32;
    00062         } perfevtsel;
    00063 } pfm_intel_atom_sel_reg_t;
    00064
    00065 typedef struct {
    00066         unsigned long           cnt_mask;       /* threshold (cnt_mask)  */
    00067         unsigned int            flags;          /* counter specific flags */
    00068 } pfmlib_intel_atom_counter_t;
    00069
    00070 #define PFM_INTEL_ATOM_SEL_INV          0x1     /* inverse */
    00071 #define PFM_INTEL_ATOM_SEL_EDGE         0x2     /* edge detect */
    00072 #define PFM_INTEL_ATOM_SEL_ANYTHR       0x4     /* measure on any of 2 threads */
    00073
    00074 /*
    00075  * model-specific parameters for the library
    00076  */
    00077 typedef struct {
    00078         pfmlib_intel_atom_counter_t     pfp_intel_atom_counters[PMU_INTEL_ATOM_NUM_COUNTERS];
    00079         unsigned int                    pfp_intel_atom_pebs_used; /* set to 1 to use PEBS */
    00080         uint64_t                        reserved[4];        /* for future use */
    00081 } pfmlib_intel_atom_input_param_t;
    00082
    00083 #ifdef __cplusplus /* extern C */
    00084 }
    00085 #endif
    00086
    00087 /*
    00088  * Atom-specific interface
    00089  */
    00090 extern int pfm_intel_atom_has_pebs(pfmlib_event_t *e);
    00091
    00092 #endif /* __PFMLIB_INTEL_ATOM_H__ */

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