Commit 8faf3b54 authored by Ingo Molnar's avatar Ingo Molnar

perf_counter tools: Fix cache-event printout

Also standardize the cache printout (so that it can be pasted back
into the command) and sort out the aliases.

Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 86847b62
...@@ -53,45 +53,45 @@ static struct event_symbol event_symbols[] = { ...@@ -53,45 +53,45 @@ static struct event_symbol event_symbols[] = {
#define PERF_COUNTER_ID(config) __PERF_COUNTER_FIELD(config, EVENT) #define PERF_COUNTER_ID(config) __PERF_COUNTER_FIELD(config, EVENT)
static char *hw_event_names[] = { static char *hw_event_names[] = {
"CPU cycles", "cycles",
"instructions", "instructions",
"cache references", "cache-references",
"cache misses", "cache-misses",
"branches", "branches",
"branch misses", "branch-misses",
"bus cycles", "bus-cycles",
}; };
static char *sw_event_names[] = { static char *sw_event_names[] = {
"cpu clock ticks", "cpu-clock-ticks",
"task clock ticks", "task-clock-ticks",
"pagefaults", "page-faults",
"context switches", "context-switches",
"CPU migrations", "CPU-migrations",
"minor faults", "minor-faults",
"major faults", "major-faults",
}; };
#define MAX_ALIASES 8 #define MAX_ALIASES 8
static char *hw_cache [][MAX_ALIASES] = { static char *hw_cache [][MAX_ALIASES] = {
{ "l1-d" , "l1d" , "l1", "l1-data-cache" }, { "L1-data" , "l1-d", "l1d", "l1" },
{ "l1-i" , "l1i" , "l1-instruction-cache" }, { "L1-instruction" , "l1-i", "l1i" },
{ "l2" , }, { "L2" , "l2" },
{ "dtlb", }, { "Data-TLB" , "dtlb", "d-tlb" },
{ "itlb", }, { "Instruction-TLB" , "itlb", "i-tlb" },
{ "bpu" , "btb", "branch-cache", NULL }, { "Branch" , "bpu" , "btb", "bpc" },
}; };
static char *hw_cache_op [][MAX_ALIASES] = { static char *hw_cache_op [][MAX_ALIASES] = {
{ "read" , "load" }, { "Load" , "read" },
{ "write" , "store" }, { "Store" , "write" },
{ "prefetch" , "speculative-read", "speculative-load" }, { "Prefetch" , "speculative-read", "speculative-load" },
}; };
static char *hw_cache_result [][MAX_ALIASES] = { static char *hw_cache_result [][MAX_ALIASES] = {
{ "access", "ops" }, { "Reference" , "ops", "access" },
{ "miss", }, { "Miss" },
}; };
char *event_name(int counter) char *event_name(int counter)
...@@ -120,14 +120,14 @@ char *event_name(int counter) ...@@ -120,14 +120,14 @@ char *event_name(int counter)
return "unknown-ext-hardware-cache-type"; return "unknown-ext-hardware-cache-type";
cache_op = (config >> 8) & 0xff; cache_op = (config >> 8) & 0xff;
if (cache_type > PERF_COUNT_HW_CACHE_OP_MAX) if (cache_op > PERF_COUNT_HW_CACHE_OP_MAX)
return "unknown-ext-hardware-cache-op-type"; return "unknown-ext-hardware-cache-op";
cache_result = (config >> 16) & 0xff; cache_result = (config >> 16) & 0xff;
if (cache_type > PERF_COUNT_HW_CACHE_RESULT_MAX) if (cache_result > PERF_COUNT_HW_CACHE_RESULT_MAX)
return "unknown-ext-hardware-cache-result-type"; return "unknown-ext-hardware-cache-result";
sprintf(name, "%s:%s:%s", sprintf(name, "%s-Cache-%s-%ses",
hw_cache[cache_type][0], hw_cache[cache_type][0],
hw_cache_op[cache_op][0], hw_cache_op[cache_op][0],
hw_cache_result[cache_result][0]); hw_cache_result[cache_result][0]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment