perfmon_default_smpl.h 3.4 KB

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