perf tools: Preserving event modifiers

From: Arnaldo Carvalho de Melo
Date: Thu May 24 2012 - 14:24:59 EST


Hi Jiri,

We need to preserve the original event name so that we can show it on the TUI,
for instance. Humm, when rebuilding it from perf.data we'll need to look at
perf_event_attr.precise bits too...

(gdb) run top -e cycles:p
Starting program: /root/bin/perf top -e cycles:p
[Thread debugging using libthread_db enabled]

Breakpoint 1, perf_evsel__init (evsel=0x909c50, attr=0x7fffffffad30, idx=0) at util/evsel.c:50
50 {
(gdb) n
51 evsel->idx = idx;
(gdb) n
52 evsel->attr = *attr;
(gdb)
53 INIT_LIST_HEAD(&evsel->node);
(gdb)
54 hists__init(&evsel->hists);
(gdb)
55 }
(gdb)
perf_evsel__new (attr=0x7fffffffad30, idx=0) at util/evsel.c:64
64 return evsel;
(gdb)
65 }
(gdb)
add_event (_list=0x7fffffffadc0, idx=0x7fffffffb6c0, attr=0x7fffffffad30, name=0x54598b "cycles") at util/parse-events.c:376
376 if (!evsel) {
(gdb)
381 evsel->name = strdup(name);
(gdb) p name
$5 = 0x54598b "cycles"
(gdb) p name
$6 = 0x54598b "cycles"
(gdb) bt
#0 add_event (_list=0x7fffffffadc0, idx=0x7fffffffb6c0, attr=0x7fffffffad30, name=0x54598b "cycles") at util/parse-events.c:381
#1 0x000000000044e483 in parse_events_add_numeric (list=0x7fffffffadc0, idx=0x7fffffffb6c0, type=0, config=0, head_config=0x0) at util/parse-events.c:674
#2 0x000000000047667d in parse_events_parse (list_all=0x7fffffffb6a0, idx=0x7fffffffb6c0) at util/parse-events.y:117
#3 0x000000000044e9fd in parse_events (evlist=0x9083c0, str=0x7fffffffe899 "cycles:p", unset=0) at util/parse-events.c:807
#4 0x000000000044eaf1 in parse_events_option (opt=0x7fffffffba10, str=0x7fffffffe899 "cycles:p", unset=0) at util/parse-events.c:833
#5 0x000000000044b68f in get_value (p=0x7fffffffb840, opt=0x7fffffffba10, flags=1) at util/parse-options.c:112
#6 0x000000000044ba8b in parse_short_opt (p=0x7fffffffb840, options=0x7fffffffba10) at util/parse-options.c:191
#7 0x000000000044c0bd in parse_options_step (ctx=0x7fffffffb840, options=0x7fffffffba10, usagestr=0x53f9f0) at util/parse-options.c:342
#8 0x000000000044c46e in parse_options (argc=3, argv=0x7fffffffe640, options=0x7fffffffba10, usagestr=0x53f9f0, flags=0) at util/parse-options.c:417
#9 0x000000000042eead in cmd_top (argc=3, argv=0x7fffffffe640, prefix=0x0) at builtin-top.c:1250
#10 0x0000000000415359 in run_builtin (p=0x79b8a8, argc=3, argv=0x7fffffffe640) at perf.c:273
#11 0x000000000041555c in handle_internal_command (argc=3, argv=0x7fffffffe640) at perf.c:345
#12 0x00000000004156a8 in run_argv (argcp=0x7fffffffe52c, argv=0x7fffffffe520) at perf.c:389
#13 0x000000000041592e in main (argc=3, argv=0x7fffffffe640) at perf.c:487
(gdb)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/