perfmon_dfl_smpl.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005-2006 Hewlett-Packard Development Company, L.P.
3  * Contributed by Stephane Eranian <eranian@hpl.hp.com>
4  *
5  * This file implements the new dfl sampling buffer format
6  * for perfmon2 subsystem.
7  *
8  * This format is supported used by all platforms. For IA-64, older
9  * applications using perfmon v2.0 MUST use the
10  * perfmon_default_smpl.h
11  */
12 #ifndef __PERFMON_DFL_SMPL_H__
13 #define __PERFMON_DFL_SMPL_H__ 1
14 
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18 
19 #include <perfmon/perfmon.h>
20 
21 #define PFM_DFL_SMPL_NAME "default"
22 
23 #ifdef PFMLIB_OLD_PFMV2
24 /*
25  * UUID for compatibility with perfmon v2.2 (used by Cray)
26  */
27 #define PFM_DFL_SMPL_UUID { \
28  0xd1, 0x39, 0xb2, 0x9e, 0x62, 0xe8, 0x40, 0xe4,\
29  0xb4, 0x02, 0x73, 0x07, 0x87, 0x92, 0xe9, 0x37 }
30 #endif
31 
32 /*
33  * format specific parameters (passed at context creation)
34  */
35 typedef struct {
36  uint64_t buf_size; /* size of the buffer in bytes */
37  uint32_t buf_flags; /* buffer specific flags */
38  uint32_t res1; /* for future use */
39  uint64_t reserved[6]; /* for future use */
41 
42 /*
43  * This header is at the beginning of the sampling buffer returned to the user.
44  * It is directly followed by the first record.
45  */
46 typedef struct {
47  uint64_t hdr_count; /* how many valid entries */
48  uint64_t hdr_cur_offs; /* current offset from top of buffer */
49  uint64_t hdr_overflows; /* #overflows for buffer */
50  uint64_t hdr_buf_size; /* bytes in the buffer */
51  uint64_t hdr_min_buf_space; /* minimal buffer size (internal use) */
52  uint32_t hdr_version; /* smpl format version */
53  uint32_t hdr_buf_flags; /* copy of buf_flags */
54  uint64_t hdr_reserved[10]; /* for future use */
56 
57 /*
58  * Entry header in the sampling buffer. The header is directly followed
59  * with the values of the PMD registers of interest saved in increasing
60  * index order: PMD4, PMD5, and so on. How many PMDs are present depends
61  * on how the session was programmed.
62  *
63  * In the case where multiple counters overflow at the same time, multiple
64  * entries are written consecutively.
65  *
66  * last_reset_value member indicates the initial value of the overflowed PMD.
67  */
68 typedef struct {
69  uint32_t pid; /* thread id (for NPTL, this is gettid()) */
70  uint16_t ovfl_pmd; /* index of pmd that overflowed for this sample */
71  uint16_t reserved; /* for future use */
72  uint64_t last_reset_val; /* initial value of overflowed PMD */
73  uint64_t ip; /* where did the overflow interrupt happened */
74  uint64_t tstamp; /* overflow timetamp */
75  uint16_t cpu; /* cpu on which the overfow occured */
76  uint16_t set; /* event set active when overflow ocurred */
77  uint32_t tgid; /* thread group id (for NPTL, this is getpid()) */
79 
80 #define PFM_DFL_SMPL_VERSION_MAJ 1U
81 #define PFM_DFL_SMPL_VERSION_MIN 0U
82 #define PFM_DFL_SMPL_VERSION (((PFM_DFL_SMPL_VERSION_MAJ&0xffff)<<16)|(PFM_DFL_SMPL_VERSION_MIN & 0xffff))
83 
84 #ifdef __cplusplus
85 }
86 #endif
87 
88 #endif /* __PERFMON_DFL_SMPL_H__ */
uint16_t cpu
unsigned long long uint64_t
Definition: instrset.h:144
unsigned short int uint16_t
Definition: instrset.h:140
uint16_t ovfl_pmd
uint64_t ip
uint32_t pid
uint64_t last_reset_val
unsigned int uint32_t
Definition: instrset.h:142
uint64_t tstamp
uint32_t tgid
uint16_t reserved