aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2013-12-19 15:20:06 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-12-19 15:38:27 -0500
commitcc22e575a6fddbe3183ac14c28e2f792704995c5 (patch)
tree2ab6533499cfc1e12bcadb0eb7c4cbf51d50ecda /tools
parent8b640cc4c56cee14bfe5cfb4dbb372ac66d5ec6b (diff)
perf symbols: Add 'machine' member to struct addr_location
The addr_location struct should fully qualify an address, and to do that it should have in it the machine where the thread was found. Thus all functions that receive an addr_location now don't need to also receive a 'machine', those functions just need to access al->machine instead, just like it does with the other parts of an address location: al->thread, al->map, etc. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-o51iiee7vyq4r3k362uvuylg@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-report.c28
-rw-r--r--tools/perf/builtin-script.c16
-rw-r--r--tools/perf/util/event.c1
-rw-r--r--tools/perf/util/scripting-engines/trace-event-perl.c1
-rw-r--r--tools/perf/util/scripting-engines/trace-event-python.c1
-rw-r--r--tools/perf/util/session.c4
-rw-r--r--tools/perf/util/session.h2
-rw-r--r--tools/perf/util/symbol.h1
-rw-r--r--tools/perf/util/trace-event-scripting.c3
-rw-r--r--tools/perf/util/trace-event.h1
10 files changed, 26 insertions, 32 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index da156a44cb15..ec7399a84872 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -77,10 +77,10 @@ static int report__config(const char *var, const char *value, void *cb)
77 77
78static int report__resolve_callchain(struct report *rep, struct symbol **parent, 78static int report__resolve_callchain(struct report *rep, struct symbol **parent,
79 struct perf_evsel *evsel, struct addr_location *al, 79 struct perf_evsel *evsel, struct addr_location *al,
80 struct perf_sample *sample, struct machine *machine) 80 struct perf_sample *sample)
81{ 81{
82 if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) { 82 if ((sort__has_parent || symbol_conf.use_callchain) && sample->callchain) {
83 return machine__resolve_callchain(machine, evsel, al->thread, sample, 83 return machine__resolve_callchain(al->machine, evsel, al->thread, sample,
84 parent, al, rep->max_stack); 84 parent, al, rep->max_stack);
85 } 85 }
86 return 0; 86 return 0;
@@ -95,7 +95,7 @@ static int hist_entry__append_callchain(struct hist_entry *he, struct perf_sampl
95 95
96static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_location *al, 96static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_location *al,
97 struct perf_sample *sample, struct perf_evsel *evsel, 97 struct perf_sample *sample, struct perf_evsel *evsel,
98 struct machine *machine, union perf_event *event) 98 union perf_event *event)
99{ 99{
100 struct report *rep = container_of(tool, struct report, tool); 100 struct report *rep = container_of(tool, struct report, tool);
101 struct symbol *parent = NULL; 101 struct symbol *parent = NULL;
@@ -103,12 +103,12 @@ static int report__add_mem_hist_entry(struct perf_tool *tool, struct addr_locati
103 struct hist_entry *he; 103 struct hist_entry *he;
104 struct mem_info *mi, *mx; 104 struct mem_info *mi, *mx;
105 uint64_t cost; 105 uint64_t cost;
106 int err = report__resolve_callchain(rep, &parent, evsel, al, sample, machine); 106 int err = report__resolve_callchain(rep, &parent, evsel, al, sample);
107 107
108 if (err) 108 if (err)
109 return err; 109 return err;
110 110
111 mi = machine__resolve_mem(machine, al->thread, sample, cpumode); 111 mi = machine__resolve_mem(al->machine, al->thread, sample, cpumode);
112 if (!mi) 112 if (!mi)
113 return -ENOMEM; 113 return -ENOMEM;
114 114
@@ -148,20 +148,19 @@ out:
148} 148}
149 149
150static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_location *al, 150static int report__add_branch_hist_entry(struct perf_tool *tool, struct addr_location *al,
151 struct perf_sample *sample, struct perf_evsel *evsel, 151 struct perf_sample *sample, struct perf_evsel *evsel)
152 struct machine *machine)
153{ 152{
154 struct report *rep = container_of(tool, struct report, tool); 153 struct report *rep = container_of(tool, struct report, tool);
155 struct symbol *parent = NULL; 154 struct symbol *parent = NULL;
156 unsigned i; 155 unsigned i;
157 struct hist_entry *he; 156 struct hist_entry *he;
158 struct branch_info *bi, *bx; 157 struct branch_info *bi, *bx;
159 int err = report__resolve_callchain(rep, &parent, evsel, al, sample, machine); 158 int err = report__resolve_callchain(rep, &parent, evsel, al, sample);
160 159
161 if (err) 160 if (err)
162 return err; 161 return err;
163 162
164 bi = machine__resolve_bstack(machine, al->thread, 163 bi = machine__resolve_bstack(al->machine, al->thread,
165 sample->branch_stack); 164 sample->branch_stack);
166 if (!bi) 165 if (!bi)
167 return -ENOMEM; 166 return -ENOMEM;
@@ -204,13 +203,12 @@ out:
204} 203}
205 204
206static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evsel, 205static int report__add_hist_entry(struct perf_tool *tool, struct perf_evsel *evsel,
207 struct addr_location *al, struct perf_sample *sample, 206 struct addr_location *al, struct perf_sample *sample)
208 struct machine *machine)
209{ 207{
210 struct report *rep = container_of(tool, struct report, tool); 208 struct report *rep = container_of(tool, struct report, tool);
211 struct symbol *parent = NULL; 209 struct symbol *parent = NULL;
212 struct hist_entry *he; 210 struct hist_entry *he;
213 int err = report__resolve_callchain(rep, &parent, evsel, al, sample, machine); 211 int err = report__resolve_callchain(rep, &parent, evsel, al, sample);
214 212
215 if (err) 213 if (err)
216 return err; 214 return err;
@@ -256,18 +254,18 @@ static int process_sample_event(struct perf_tool *tool,
256 return 0; 254 return 0;
257 255
258 if (sort__mode == SORT_MODE__BRANCH) { 256 if (sort__mode == SORT_MODE__BRANCH) {
259 ret = report__add_branch_hist_entry(tool, &al, sample, evsel, machine); 257 ret = report__add_branch_hist_entry(tool, &al, sample, evsel);
260 if (ret < 0) 258 if (ret < 0)
261 pr_debug("problem adding lbr entry, skipping event\n"); 259 pr_debug("problem adding lbr entry, skipping event\n");
262 } else if (rep->mem_mode == 1) { 260 } else if (rep->mem_mode == 1) {
263 ret = report__add_mem_hist_entry(tool, &al, sample, evsel, machine, event); 261 ret = report__add_mem_hist_entry(tool, &al, sample, evsel, event);
264 if (ret < 0) 262 if (ret < 0)
265 pr_debug("problem adding mem entry, skipping event\n"); 263 pr_debug("problem adding mem entry, skipping event\n");
266 } else { 264 } else {
267 if (al.map != NULL) 265 if (al.map != NULL)
268 al.map->dso->hit = 1; 266 al.map->dso->hit = 1;
269 267
270 ret = report__add_hist_entry(tool, evsel, &al, sample, machine); 268 ret = report__add_hist_entry(tool, evsel, &al, sample);
271 if (ret < 0) 269 if (ret < 0)
272 pr_debug("problem incrementing symbol period, skipping event\n"); 270 pr_debug("problem incrementing symbol period, skipping event\n");
273 } 271 }
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index f8ab125aac48..62ef190c4320 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -423,7 +423,6 @@ static void print_sample_addr(union perf_event *event,
423static void print_sample_bts(union perf_event *event, 423static void print_sample_bts(union perf_event *event,
424 struct perf_sample *sample, 424 struct perf_sample *sample,
425 struct perf_evsel *evsel, 425 struct perf_evsel *evsel,
426 struct machine *machine,
427 struct thread *thread, 426 struct thread *thread,
428 struct addr_location *al) 427 struct addr_location *al)
429{ 428{
@@ -435,7 +434,7 @@ static void print_sample_bts(union perf_event *event,
435 printf(" "); 434 printf(" ");
436 else 435 else
437 printf("\n"); 436 printf("\n");
438 perf_evsel__print_ip(evsel, sample, machine, al, 437 perf_evsel__print_ip(evsel, sample, al,
439 output[attr->type].print_ip_opts, 438 output[attr->type].print_ip_opts,
440 PERF_MAX_STACK_DEPTH); 439 PERF_MAX_STACK_DEPTH);
441 } 440 }
@@ -446,14 +445,13 @@ static void print_sample_bts(union perf_event *event,
446 if (PRINT_FIELD(ADDR) || 445 if (PRINT_FIELD(ADDR) ||
447 ((evsel->attr.sample_type & PERF_SAMPLE_ADDR) && 446 ((evsel->attr.sample_type & PERF_SAMPLE_ADDR) &&
448 !output[attr->type].user_set)) 447 !output[attr->type].user_set))
449 print_sample_addr(event, sample, machine, thread, attr); 448 print_sample_addr(event, sample, al->machine, thread, attr);
450 449
451 printf("\n"); 450 printf("\n");
452} 451}
453 452
454static void process_event(union perf_event *event, struct perf_sample *sample, 453static void process_event(union perf_event *event, struct perf_sample *sample,
455 struct perf_evsel *evsel, struct machine *machine, 454 struct perf_evsel *evsel, struct thread *thread,
456 struct thread *thread,
457 struct addr_location *al) 455 struct addr_location *al)
458{ 456{
459 struct perf_event_attr *attr = &evsel->attr; 457 struct perf_event_attr *attr = &evsel->attr;
@@ -469,7 +467,7 @@ static void process_event(union perf_event *event, struct perf_sample *sample,
469 } 467 }
470 468
471 if (is_bts_event(attr)) { 469 if (is_bts_event(attr)) {
472 print_sample_bts(event, sample, evsel, machine, thread, al); 470 print_sample_bts(event, sample, evsel, thread, al);
473 return; 471 return;
474 } 472 }
475 473
@@ -477,7 +475,7 @@ static void process_event(union perf_event *event, struct perf_sample *sample,
477 event_format__print(evsel->tp_format, sample->cpu, 475 event_format__print(evsel->tp_format, sample->cpu,
478 sample->raw_data, sample->raw_size); 476 sample->raw_data, sample->raw_size);
479 if (PRINT_FIELD(ADDR)) 477 if (PRINT_FIELD(ADDR))
480 print_sample_addr(event, sample, machine, thread, attr); 478 print_sample_addr(event, sample, al->machine, thread, attr);
481 479
482 if (PRINT_FIELD(IP)) { 480 if (PRINT_FIELD(IP)) {
483 if (!symbol_conf.use_callchain) 481 if (!symbol_conf.use_callchain)
@@ -485,7 +483,7 @@ static void process_event(union perf_event *event, struct perf_sample *sample,
485 else 483 else
486 printf("\n"); 484 printf("\n");
487 485
488 perf_evsel__print_ip(evsel, sample, machine, al, 486 perf_evsel__print_ip(evsel, sample, al,
489 output[attr->type].print_ip_opts, 487 output[attr->type].print_ip_opts,
490 PERF_MAX_STACK_DEPTH); 488 PERF_MAX_STACK_DEPTH);
491 } 489 }
@@ -574,7 +572,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
574 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) 572 if (cpu_list && !test_bit(sample->cpu, cpu_bitmap))
575 return 0; 573 return 0;
576 574
577 scripting_ops->process_event(event, sample, evsel, machine, thread, &al); 575 scripting_ops->process_event(event, sample, evsel, thread, &al);
578 576
579 evsel->hists.stats.total_period += sample->period; 577 evsel->hists.stats.total_period += sample->period;
580 return 0; 578 return 0;
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 694876877ae2..fe2022799161 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -638,6 +638,7 @@ void thread__find_addr_map(struct thread *thread,
638 struct map_groups *mg = &thread->mg; 638 struct map_groups *mg = &thread->mg;
639 bool load_map = false; 639 bool load_map = false;
640 640
641 al->machine = machine;
641 al->thread = thread; 642 al->thread = thread;
642 al->addr = addr; 643 al->addr = addr;
643 al->cpumode = cpumode; 644 al->cpumode = cpumode;
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c
index b672ef0ae46d..3773c4841cab 100644
--- a/tools/perf/util/scripting-engines/trace-event-perl.c
+++ b/tools/perf/util/scripting-engines/trace-event-perl.c
@@ -371,7 +371,6 @@ static void perl_process_event_generic(union perf_event *event,
371static void perl_process_event(union perf_event *event, 371static void perl_process_event(union perf_event *event,
372 struct perf_sample *sample, 372 struct perf_sample *sample,
373 struct perf_evsel *evsel, 373 struct perf_evsel *evsel,
374 struct machine *machine __maybe_unused,
375 struct thread *thread, 374 struct thread *thread,
376 struct addr_location *al __maybe_unused) 375 struct addr_location *al __maybe_unused)
377{ 376{
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index fc007926eb1c..b258de6357ac 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -408,7 +408,6 @@ exit:
408static void python_process_event(union perf_event *event __maybe_unused, 408static void python_process_event(union perf_event *event __maybe_unused,
409 struct perf_sample *sample, 409 struct perf_sample *sample,
410 struct perf_evsel *evsel, 410 struct perf_evsel *evsel,
411 struct machine *machine __maybe_unused,
412 struct thread *thread, 411 struct thread *thread,
413 struct addr_location *al) 412 struct addr_location *al)
414{ 413{
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 989b2e377626..cbacaab3e9c4 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -1467,7 +1467,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
1467} 1467}
1468 1468
1469void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample, 1469void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
1470 struct machine *machine, struct addr_location *al, 1470 struct addr_location *al,
1471 unsigned int print_opts, unsigned int stack_depth) 1471 unsigned int print_opts, unsigned int stack_depth)
1472{ 1472{
1473 struct callchain_cursor_node *node; 1473 struct callchain_cursor_node *node;
@@ -1482,7 +1482,7 @@ void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
1482 if (symbol_conf.use_callchain && sample->callchain) { 1482 if (symbol_conf.use_callchain && sample->callchain) {
1483 struct addr_location node_al; 1483 struct addr_location node_al;
1484 1484
1485 if (machine__resolve_callchain(machine, evsel, al->thread, 1485 if (machine__resolve_callchain(al->machine, evsel, al->thread,
1486 sample, NULL, NULL, 1486 sample, NULL, NULL,
1487 PERF_MAX_STACK_DEPTH) != 0) { 1487 PERF_MAX_STACK_DEPTH) != 0) {
1488 if (verbose) 1488 if (verbose)
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 9c25d49900af..3140f8ae6148 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -106,7 +106,7 @@ struct perf_evsel *perf_session__find_first_evtype(struct perf_session *session,
106 unsigned int type); 106 unsigned int type);
107 107
108void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample, 108void perf_evsel__print_ip(struct perf_evsel *evsel, struct perf_sample *sample,
109 struct machine *machine, struct addr_location *al, 109 struct addr_location *al,
110 unsigned int print_opts, unsigned int stack_depth); 110 unsigned int print_opts, unsigned int stack_depth);
111 111
112int perf_session__cpu_bitmap(struct perf_session *session, 112int perf_session__cpu_bitmap(struct perf_session *session,
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 8a9d910c5345..cbd680361806 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -164,6 +164,7 @@ struct mem_info {
164}; 164};
165 165
166struct addr_location { 166struct addr_location {
167 struct machine *machine;
167 struct thread *thread; 168 struct thread *thread;
168 struct map *map; 169 struct map *map;
169 struct symbol *sym; 170 struct symbol *sym;
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c
index 95199e4eea97..57aaccc1692e 100644
--- a/tools/perf/util/trace-event-scripting.c
+++ b/tools/perf/util/trace-event-scripting.c
@@ -38,9 +38,8 @@ static int stop_script_unsupported(void)
38static void process_event_unsupported(union perf_event *event __maybe_unused, 38static void process_event_unsupported(union perf_event *event __maybe_unused,
39 struct perf_sample *sample __maybe_unused, 39 struct perf_sample *sample __maybe_unused,
40 struct perf_evsel *evsel __maybe_unused, 40 struct perf_evsel *evsel __maybe_unused,
41 struct machine *machine __maybe_unused,
42 struct thread *thread __maybe_unused, 41 struct thread *thread __maybe_unused,
43 struct addr_location *al __maybe_unused) 42 struct addr_location *al __maybe_unused)
44{ 43{
45} 44}
46 45
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h
index 3a01618c5b87..7b6d68688327 100644
--- a/tools/perf/util/trace-event.h
+++ b/tools/perf/util/trace-event.h
@@ -68,7 +68,6 @@ struct scripting_ops {
68 void (*process_event) (union perf_event *event, 68 void (*process_event) (union perf_event *event,
69 struct perf_sample *sample, 69 struct perf_sample *sample,
70 struct perf_evsel *evsel, 70 struct perf_evsel *evsel,
71 struct machine *machine,
72 struct thread *thread, 71 struct thread *thread,
73 struct addr_location *al); 72 struct addr_location *al);
74 int (*generate_script) (struct pevent *pevent, const char *outfile); 73 int (*generate_script) (struct pevent *pevent, const char *outfile);