Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2002-2003 Hewlett-Packard Co |
| 3 | * Stephane Eranian <eranian@hpl.hp.com> |
| 4 | * |
| 5 | * This file implements the default sampling buffer format |
| 6 | * for Linux/ia64 perfmon subsystem. |
| 7 | */ |
| 8 | #ifndef __PERFMON_DEFAULT_SMPL_H__ |
| 9 | #define __PERFMON_DEFAULT_SMPL_H__ 1 |
| 10 | |
| 11 | #define PFM_DEFAULT_SMPL_UUID { \ |
| 12 | 0x4d, 0x72, 0xbe, 0xc0, 0x06, 0x64, 0x41, 0x43, 0x82, 0xb4, 0xd3, 0xfd, 0x27, 0x24, 0x3c, 0x97} |
| 13 | |
| 14 | /* |
| 15 | * format specific parameters (passed at context creation) |
| 16 | */ |
| 17 | typedef struct { |
| 18 | unsigned long buf_size; /* size of the buffer in bytes */ |
| 19 | unsigned int flags; /* buffer specific flags */ |
| 20 | unsigned int res1; /* for future use */ |
| 21 | unsigned long reserved[2]; /* for future use */ |
| 22 | } pfm_default_smpl_arg_t; |
| 23 | |
| 24 | /* |
| 25 | * combined context+format specific structure. Can be passed |
| 26 | * to PFM_CONTEXT_CREATE |
| 27 | */ |
| 28 | typedef struct { |
| 29 | pfarg_context_t ctx_arg; |
| 30 | pfm_default_smpl_arg_t buf_arg; |
| 31 | } pfm_default_smpl_ctx_arg_t; |
| 32 | |
| 33 | /* |
| 34 | * This header is at the beginning of the sampling buffer returned to the user. |
| 35 | * It is directly followed by the first record. |
| 36 | */ |
| 37 | typedef struct { |
| 38 | unsigned long hdr_count; /* how many valid entries */ |
| 39 | unsigned long hdr_cur_offs; /* current offset from top of buffer */ |
| 40 | unsigned long hdr_reserved2; /* reserved for future use */ |
| 41 | |
| 42 | unsigned long hdr_overflows; /* how many times the buffer overflowed */ |
| 43 | unsigned long hdr_buf_size; /* how many bytes in the buffer */ |
| 44 | |
| 45 | unsigned int hdr_version; /* contains perfmon version (smpl format diffs) */ |
| 46 | unsigned int hdr_reserved1; /* for future use */ |
| 47 | unsigned long hdr_reserved[10]; /* for future use */ |
| 48 | } pfm_default_smpl_hdr_t; |
| 49 | |
| 50 | /* |
| 51 | * Entry header in the sampling buffer. The header is directly followed |
| 52 | * with the values of the PMD registers of interest saved in increasing |
| 53 | * index order: PMD4, PMD5, and so on. How many PMDs are present depends |
| 54 | * on how the session was programmed. |
| 55 | * |
| 56 | * In the case where multiple counters overflow at the same time, multiple |
| 57 | * entries are written consecutively. |
| 58 | * |
| 59 | * last_reset_value member indicates the initial value of the overflowed PMD. |
| 60 | */ |
| 61 | typedef struct { |
| 62 | int pid; /* thread id (for NPTL, this is gettid()) */ |
| 63 | unsigned char reserved1[3]; /* reserved for future use */ |
| 64 | unsigned char ovfl_pmd; /* index of overflowed PMD */ |
| 65 | |
| 66 | unsigned long last_reset_val; /* initial value of overflowed PMD */ |
| 67 | unsigned long ip; /* where did the overflow interrupt happened */ |
| 68 | unsigned long tstamp; /* ar.itc when entering perfmon intr. handler */ |
| 69 | |
| 70 | unsigned short cpu; /* cpu on which the overfow occured */ |
| 71 | unsigned short set; /* event set active when overflow ocurred */ |
| 72 | int tgid; /* thread group id (for NPTL, this is getpid()) */ |
| 73 | } pfm_default_smpl_entry_t; |
| 74 | |
| 75 | #define PFM_DEFAULT_MAX_PMDS 64 /* how many pmds supported by data structures (sizeof(unsigned long) */ |
| 76 | #define PFM_DEFAULT_MAX_ENTRY_SIZE (sizeof(pfm_default_smpl_entry_t)+(sizeof(unsigned long)*PFM_DEFAULT_MAX_PMDS)) |
| 77 | #define PFM_DEFAULT_SMPL_MIN_BUF_SIZE (sizeof(pfm_default_smpl_hdr_t)+PFM_DEFAULT_MAX_ENTRY_SIZE) |
| 78 | |
| 79 | #define PFM_DEFAULT_SMPL_VERSION_MAJ 2U |
| 80 | #define PFM_DEFAULT_SMPL_VERSION_MIN 0U |
| 81 | #define PFM_DEFAULT_SMPL_VERSION (((PFM_DEFAULT_SMPL_VERSION_MAJ&0xffff)<<16)|(PFM_DEFAULT_SMPL_VERSION_MIN & 0xffff)) |
| 82 | |
| 83 | #endif /* __PERFMON_DEFAULT_SMPL_H__ */ |