-} ctx_perf[] = {
- /* Hardware counter */
- { PERF_TYPE_HARDWARE, .id.hard = PERF_COUNT_HW_CPU_CYCLES, "cpu_cycles" },
- { PERF_TYPE_HARDWARE, .id.hard = PERF_COUNT_HW_INSTRUCTIONS, "instr" },
- { PERF_TYPE_HARDWARE, .id.hard = PERF_COUNT_HW_CACHE_REFERENCES, "cache_refs" },
- { PERF_TYPE_HARDWARE, .id.hard = PERF_COUNT_HW_CACHE_MISSES, "cache_miss" },
- { PERF_TYPE_HARDWARE, .id.hard = PERF_COUNT_HW_BRANCH_INSTRUCTIONS, "branch_instr" },
- { PERF_TYPE_HARDWARE, .id.hard = PERF_COUNT_HW_BRANCH_MISSES, "branch_miss" },
- { PERF_TYPE_HARDWARE, .id.hard = PERF_COUNT_HW_BUS_CYCLES, "bus_cycles" },
- /* Sofware counter */
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_CPU_CLOCK, "cpu_clock" },
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_TASK_CLOCK, "task_clock" },
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_PAGE_FAULTS, "page_faults" },
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_CONTEXT_SWITCHES, "ctx_switches" },
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_CPU_MIGRATIONS, "cpu_migration" },
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_PAGE_FAULTS_MIN, "page_faults_minor" },
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_PAGE_FAULTS_MAJ, "page_faults_major" },
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_ALIGNMENT_FAULTS, "align_faults" },
- { PERF_TYPE_SOFTWARE, .id.soft = PERF_COUNT_SW_EMULATION_FAULTS, "emu_faults" },
- /* Closure */
- { -1, .id.hard = -1 , NULL },
+ enum context_type ctx_type;
+ union {
+ struct {
+ uint32_t type;
+ uint64_t config;
+ } perf;
+ } u;
+} ctx_opts[] = {
+ { "pid", CONTEXT_PID },
+ { "procname", CONTEXT_PROCNAME },
+ { "prio", CONTEXT_PRIO },
+ { "nice", CONTEXT_NICE },
+ { "vpid", CONTEXT_VPID },
+ { "tid", CONTEXT_TID },
+ { "vtid", CONTEXT_VTID },
+ { "ppid", CONTEXT_PPID },
+ { "vppid", CONTEXT_VPPID },
+ /* Perf options */
+ PERF_HW(cpu-cycles, CPU_CYCLES),
+ PERF_HW(cycles, CPU_CYCLES),
+ PERF_HW(stalled-cycles-frontend, STALLED_CYCLES_FRONTEND),
+ PERF_HW(idle-cycles-frontend, STALLED_CYCLES_FRONTEND),
+ PERF_HW(stalled-cycles-backend, STALLED_CYCLES_BACKEND),
+ PERF_HW(idle-cycles-backend, STALLED_CYCLES_BACKEND),
+ PERF_HW(instructions, INSTRUCTIONS),
+ PERF_HW(cache-references, CACHE_REFERENCES),
+ PERF_HW(cache-misses, CACHE_MISSES),
+ PERF_HW(branch-instructions, BRANCH_INSTRUCTIONS),
+ PERF_HW(branches, BRANCH_INSTRUCTIONS),
+ PERF_HW(branch-misses, BRANCH_MISSES),
+ PERF_HW(bus-cycles, BUS_CYCLES),
+
+ PERF_HW_CACHE(L1-dcache, L1D),
+ PERF_HW_CACHE(L1-icache, L1I),
+ PERF_HW_CACHE(LLC, LL),
+ PERF_HW_CACHE(dTLB, DTLB),
+ _PERF_HW_CACHE("iTLB-loads", ITLB, READ, ACCESS),
+ _PERF_HW_CACHE("iTLB-load-misses", ITLB, READ, MISS),
+ _PERF_HW_CACHE("branch-loads", BPU, READ, ACCESS),
+ _PERF_HW_CACHE("branch-load-misses", BPU, READ, MISS),
+
+
+ PERF_SW(cpu-clock, CPU_CLOCK),
+ PERF_SW(task-clock, TASK_CLOCK),
+ PERF_SW(page-fault, PAGE_FAULTS),
+ PERF_SW(faults, PAGE_FAULTS),
+ PERF_SW(major-faults, PAGE_FAULTS_MAJ),
+ PERF_SW(minor-faults, PAGE_FAULTS_MIN),
+ PERF_SW(context-switches, CONTEXT_SWITCHES),
+ PERF_SW(cs, CONTEXT_SWITCHES),
+ PERF_SW(cpu-migrations, CPU_MIGRATIONS),
+ PERF_SW(migrations, CPU_MIGRATIONS),
+ PERF_SW(alignment-faults, ALIGNMENT_FAULTS),
+ PERF_SW(emulation-faults, EMULATION_FAULTS),
+ { NULL, -1 }, /* Closure */