2 * This file contains the code to configure and utilize the ppc64 pmc hardware
3 * Copyright (C) 2002 David Engebretsen <engebret@us.ibm.com>
7 #define INLINE_SYSCALL(arg1, arg2) \
9 register long r0 __asm__ ("r0"); \
10 register long r3 __asm__ ("r3"); \
11 register long r4 __asm__ ("r4"); \
18 : "=r" (r3), "=r" (err) \
19 : "r" (r0), "r" (r3), "r" (r4) \
26 struct perfmon_base_struct {
41 int pid; /* PID to trace */
42 int slice; /* Timeslice ID */
48 unsigned long pmc[11];
51 struct pmc_info_struct {
52 unsigned int mode, cpu;
54 unsigned int pmc_base[11];
55 unsigned long pmc_cumulative[8];
58 struct perfmon_struct {
59 struct pmc_header header;
62 struct pmc_struct pmc;
63 struct pmc_info_struct pmc_info;
70 PMC_CMD_DECR_PROFILE = 3,
77 PMC_SUBCMD_BUFFER_ALLOC = 1,
78 PMC_SUBCMD_BUFFER_FREE = 2,
79 PMC_SUBCMD_BUFFER_CLEAR = 3
83 PMC_SUBCMD_DUMP_COUNTERS = 1,
84 PMC_SUBCMD_DUMP_HARDWARE = 2
88 PMC_SUBCMD_PROFILE_CYCLE = 1,
92 PMC_SUBCMD_TIMESLICE_ENABLE = 1,
93 PMC_SUBCMD_TIMESLICE_DISABLE = 2,
94 PMC_SUBCMD_TIMESLICE_SET = 3
97 #define PMC_TRACE_CMD 0xFF
100 * The following types are not used by the kernel; they are put into the
101 * trace as flag records for the user space tools to interpret.
104 PMC_TYPE_DERC_PROFILE = 1,
106 PMC_TYPE_PROFILE = 3,
108 PMC_TYPE_L2_MISS = 5,
110 PMC_TYPE_TIMESLICE = 7,
111 PMC_TYPE_TIMESLICE_DUMP = 8,
116 #define PMC_STATE_INITIAL 0x00
117 #define PMC_STATE_READY 0x01
118 #define PMC_STATE_DECR_PROFILE 0x10
119 #define PMC_STATE_PROFILE_KERN 0x11
120 #define PMC_STATE_TRACE_KERN 0x20
121 #define PMC_STATE_TRACE_USER 0x21
122 #define PMC_STATE_TIMESLICE 0x40