Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Enumerations
perf_event.h File Reference
#include <linux/types.h>
#include <linux/ioctl.h>
#include <asm/byteorder.h>

Go to the source code of this file.

Data Structures

struct  perf_event_attr
 
struct  perf_event_mmap_page
 
struct  perf_event_header
 

Macros

#define PERF_SAMPLE_BRANCH_PLM_ALL
 
#define PERF_ATTR_SIZE_VER0   64 /* sizeof first published struct */
 
#define PERF_ATTR_SIZE_VER1   72 /* add: config2 */
 
#define PERF_ATTR_SIZE_VER2   80 /* add: branch_sample_type */
 
#define PERF_ATTR_SIZE_VER3   96 /* add: sample_regs_user */
 
#define perf_flags(attr)   (*(&(attr)->read_format + 1))
 
#define PERF_EVENT_IOC_ENABLE   _IO ('$', 0)
 
#define PERF_EVENT_IOC_DISABLE   _IO ('$', 1)
 
#define PERF_EVENT_IOC_REFRESH   _IO ('$', 2)
 
#define PERF_EVENT_IOC_RESET   _IO ('$', 3)
 
#define PERF_EVENT_IOC_PERIOD   _IOW('$', 4, __u64)
 
#define PERF_EVENT_IOC_SET_OUTPUT   _IO ('$', 5)
 
#define PERF_EVENT_IOC_SET_FILTER   _IOW('$', 6, char *)
 
#define PERF_RECORD_MISC_CPUMODE_MASK   (7 << 0)
 
#define PERF_RECORD_MISC_CPUMODE_UNKNOWN   (0 << 0)
 
#define PERF_RECORD_MISC_KERNEL   (1 << 0)
 
#define PERF_RECORD_MISC_USER   (2 << 0)
 
#define PERF_RECORD_MISC_HYPERVISOR   (3 << 0)
 
#define PERF_RECORD_MISC_GUEST_KERNEL   (4 << 0)
 
#define PERF_RECORD_MISC_GUEST_USER   (5 << 0)
 
#define PERF_RECORD_MISC_EXACT_IP   (1 << 14)
 
#define PERF_RECORD_MISC_EXT_RESERVED   (1 << 15)
 
#define PERF_MAX_STACK_DEPTH   127
 
#define PERF_FLAG_FD_NO_GROUP   (1U << 0)
 
#define PERF_FLAG_FD_OUTPUT   (1U << 1)
 
#define PERF_FLAG_PID_CGROUP   (1U << 2) /* pid=cgroup id, per-cpu mode only */
 

Enumerations

enum  perf_type_id {
  PERF_TYPE_HARDWARE = 0, PERF_TYPE_SOFTWARE = 1, PERF_TYPE_TRACEPOINT = 2, PERF_TYPE_HW_CACHE = 3,
  PERF_TYPE_RAW = 4, PERF_TYPE_BREAKPOINT = 5, PERF_TYPE_MAX
}
 
enum  perf_hw_id {
  PERF_COUNT_HW_CPU_CYCLES = 0, PERF_COUNT_HW_INSTRUCTIONS = 1, PERF_COUNT_HW_CACHE_REFERENCES = 2, PERF_COUNT_HW_CACHE_MISSES = 3,
  PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, PERF_COUNT_HW_BRANCH_MISSES = 5, PERF_COUNT_HW_BUS_CYCLES = 6, PERF_COUNT_HW_STALLED_CYCLES_FRONTEND = 7,
  PERF_COUNT_HW_STALLED_CYCLES_BACKEND = 8, PERF_COUNT_HW_REF_CPU_CYCLES = 9, PERF_COUNT_HW_MAX
}
 
enum  perf_hw_cache_id {
  PERF_COUNT_HW_CACHE_L1D = 0, PERF_COUNT_HW_CACHE_L1I = 1, PERF_COUNT_HW_CACHE_LL = 2, PERF_COUNT_HW_CACHE_DTLB = 3,
  PERF_COUNT_HW_CACHE_ITLB = 4, PERF_COUNT_HW_CACHE_BPU = 5, PERF_COUNT_HW_CACHE_NODE = 6, PERF_COUNT_HW_CACHE_MAX
}
 
enum  perf_hw_cache_op_id { PERF_COUNT_HW_CACHE_OP_READ = 0, PERF_COUNT_HW_CACHE_OP_WRITE = 1, PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, PERF_COUNT_HW_CACHE_OP_MAX }
 
enum  perf_hw_cache_op_result_id { PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, PERF_COUNT_HW_CACHE_RESULT_MISS = 1, PERF_COUNT_HW_CACHE_RESULT_MAX }
 
enum  perf_sw_ids {
  PERF_COUNT_SW_CPU_CLOCK = 0, PERF_COUNT_SW_TASK_CLOCK = 1, PERF_COUNT_SW_PAGE_FAULTS = 2, PERF_COUNT_SW_CONTEXT_SWITCHES = 3,
  PERF_COUNT_SW_CPU_MIGRATIONS = 4, PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, PERF_COUNT_SW_ALIGNMENT_FAULTS = 7,
  PERF_COUNT_SW_EMULATION_FAULTS = 8, PERF_COUNT_SW_MAX
}
 
enum  perf_event_sample_format {
  PERF_SAMPLE_IP = 1U << 0, PERF_SAMPLE_TID = 1U << 1, PERF_SAMPLE_TIME = 1U << 2, PERF_SAMPLE_ADDR = 1U << 3,
  PERF_SAMPLE_READ = 1U << 4, PERF_SAMPLE_CALLCHAIN = 1U << 5, PERF_SAMPLE_ID = 1U << 6, PERF_SAMPLE_CPU = 1U << 7,
  PERF_SAMPLE_PERIOD = 1U << 8, PERF_SAMPLE_STREAM_ID = 1U << 9, PERF_SAMPLE_RAW = 1U << 10, PERF_SAMPLE_BRANCH_STACK = 1U << 11,
  PERF_SAMPLE_REGS_USER = 1U << 12, PERF_SAMPLE_STACK_USER = 1U << 13, PERF_SAMPLE_MAX = 1U << 14
}
 
enum  perf_branch_sample_type {
  PERF_SAMPLE_BRANCH_USER = 1U << 0, PERF_SAMPLE_BRANCH_KERNEL = 1U << 1, PERF_SAMPLE_BRANCH_HV = 1U << 2, PERF_SAMPLE_BRANCH_ANY = 1U << 3,
  PERF_SAMPLE_BRANCH_ANY_CALL = 1U << 4, PERF_SAMPLE_BRANCH_ANY_RETURN = 1U << 5, PERF_SAMPLE_BRANCH_IND_CALL = 1U << 6, PERF_SAMPLE_BRANCH_MAX = 1U << 7
}
 
enum  perf_sample_regs_abi { PERF_SAMPLE_REGS_ABI_NONE = 0, PERF_SAMPLE_REGS_ABI_32 = 1, PERF_SAMPLE_REGS_ABI_64 = 2 }
 
enum  perf_event_read_format {
  PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, PERF_FORMAT_ID = 1U << 2, PERF_FORMAT_GROUP = 1U << 3,
  PERF_FORMAT_MAX = 1U << 4
}
 
enum  perf_event_ioc_flags { PERF_IOC_FLAG_GROUP = 1U << 0 }
 
enum  perf_event_type {
  PERF_RECORD_MMAP = 1, PERF_RECORD_LOST = 2, PERF_RECORD_COMM = 3, PERF_RECORD_EXIT = 4,
  PERF_RECORD_THROTTLE = 5, PERF_RECORD_UNTHROTTLE = 6, PERF_RECORD_FORK = 7, PERF_RECORD_READ = 8,
  PERF_RECORD_SAMPLE = 9, PERF_RECORD_MAX
}
 
enum  perf_callchain_context {
  PERF_CONTEXT_HV = (__u64)-32, PERF_CONTEXT_KERNEL = (__u64)-128, PERF_CONTEXT_USER = (__u64)-512, PERF_CONTEXT_GUEST = (__u64)-2048,
  PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, PERF_CONTEXT_GUEST_USER = (__u64)-2560, PERF_CONTEXT_MAX = (__u64)-4095
}
 

Macro Definition Documentation

#define PERF_ATTR_SIZE_VER0   64 /* sizeof first published struct */

Definition at line 205 of file perf_event.h.

#define PERF_ATTR_SIZE_VER1   72 /* add: config2 */

Definition at line 206 of file perf_event.h.

#define PERF_ATTR_SIZE_VER2   80 /* add: branch_sample_type */

Definition at line 207 of file perf_event.h.

#define PERF_ATTR_SIZE_VER3   96 /* add: sample_regs_user */

Definition at line 208 of file perf_event.h.

#define PERF_EVENT_IOC_DISABLE   _IO ('$', 1)

Definition at line 313 of file perf_event.h.

#define PERF_EVENT_IOC_ENABLE   _IO ('$', 0)

Definition at line 312 of file perf_event.h.

#define PERF_EVENT_IOC_PERIOD   _IOW('$', 4, __u64)

Definition at line 316 of file perf_event.h.

#define PERF_EVENT_IOC_REFRESH   _IO ('$', 2)

Definition at line 314 of file perf_event.h.

#define PERF_EVENT_IOC_RESET   _IO ('$', 3)

Definition at line 315 of file perf_event.h.

#define PERF_EVENT_IOC_SET_FILTER   _IOW('$', 6, char *)

Definition at line 318 of file perf_event.h.

#define PERF_EVENT_IOC_SET_OUTPUT   _IO ('$', 5)

Definition at line 317 of file perf_event.h.

#define PERF_FLAG_FD_NO_GROUP   (1U << 0)

Definition at line 611 of file perf_event.h.

#define PERF_FLAG_FD_OUTPUT   (1U << 1)

Definition at line 612 of file perf_event.h.

#define PERF_FLAG_PID_CGROUP   (1U << 2) /* pid=cgroup id, per-cpu mode only */

Definition at line 613 of file perf_event.h.

#define perf_flags (   attr)    (*(&(attr)->read_format + 1))

Definition at line 307 of file perf_event.h.

#define PERF_MAX_STACK_DEPTH   127

Definition at line 597 of file perf_event.h.

#define PERF_RECORD_MISC_CPUMODE_MASK   (7 << 0)

Definition at line 438 of file perf_event.h.

#define PERF_RECORD_MISC_CPUMODE_UNKNOWN   (0 << 0)

Definition at line 439 of file perf_event.h.

#define PERF_RECORD_MISC_EXACT_IP   (1 << 14)

Definition at line 451 of file perf_event.h.

#define PERF_RECORD_MISC_EXT_RESERVED   (1 << 15)

Definition at line 455 of file perf_event.h.

#define PERF_RECORD_MISC_GUEST_KERNEL   (4 << 0)

Definition at line 443 of file perf_event.h.

#define PERF_RECORD_MISC_GUEST_USER   (5 << 0)

Definition at line 444 of file perf_event.h.

#define PERF_RECORD_MISC_HYPERVISOR   (3 << 0)

Definition at line 442 of file perf_event.h.

#define PERF_RECORD_MISC_KERNEL   (1 << 0)

Definition at line 440 of file perf_event.h.

#define PERF_RECORD_MISC_USER   (2 << 0)

Definition at line 441 of file perf_event.h.

#define PERF_SAMPLE_BRANCH_PLM_ALL
Value:
PERF_SAMPLE_BRANCH_KERNEL|\
PERF_SAMPLE_BRANCH_HV)

Definition at line 162 of file perf_event.h.

Enumeration Type Documentation

Enumerator:
PERF_SAMPLE_BRANCH_USER 
PERF_SAMPLE_BRANCH_KERNEL 
PERF_SAMPLE_BRANCH_HV 
PERF_SAMPLE_BRANCH_ANY 
PERF_SAMPLE_BRANCH_ANY_CALL 
PERF_SAMPLE_BRANCH_ANY_RETURN 
PERF_SAMPLE_BRANCH_IND_CALL 
PERF_SAMPLE_BRANCH_MAX 

Definition at line 149 of file perf_event.h.

Enumerator:
PERF_CONTEXT_HV 
PERF_CONTEXT_KERNEL 
PERF_CONTEXT_USER 
PERF_CONTEXT_GUEST 
PERF_CONTEXT_GUEST_KERNEL 
PERF_CONTEXT_GUEST_USER 
PERF_CONTEXT_MAX 

Definition at line 599 of file perf_event.h.

Enumerator:
PERF_IOC_FLAG_GROUP 

Definition at line 320 of file perf_event.h.

Enumerator:
PERF_FORMAT_TOTAL_TIME_ENABLED 
PERF_FORMAT_TOTAL_TIME_RUNNING 
PERF_FORMAT_ID 
PERF_FORMAT_GROUP 
PERF_FORMAT_MAX 

Definition at line 196 of file perf_event.h.

Enumerator:
PERF_SAMPLE_IP 
PERF_SAMPLE_TID 
PERF_SAMPLE_TIME 
PERF_SAMPLE_ADDR 
PERF_SAMPLE_READ 
PERF_SAMPLE_CALLCHAIN 
PERF_SAMPLE_ID 
PERF_SAMPLE_CPU 
PERF_SAMPLE_PERIOD 
PERF_SAMPLE_STREAM_ID 
PERF_SAMPLE_RAW 
PERF_SAMPLE_BRANCH_STACK 
PERF_SAMPLE_REGS_USER 
PERF_SAMPLE_STACK_USER 
PERF_SAMPLE_MAX 

Definition at line 120 of file perf_event.h.

Enumerator:
PERF_RECORD_MMAP 
PERF_RECORD_LOST 
PERF_RECORD_COMM 
PERF_RECORD_EXIT 
PERF_RECORD_THROTTLE 
PERF_RECORD_UNTHROTTLE 
PERF_RECORD_FORK 
PERF_RECORD_READ 
PERF_RECORD_SAMPLE 
PERF_RECORD_MAX 

Definition at line 463 of file perf_event.h.

Enumerator:
PERF_COUNT_HW_CACHE_L1D 
PERF_COUNT_HW_CACHE_L1I 
PERF_COUNT_HW_CACHE_LL 
PERF_COUNT_HW_CACHE_DTLB 
PERF_COUNT_HW_CACHE_ITLB 
PERF_COUNT_HW_CACHE_BPU 
PERF_COUNT_HW_CACHE_NODE 
PERF_COUNT_HW_CACHE_MAX 

Definition at line 69 of file perf_event.h.

Enumerator:
PERF_COUNT_HW_CACHE_OP_READ 
PERF_COUNT_HW_CACHE_OP_WRITE 
PERF_COUNT_HW_CACHE_OP_PREFETCH 
PERF_COUNT_HW_CACHE_OP_MAX 

Definition at line 81 of file perf_event.h.

Enumerator:
PERF_COUNT_HW_CACHE_RESULT_ACCESS 
PERF_COUNT_HW_CACHE_RESULT_MISS 
PERF_COUNT_HW_CACHE_RESULT_MAX 

Definition at line 89 of file perf_event.h.

enum perf_hw_id
Enumerator:
PERF_COUNT_HW_CPU_CYCLES 
PERF_COUNT_HW_INSTRUCTIONS 
PERF_COUNT_HW_CACHE_REFERENCES 
PERF_COUNT_HW_CACHE_MISSES 
PERF_COUNT_HW_BRANCH_INSTRUCTIONS 
PERF_COUNT_HW_BRANCH_MISSES 
PERF_COUNT_HW_BUS_CYCLES 
PERF_COUNT_HW_STALLED_CYCLES_FRONTEND 
PERF_COUNT_HW_STALLED_CYCLES_BACKEND 
PERF_COUNT_HW_REF_CPU_CYCLES 
PERF_COUNT_HW_MAX 

Definition at line 44 of file perf_event.h.

Enumerator:
PERF_SAMPLE_REGS_ABI_NONE 
PERF_SAMPLE_REGS_ABI_32 
PERF_SAMPLE_REGS_ABI_64 

Definition at line 170 of file perf_event.h.

Enumerator:
PERF_COUNT_SW_CPU_CLOCK 
PERF_COUNT_SW_TASK_CLOCK 
PERF_COUNT_SW_PAGE_FAULTS 
PERF_COUNT_SW_CONTEXT_SWITCHES 
PERF_COUNT_SW_CPU_MIGRATIONS 
PERF_COUNT_SW_PAGE_FAULTS_MIN 
PERF_COUNT_SW_PAGE_FAULTS_MAJ 
PERF_COUNT_SW_ALIGNMENT_FAULTS 
PERF_COUNT_SW_EMULATION_FAULTS 
PERF_COUNT_SW_MAX 

Definition at line 102 of file perf_event.h.

Enumerator:
PERF_TYPE_HARDWARE 
PERF_TYPE_SOFTWARE 
PERF_TYPE_TRACEPOINT 
PERF_TYPE_HW_CACHE 
PERF_TYPE_RAW 
PERF_TYPE_BREAKPOINT 
PERF_TYPE_MAX 

Definition at line 28 of file perf_event.h.