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