| # Gaudi Framework, version v22r2 |

Home |  | Generated: Tue May 10 2011

# perfmon_pebs_smpl.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright (c) 2009 Google, Inc
    00003  * Contributed by Stephane Eranian <eranian@gmail.com>
    00004  *
    00005  * This program is free software; you can redistribute it and/or
    00006  * modify it under the terms of version 2 of the GNU General Public
    00007  * License as published by the Free Software Foundation.
    00008  *
    00009  * This program is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  * General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU General Public License
    00015  * along with this program; if not, write to the Free Software
    00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    00017  * 02111-1307 USA
    00018  *
    00019  */
    00020 #ifndef __PERFMON_PEBS_SMPL_H__
    00021 #define __PERFMON_PEBS_SMPL_H__ 1
    00022
    00023 /*
    00024  * The 32-bit and 64-bit formats are identical, thus we use only
    00025  * one name for the format.
    00026  */
    00027 #define PFM_PEBS_SMPL_NAME      "pebs"
    00028
    00029 #define PFM_PEBS_NUM_CNT_RESET  8
    00030 /*
    00031  * format specific parameters (passed at context creation)
    00032  *
    00033  * intr_thres: index from start of buffer of entry where the
    00034  * PMU interrupt must be triggered. It must be several samples
    00035  * short of the end of the buffer.
    00036  */
    00037 typedef struct {
    00038         uint64_t buf_size;              /* size of the PEBS buffer in bytes */
    00039         uint64_t cnt_reset[PFM_PEBS_NUM_CNT_RESET];/* counter reset values */
    00040         uint64_t reserved2[23];         /* for future use */
    00041 } pfm_pebs_smpl_arg_t;
    00042
    00043 /*
    00044  * This header is at the beginning of the sampling buffer returned to the user.
    00045  *
    00046  * Because of PEBS alignement constraints, the actual PEBS buffer area does
    00047  * not necessarily begin right after the header. The hdr_start_offs must be
    00048  * used to compute the first byte of the buffer. The offset is defined as
    00049  * the number of bytes between the end of the header and the beginning of
    00050  * the buffer. As such the formula is:
    00051  *      actual_buffer = (unsigned long)(hdr+1)+hdr->hdr_start_offs
    00052  */
    00053 typedef struct {
    00054         uint64_t overflows;             /* #overflows for buffer */
    00055         uint64_t count;                 /* number of valid samples */
    00056         uint64_t buf_size;              /* total buffer size */
    00057         uint64_t pebs_size;             /* pebs buffer size */
    00058         uint32_t version;               /* smpl format version */
    00059         uint32_t entry_size;            /* pebs sample size */
    00060         uint64_t reserved2[11];         /* for future use */
    00061 } pfm_pebs_smpl_hdr_t;
    00062
    00063 /*
    00064  * Sample format as mandated by Intel documentation.
    00065  * The same format is used in both 32 and 64 bit modes.
    00066  */
    00067 typedef struct {
    00068         uint64_t        eflags;
    00069         uint64_t        ip;
    00070         uint64_t        eax;
    00071         uint64_t        ebx;
    00072         uint64_t        ecx;
    00073         uint64_t        edx;
    00074         uint64_t        esi;
    00075         uint64_t        edi;
    00076         uint64_t        ebp;
    00077         uint64_t        esp;
    00078         uint64_t        r8;     /* 0 in 32-bit mode */
    00079         uint64_t        r9;     /* 0 in 32-bit mode */
    00080         uint64_t        r10;    /* 0 in 32-bit mode */
    00081         uint64_t        r11;    /* 0 in 32-bit mode */
    00082         uint64_t        r12;    /* 0 in 32-bit mode */
    00083         uint64_t        r13;    /* 0 in 32-bit mode */
    00084         uint64_t        r14;    /* 0 in 32-bit mode */
    00085         uint64_t        r15;    /* 0 in 32-bit mode */
    00086 } pfm_pebs_core_smpl_entry_t;
    00087
    00088 /*
    00089  * Sample format as mandated by Intel documentation.
    00090  * The same format is used in both 32 and 64 bit modes.
    00091  */
    00092 typedef struct {
    00093         uint64_t        eflags;
    00094         uint64_t        ip;
    00095         uint64_t        eax;
    00096         uint64_t        ebx;
    00097         uint64_t        ecx;
    00098         uint64_t        edx;
    00099         uint64_t        esi;
    00100         uint64_t        edi;
    00101         uint64_t        ebp;
    00102         uint64_t        esp;
    00103         uint64_t        r8;     /* 0 in 32-bit mode */
    00104         uint64_t        r9;     /* 0 in 32-bit mode */
    00105         uint64_t        r10;    /* 0 in 32-bit mode */
    00106         uint64_t        r11;    /* 0 in 32-bit mode */
    00107         uint64_t        r12;    /* 0 in 32-bit mode */
    00108         uint64_t        r13;    /* 0 in 32-bit mode */
    00109         uint64_t        r14;    /* 0 in 32-bit mode */
    00110         uint64_t        r15;    /* 0 in 32-bit mode */
    00111         uint64_t        ia32_perf_global_status;
    00112         uint64_t        daddr;
    00113         uint64_t        dsrc_enc;
    00114         uint64_t        latency;
    00115 } pfm_pebs_nhm_smpl_entry_t;
    00116
    00117 /*
    00118  * 64-bit PEBS record format is described in
    00119  * http://www.intel.com/technology/64bitextensions/30083502.pdf
    00120  *
    00121  * The format does not peek at samples. The sample structure is only
    00122  * used to ensure that the buffer is large enough to accomodate one
    00123  * sample.
    00124  */
    00125 #ifdef __i386__
    00126 typedef struct {
    00127         uint32_t        eflags;
    00128         uint32_t        ip;
    00129         uint32_t        eax;
    00130         uint32_t        ebx;
    00131         uint32_t        ecx;
    00132         uint32_t        edx;
    00133         uint32_t        esi;
    00134         uint32_t        edi;
    00135         uint32_t        ebp;
    00136         uint32_t        esp;
    00137 } pfm_pebs_p4_smpl_entry_t;
    00138 #else
    00139 typedef struct {
    00140         uint64_t        eflags;
    00141         uint64_t        ip;
    00142         uint64_t        eax;
    00143         uint64_t        ebx;
    00144         uint64_t        ecx;
    00145         uint64_t        edx;
    00146         uint64_t        esi;
    00147         uint64_t        edi;
    00148         uint64_t        ebp;
    00149         uint64_t        esp;
    00150         uint64_t        r8;
    00151         uint64_t        r9;
    00152         uint64_t        r10;
    00153         uint64_t        r11;
    00154         uint64_t        r12;
    00155         uint64_t        r13;
    00156         uint64_t        r14;
    00157         uint64_t        r15;
    00158 } pfm_pebs_p4_smpl_entry_t;
    00159 #endif
    00160
    00161 #define PFM_PEBS_SMPL_VERSION_MAJ 1U
    00162 #define PFM_PEBS_SMPL_VERSION_MIN 0U
    00163 #define PFM_PEBS_SMPL_VERSION (((PFM_PEBS_SMPL_VERSION_MAJ&0xffff)<<16)|\
    00164                                    (PFM_PEBS_SMPL_VERSION_MIN & 0xffff))
    00165
    00166 #endif /* __PERFMON_PEBS_SMPL_H__ */

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