diff options
author | Ingo Molnar <mingo@kernel.org> | 2015-04-03 01:00:02 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-04-03 01:00:02 -0400 |
commit | 6645f3187f5beb64f7a40515cfa18f3889264ece (patch) | |
tree | c70714c93eaf695074f3368594e8cc0f94e33828 /tools/perf | |
parent | 2e54a5bdba107f80a9ba90065fb43bba0498147d (diff) | |
parent | bd05954bfa17f03a7bd4454178ba09786b35e383 (diff) |
Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
User visible changes:
- Support unnamed union/structure members data collection in 'perf probe'. (Masami Hiramatsu)
- Support missing -f to override perf.data file ownership. (Yunlong Song)
Infrastructure changes:
- No need to lookup thread twice when processing samples in 'perf script'. (Arnaldo Carvalho de Melo)
- No need to pass thread twice to the scripting callbacks. (Arnaldo Carvalho de Melo)
- No need to pass thread twice to the db-export facility. (Arnaldo Carvalho de Melo)
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-data.c | 4 | ||||
-rw-r--r-- | tools/perf/builtin-evlist.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-inject.c | 1 | ||||
-rw-r--r-- | tools/perf/builtin-kmem.c | 9 | ||||
-rw-r--r-- | tools/perf/builtin-kvm.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-lock.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-mem.c | 3 | ||||
-rw-r--r-- | tools/perf/builtin-script.c | 23 | ||||
-rw-r--r-- | tools/perf/builtin-timechart.c | 3 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 3 | ||||
-rw-r--r-- | tools/perf/util/data-convert-bt.c | 3 | ||||
-rw-r--r-- | tools/perf/util/data-convert-bt.h | 2 | ||||
-rw-r--r-- | tools/perf/util/db-export.c | 4 | ||||
-rw-r--r-- | tools/perf/util/db-export.h | 3 | ||||
-rw-r--r-- | tools/perf/util/dwarf-aux.c | 14 | ||||
-rw-r--r-- | tools/perf/util/evsel.h | 1 | ||||
-rw-r--r-- | tools/perf/util/kvm-stat.h | 1 | ||||
-rw-r--r-- | tools/perf/util/probe-finder.c | 8 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-perl.c | 5 | ||||
-rw-r--r-- | tools/perf/util/scripting-engines/trace-event-python.c | 16 | ||||
-rw-r--r-- | tools/perf/util/trace-event-scripting.c | 1 | ||||
-rw-r--r-- | tools/perf/util/trace-event.h | 3 |
22 files changed, 69 insertions, 47 deletions
diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c index 709152a7b408..d6525bc54d13 100644 --- a/tools/perf/builtin-data.c +++ b/tools/perf/builtin-data.c | |||
@@ -53,12 +53,14 @@ static int cmd_data_convert(int argc, const char **argv, | |||
53 | const char *prefix __maybe_unused) | 53 | const char *prefix __maybe_unused) |
54 | { | 54 | { |
55 | const char *to_ctf = NULL; | 55 | const char *to_ctf = NULL; |
56 | bool force = false; | ||
56 | const struct option options[] = { | 57 | const struct option options[] = { |
57 | OPT_INCR('v', "verbose", &verbose, "be more verbose"), | 58 | OPT_INCR('v', "verbose", &verbose, "be more verbose"), |
58 | OPT_STRING('i', "input", &input_name, "file", "input file name"), | 59 | OPT_STRING('i', "input", &input_name, "file", "input file name"), |
59 | #ifdef HAVE_LIBBABELTRACE_SUPPORT | 60 | #ifdef HAVE_LIBBABELTRACE_SUPPORT |
60 | OPT_STRING(0, "to-ctf", &to_ctf, NULL, "Convert to CTF format"), | 61 | OPT_STRING(0, "to-ctf", &to_ctf, NULL, "Convert to CTF format"), |
61 | #endif | 62 | #endif |
63 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | ||
62 | OPT_END() | 64 | OPT_END() |
63 | }; | 65 | }; |
64 | 66 | ||
@@ -76,7 +78,7 @@ static int cmd_data_convert(int argc, const char **argv, | |||
76 | 78 | ||
77 | if (to_ctf) { | 79 | if (to_ctf) { |
78 | #ifdef HAVE_LIBBABELTRACE_SUPPORT | 80 | #ifdef HAVE_LIBBABELTRACE_SUPPORT |
79 | return bt_convert__perf2ctf(input_name, to_ctf); | 81 | return bt_convert__perf2ctf(input_name, to_ctf, force); |
80 | #else | 82 | #else |
81 | pr_err("The libbabeltrace support is not compiled in.\n"); | 83 | pr_err("The libbabeltrace support is not compiled in.\n"); |
82 | return -1; | 84 | return -1; |
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c index 0f93f859b782..695ec5a50cf2 100644 --- a/tools/perf/builtin-evlist.c +++ b/tools/perf/builtin-evlist.c | |||
@@ -24,6 +24,7 @@ static int __cmd_evlist(const char *file_name, struct perf_attr_details *details | |||
24 | struct perf_data_file file = { | 24 | struct perf_data_file file = { |
25 | .path = file_name, | 25 | .path = file_name, |
26 | .mode = PERF_DATA_MODE_READ, | 26 | .mode = PERF_DATA_MODE_READ, |
27 | .force = details->force, | ||
27 | }; | 28 | }; |
28 | 29 | ||
29 | session = perf_session__new(&file, 0, NULL); | 30 | session = perf_session__new(&file, 0, NULL); |
@@ -47,6 +48,7 @@ int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused) | |||
47 | "Show all event attr details"), | 48 | "Show all event attr details"), |
48 | OPT_BOOLEAN('g', "group", &details.event_group, | 49 | OPT_BOOLEAN('g', "group", &details.event_group, |
49 | "Show event group information"), | 50 | "Show event group information"), |
51 | OPT_BOOLEAN('f', "force", &details.force, "don't complain, do it"), | ||
50 | OPT_END() | 52 | OPT_END() |
51 | }; | 53 | }; |
52 | const char * const evlist_usage[] = { | 54 | const char * const evlist_usage[] = { |
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c index ea46df25368c..40a33d7334cc 100644 --- a/tools/perf/builtin-inject.c +++ b/tools/perf/builtin-inject.c | |||
@@ -443,6 +443,7 @@ int cmd_inject(int argc, const char **argv, const char *prefix __maybe_unused) | |||
443 | "be more verbose (show build ids, etc)"), | 443 | "be more verbose (show build ids, etc)"), |
444 | OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, "file", | 444 | OPT_STRING(0, "kallsyms", &symbol_conf.kallsyms_name, "file", |
445 | "kallsyms pathname"), | 445 | "kallsyms pathname"), |
446 | OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), | ||
446 | OPT_END() | 447 | OPT_END() |
447 | }; | 448 | }; |
448 | const char * const inject_usage[] = { | 449 | const char * const inject_usage[] = { |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 64d3623d45a0..ac303ef9f2f0 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -662,6 +662,10 @@ static int __cmd_record(int argc, const char **argv) | |||
662 | int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) | 662 | int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) |
663 | { | 663 | { |
664 | const char * const default_sort_order = "frag,hit,bytes"; | 664 | const char * const default_sort_order = "frag,hit,bytes"; |
665 | struct perf_data_file file = { | ||
666 | .path = input_name, | ||
667 | .mode = PERF_DATA_MODE_READ, | ||
668 | }; | ||
665 | const struct option kmem_options[] = { | 669 | const struct option kmem_options[] = { |
666 | OPT_STRING('i', "input", &input_name, "file", "input file name"), | 670 | OPT_STRING('i', "input", &input_name, "file", "input file name"), |
667 | OPT_INCR('v', "verbose", &verbose, | 671 | OPT_INCR('v', "verbose", &verbose, |
@@ -675,6 +679,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) | |||
675 | parse_sort_opt), | 679 | parse_sort_opt), |
676 | OPT_CALLBACK('l', "line", NULL, "num", "show n lines", parse_line_opt), | 680 | OPT_CALLBACK('l', "line", NULL, "num", "show n lines", parse_line_opt), |
677 | OPT_BOOLEAN(0, "raw-ip", &raw_ip, "show raw ip instead of symbol"), | 681 | OPT_BOOLEAN(0, "raw-ip", &raw_ip, "show raw ip instead of symbol"), |
682 | OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), | ||
678 | OPT_END() | 683 | OPT_END() |
679 | }; | 684 | }; |
680 | const char *const kmem_subcommands[] = { "record", "stat", NULL }; | 685 | const char *const kmem_subcommands[] = { "record", "stat", NULL }; |
@@ -683,10 +688,6 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused) | |||
683 | NULL | 688 | NULL |
684 | }; | 689 | }; |
685 | struct perf_session *session; | 690 | struct perf_session *session; |
686 | struct perf_data_file file = { | ||
687 | .path = input_name, | ||
688 | .mode = PERF_DATA_MODE_READ, | ||
689 | }; | ||
690 | int ret = -1; | 691 | int ret = -1; |
691 | 692 | ||
692 | argc = parse_options_subcommand(argc, argv, kmem_options, | 693 | argc = parse_options_subcommand(argc, argv, kmem_options, |
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 643722f40075..1f9338f6109c 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -1047,6 +1047,7 @@ static int read_events(struct perf_kvm_stat *kvm) | |||
1047 | struct perf_data_file file = { | 1047 | struct perf_data_file file = { |
1048 | .path = kvm->file_name, | 1048 | .path = kvm->file_name, |
1049 | .mode = PERF_DATA_MODE_READ, | 1049 | .mode = PERF_DATA_MODE_READ, |
1050 | .force = kvm->force, | ||
1050 | }; | 1051 | }; |
1051 | 1052 | ||
1052 | kvm->tool = eops; | 1053 | kvm->tool = eops; |
@@ -1204,6 +1205,7 @@ kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv) | |||
1204 | " time (sort by avg time)"), | 1205 | " time (sort by avg time)"), |
1205 | OPT_STRING('p', "pid", &kvm->opts.target.pid, "pid", | 1206 | OPT_STRING('p', "pid", &kvm->opts.target.pid, "pid", |
1206 | "analyze events only for given process id(s)"), | 1207 | "analyze events only for given process id(s)"), |
1208 | OPT_BOOLEAN('f', "force", &kvm->force, "don't complain, do it"), | ||
1207 | OPT_END() | 1209 | OPT_END() |
1208 | }; | 1210 | }; |
1209 | 1211 | ||
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 7893a9bba2a7..d49c2ab85fc2 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c | |||
@@ -846,6 +846,8 @@ static const struct perf_evsel_str_handler lock_tracepoints[] = { | |||
846 | { "lock:lock_release", perf_evsel__process_lock_release, }, /* CONFIG_LOCKDEP */ | 846 | { "lock:lock_release", perf_evsel__process_lock_release, }, /* CONFIG_LOCKDEP */ |
847 | }; | 847 | }; |
848 | 848 | ||
849 | static bool force; | ||
850 | |||
849 | static int __cmd_report(bool display_info) | 851 | static int __cmd_report(bool display_info) |
850 | { | 852 | { |
851 | int err = -EINVAL; | 853 | int err = -EINVAL; |
@@ -857,6 +859,7 @@ static int __cmd_report(bool display_info) | |||
857 | struct perf_data_file file = { | 859 | struct perf_data_file file = { |
858 | .path = input_name, | 860 | .path = input_name, |
859 | .mode = PERF_DATA_MODE_READ, | 861 | .mode = PERF_DATA_MODE_READ, |
862 | .force = force, | ||
860 | }; | 863 | }; |
861 | 864 | ||
862 | session = perf_session__new(&file, false, &eops); | 865 | session = perf_session__new(&file, false, &eops); |
@@ -945,6 +948,7 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) | |||
945 | "dump thread list in perf.data"), | 948 | "dump thread list in perf.data"), |
946 | OPT_BOOLEAN('m', "map", &info_map, | 949 | OPT_BOOLEAN('m', "map", &info_map, |
947 | "map of lock instances (address:name table)"), | 950 | "map of lock instances (address:name table)"), |
951 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | ||
948 | OPT_END() | 952 | OPT_END() |
949 | }; | 953 | }; |
950 | const struct option lock_options[] = { | 954 | const struct option lock_options[] = { |
@@ -956,6 +960,7 @@ int cmd_lock(int argc, const char **argv, const char *prefix __maybe_unused) | |||
956 | const struct option report_options[] = { | 960 | const struct option report_options[] = { |
957 | OPT_STRING('k', "key", &sort_key, "acquired", | 961 | OPT_STRING('k', "key", &sort_key, "acquired", |
958 | "key for sorting (acquired / contended / avg_wait / wait_total / wait_max / wait_min)"), | 962 | "key for sorting (acquired / contended / avg_wait / wait_total / wait_max / wait_min)"), |
963 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | ||
959 | /* TODO: type */ | 964 | /* TODO: type */ |
960 | OPT_END() | 965 | OPT_END() |
961 | }; | 966 | }; |
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index b4dcf0bfc029..675216e08bfc 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c | |||
@@ -15,6 +15,7 @@ struct perf_mem { | |||
15 | char const *input_name; | 15 | char const *input_name; |
16 | bool hide_unresolved; | 16 | bool hide_unresolved; |
17 | bool dump_raw; | 17 | bool dump_raw; |
18 | bool force; | ||
18 | int operation; | 19 | int operation; |
19 | const char *cpu_list; | 20 | const char *cpu_list; |
20 | DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); | 21 | DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); |
@@ -120,6 +121,7 @@ static int report_raw_events(struct perf_mem *mem) | |||
120 | struct perf_data_file file = { | 121 | struct perf_data_file file = { |
121 | .path = input_name, | 122 | .path = input_name, |
122 | .mode = PERF_DATA_MODE_READ, | 123 | .mode = PERF_DATA_MODE_READ, |
124 | .force = mem->force, | ||
123 | }; | 125 | }; |
124 | int err = -EINVAL; | 126 | int err = -EINVAL; |
125 | int ret; | 127 | int ret; |
@@ -290,6 +292,7 @@ int cmd_mem(int argc, const char **argv, const char *prefix __maybe_unused) | |||
290 | "separator", | 292 | "separator", |
291 | "separator for columns, no spaces will be added" | 293 | "separator for columns, no spaces will be added" |
292 | " between columns '.' is reserved."), | 294 | " between columns '.' is reserved."), |
295 | OPT_BOOLEAN('f', "force", &mem.force, "don't complain, do it"), | ||
293 | OPT_END() | 296 | OPT_END() |
294 | }; | 297 | }; |
295 | const char *const mem_subcommands[] = { "record", "report", NULL }; | 298 | const char *const mem_subcommands[] = { "record", "report", NULL }; |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 662366ceb572..58f10b8e6ff2 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -446,9 +446,9 @@ static void print_sample_bts(union perf_event *event, | |||
446 | } | 446 | } |
447 | 447 | ||
448 | static void process_event(union perf_event *event, struct perf_sample *sample, | 448 | static void process_event(union perf_event *event, struct perf_sample *sample, |
449 | struct perf_evsel *evsel, struct thread *thread, | 449 | struct perf_evsel *evsel, struct addr_location *al) |
450 | struct addr_location *al) | ||
451 | { | 450 | { |
451 | struct thread *thread = al->thread; | ||
452 | struct perf_event_attr *attr = &evsel->attr; | 452 | struct perf_event_attr *attr = &evsel->attr; |
453 | 453 | ||
454 | if (output[attr->type].fields == 0) | 454 | if (output[attr->type].fields == 0) |
@@ -549,14 +549,6 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, | |||
549 | struct machine *machine) | 549 | struct machine *machine) |
550 | { | 550 | { |
551 | struct addr_location al; | 551 | struct addr_location al; |
552 | struct thread *thread = machine__findnew_thread(machine, sample->pid, | ||
553 | sample->tid); | ||
554 | |||
555 | if (thread == NULL) { | ||
556 | pr_debug("problem processing %d event, skipping it.\n", | ||
557 | event->header.type); | ||
558 | return -1; | ||
559 | } | ||
560 | 552 | ||
561 | if (debug_mode) { | 553 | if (debug_mode) { |
562 | if (sample->time < last_timestamp) { | 554 | if (sample->time < last_timestamp) { |
@@ -581,7 +573,7 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, | |||
581 | if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) | 573 | if (cpu_list && !test_bit(sample->cpu, cpu_bitmap)) |
582 | return 0; | 574 | return 0; |
583 | 575 | ||
584 | scripting_ops->process_event(event, sample, evsel, thread, &al); | 576 | scripting_ops->process_event(event, sample, evsel, &al); |
585 | 577 | ||
586 | return 0; | 578 | return 0; |
587 | } | 579 | } |
@@ -1523,6 +1515,9 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1523 | .ordering_requires_timestamps = true, | 1515 | .ordering_requires_timestamps = true, |
1524 | }, | 1516 | }, |
1525 | }; | 1517 | }; |
1518 | struct perf_data_file file = { | ||
1519 | .mode = PERF_DATA_MODE_READ, | ||
1520 | }; | ||
1526 | const struct option options[] = { | 1521 | const struct option options[] = { |
1527 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1522 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
1528 | "dump raw trace in ASCII"), | 1523 | "dump raw trace in ASCII"), |
@@ -1550,7 +1545,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1550 | "When printing symbols do not display call chain"), | 1545 | "When printing symbols do not display call chain"), |
1551 | OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory", | 1546 | OPT_STRING(0, "symfs", &symbol_conf.symfs, "directory", |
1552 | "Look for files with symbols relative to this directory"), | 1547 | "Look for files with symbols relative to this directory"), |
1553 | OPT_CALLBACK('f', "fields", NULL, "str", | 1548 | OPT_CALLBACK('F', "fields", NULL, "str", |
1554 | "comma separated output fields prepend with 'type:'. " | 1549 | "comma separated output fields prepend with 'type:'. " |
1555 | "Valid types: hw,sw,trace,raw. " | 1550 | "Valid types: hw,sw,trace,raw. " |
1556 | "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," | 1551 | "Fields: comm,tid,pid,time,cpu,event,trace,ip,sym,dso," |
@@ -1574,6 +1569,7 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1574 | "Show the fork/comm/exit events"), | 1569 | "Show the fork/comm/exit events"), |
1575 | OPT_BOOLEAN('\0', "show-mmap-events", &script.show_mmap_events, | 1570 | OPT_BOOLEAN('\0', "show-mmap-events", &script.show_mmap_events, |
1576 | "Show the mmap events"), | 1571 | "Show the mmap events"), |
1572 | OPT_BOOLEAN('f', "force", &file.force, "don't complain, do it"), | ||
1577 | OPT_END() | 1573 | OPT_END() |
1578 | }; | 1574 | }; |
1579 | const char * const script_subcommands[] = { "record", "report", NULL }; | 1575 | const char * const script_subcommands[] = { "record", "report", NULL }; |
@@ -1585,9 +1581,6 @@ int cmd_script(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1585 | "perf script [<options>] <top-script> [script-args]", | 1581 | "perf script [<options>] <top-script> [script-args]", |
1586 | NULL | 1582 | NULL |
1587 | }; | 1583 | }; |
1588 | struct perf_data_file file = { | ||
1589 | .mode = PERF_DATA_MODE_READ, | ||
1590 | }; | ||
1591 | 1584 | ||
1592 | setup_scripting(); | 1585 | setup_scripting(); |
1593 | 1586 | ||
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index 494b3bbe5ea4..e50fe1187b0b 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -67,6 +67,7 @@ struct timechart { | |||
67 | skip_eagain; | 67 | skip_eagain; |
68 | u64 min_time, | 68 | u64 min_time, |
69 | merge_dist; | 69 | merge_dist; |
70 | bool force; | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | struct per_pidcomm; | 73 | struct per_pidcomm; |
@@ -1598,6 +1599,7 @@ static int __cmd_timechart(struct timechart *tchart, const char *output_name) | |||
1598 | struct perf_data_file file = { | 1599 | struct perf_data_file file = { |
1599 | .path = input_name, | 1600 | .path = input_name, |
1600 | .mode = PERF_DATA_MODE_READ, | 1601 | .mode = PERF_DATA_MODE_READ, |
1602 | .force = tchart->force, | ||
1601 | }; | 1603 | }; |
1602 | 1604 | ||
1603 | struct perf_session *session = perf_session__new(&file, false, | 1605 | struct perf_session *session = perf_session__new(&file, false, |
@@ -1956,6 +1958,7 @@ int cmd_timechart(int argc, const char **argv, | |||
1956 | OPT_CALLBACK(0, "io-merge-dist", &tchart.merge_dist, "time", | 1958 | OPT_CALLBACK(0, "io-merge-dist", &tchart.merge_dist, "time", |
1957 | "merge events that are merge-dist us apart", | 1959 | "merge events that are merge-dist us apart", |
1958 | parse_time), | 1960 | parse_time), |
1961 | OPT_BOOLEAN('f', "force", &tchart.force, "don't complain, do it"), | ||
1959 | OPT_END() | 1962 | OPT_END() |
1960 | }; | 1963 | }; |
1961 | const char * const timechart_subcommands[] = { "record", NULL }; | 1964 | const char * const timechart_subcommands[] = { "record", NULL }; |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index bcc98ce3e5b8..e124741be187 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1254,6 +1254,7 @@ struct trace { | |||
1254 | bool show_comm; | 1254 | bool show_comm; |
1255 | bool show_tool_stats; | 1255 | bool show_tool_stats; |
1256 | bool trace_syscalls; | 1256 | bool trace_syscalls; |
1257 | bool force; | ||
1257 | int trace_pgfaults; | 1258 | int trace_pgfaults; |
1258 | }; | 1259 | }; |
1259 | 1260 | ||
@@ -2345,6 +2346,7 @@ static int trace__replay(struct trace *trace) | |||
2345 | struct perf_data_file file = { | 2346 | struct perf_data_file file = { |
2346 | .path = input_name, | 2347 | .path = input_name, |
2347 | .mode = PERF_DATA_MODE_READ, | 2348 | .mode = PERF_DATA_MODE_READ, |
2349 | .force = trace->force, | ||
2348 | }; | 2350 | }; |
2349 | struct perf_session *session; | 2351 | struct perf_session *session; |
2350 | struct perf_evsel *evsel; | 2352 | struct perf_evsel *evsel; |
@@ -2693,6 +2695,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) | |||
2693 | OPT_CALLBACK_DEFAULT('F', "pf", &trace.trace_pgfaults, "all|maj|min", | 2695 | OPT_CALLBACK_DEFAULT('F', "pf", &trace.trace_pgfaults, "all|maj|min", |
2694 | "Trace pagefaults", parse_pagefaults, "maj"), | 2696 | "Trace pagefaults", parse_pagefaults, "maj"), |
2695 | OPT_BOOLEAN(0, "syscalls", &trace.trace_syscalls, "Trace syscalls"), | 2697 | OPT_BOOLEAN(0, "syscalls", &trace.trace_syscalls, "Trace syscalls"), |
2698 | OPT_BOOLEAN('f', "force", &trace.force, "don't complain, do it"), | ||
2696 | OPT_END() | 2699 | OPT_END() |
2697 | }; | 2700 | }; |
2698 | const char * const trace_subcommands[] = { "record", NULL }; | 2701 | const char * const trace_subcommands[] = { "record", NULL }; |
diff --git a/tools/perf/util/data-convert-bt.c b/tools/perf/util/data-convert-bt.c index c6d62268cc2a..dd17c9a32fbc 100644 --- a/tools/perf/util/data-convert-bt.c +++ b/tools/perf/util/data-convert-bt.c | |||
@@ -791,12 +791,13 @@ err: | |||
791 | return -1; | 791 | return -1; |
792 | } | 792 | } |
793 | 793 | ||
794 | int bt_convert__perf2ctf(const char *input, const char *path) | 794 | int bt_convert__perf2ctf(const char *input, const char *path, bool force) |
795 | { | 795 | { |
796 | struct perf_session *session; | 796 | struct perf_session *session; |
797 | struct perf_data_file file = { | 797 | struct perf_data_file file = { |
798 | .path = input, | 798 | .path = input, |
799 | .mode = PERF_DATA_MODE_READ, | 799 | .mode = PERF_DATA_MODE_READ, |
800 | .force = force, | ||
800 | }; | 801 | }; |
801 | struct convert c = { | 802 | struct convert c = { |
802 | .tool = { | 803 | .tool = { |
diff --git a/tools/perf/util/data-convert-bt.h b/tools/perf/util/data-convert-bt.h index dda30c5d0792..4c204342a9d8 100644 --- a/tools/perf/util/data-convert-bt.h +++ b/tools/perf/util/data-convert-bt.h | |||
@@ -2,7 +2,7 @@ | |||
2 | #define __DATA_CONVERT_BT_H | 2 | #define __DATA_CONVERT_BT_H |
3 | #ifdef HAVE_LIBBABELTRACE_SUPPORT | 3 | #ifdef HAVE_LIBBABELTRACE_SUPPORT |
4 | 4 | ||
5 | int bt_convert__perf2ctf(const char *input_name, const char *to_ctf); | 5 | int bt_convert__perf2ctf(const char *input_name, const char *to_ctf, bool force); |
6 | 6 | ||
7 | #endif /* HAVE_LIBBABELTRACE_SUPPORT */ | 7 | #endif /* HAVE_LIBBABELTRACE_SUPPORT */ |
8 | #endif /* __DATA_CONVERT_BT_H */ | 8 | #endif /* __DATA_CONVERT_BT_H */ |
diff --git a/tools/perf/util/db-export.c b/tools/perf/util/db-export.c index c81dae399763..bb39a3ffc70b 100644 --- a/tools/perf/util/db-export.c +++ b/tools/perf/util/db-export.c | |||
@@ -282,13 +282,13 @@ int db_export__branch_type(struct db_export *dbe, u32 branch_type, | |||
282 | 282 | ||
283 | int db_export__sample(struct db_export *dbe, union perf_event *event, | 283 | int db_export__sample(struct db_export *dbe, union perf_event *event, |
284 | struct perf_sample *sample, struct perf_evsel *evsel, | 284 | struct perf_sample *sample, struct perf_evsel *evsel, |
285 | struct thread *thread, struct addr_location *al) | 285 | struct addr_location *al) |
286 | { | 286 | { |
287 | struct thread* thread = al->thread; | ||
287 | struct export_sample es = { | 288 | struct export_sample es = { |
288 | .event = event, | 289 | .event = event, |
289 | .sample = sample, | 290 | .sample = sample, |
290 | .evsel = evsel, | 291 | .evsel = evsel, |
291 | .thread = thread, | ||
292 | .al = al, | 292 | .al = al, |
293 | }; | 293 | }; |
294 | struct thread *main_thread; | 294 | struct thread *main_thread; |
diff --git a/tools/perf/util/db-export.h b/tools/perf/util/db-export.h index adbd22d66798..25e22fd76aca 100644 --- a/tools/perf/util/db-export.h +++ b/tools/perf/util/db-export.h | |||
@@ -34,7 +34,6 @@ struct export_sample { | |||
34 | union perf_event *event; | 34 | union perf_event *event; |
35 | struct perf_sample *sample; | 35 | struct perf_sample *sample; |
36 | struct perf_evsel *evsel; | 36 | struct perf_evsel *evsel; |
37 | struct thread *thread; | ||
38 | struct addr_location *al; | 37 | struct addr_location *al; |
39 | u64 db_id; | 38 | u64 db_id; |
40 | u64 comm_db_id; | 39 | u64 comm_db_id; |
@@ -97,7 +96,7 @@ int db_export__branch_type(struct db_export *dbe, u32 branch_type, | |||
97 | const char *name); | 96 | const char *name); |
98 | int db_export__sample(struct db_export *dbe, union perf_event *event, | 97 | int db_export__sample(struct db_export *dbe, union perf_event *event, |
99 | struct perf_sample *sample, struct perf_evsel *evsel, | 98 | struct perf_sample *sample, struct perf_evsel *evsel, |
100 | struct thread *thread, struct addr_location *al); | 99 | struct addr_location *al); |
101 | 100 | ||
102 | int db_export__branch_types(struct db_export *dbe); | 101 | int db_export__branch_types(struct db_export *dbe); |
103 | 102 | ||
diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c index 780b2bc11128..c34e024020c7 100644 --- a/tools/perf/util/dwarf-aux.c +++ b/tools/perf/util/dwarf-aux.c | |||
@@ -801,10 +801,16 @@ static int __die_find_member_cb(Dwarf_Die *die_mem, void *data) | |||
801 | { | 801 | { |
802 | const char *name = data; | 802 | const char *name = data; |
803 | 803 | ||
804 | if ((dwarf_tag(die_mem) == DW_TAG_member) && | 804 | if (dwarf_tag(die_mem) == DW_TAG_member) { |
805 | die_compare_name(die_mem, name)) | 805 | if (die_compare_name(die_mem, name)) |
806 | return DIE_FIND_CB_END; | 806 | return DIE_FIND_CB_END; |
807 | 807 | else if (!dwarf_diename(die_mem)) { /* Unnamed structure */ | |
808 | Dwarf_Die type_die, tmp_die; | ||
809 | if (die_get_type(die_mem, &type_die) && | ||
810 | die_find_member(&type_die, name, &tmp_die)) | ||
811 | return DIE_FIND_CB_END; | ||
812 | } | ||
813 | } | ||
808 | return DIE_FIND_CB_SIBLING; | 814 | return DIE_FIND_CB_SIBLING; |
809 | } | 815 | } |
810 | 816 | ||
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index dcf202aebe9f..c5a43d6b13dc 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
@@ -335,6 +335,7 @@ struct perf_attr_details { | |||
335 | bool freq; | 335 | bool freq; |
336 | bool verbose; | 336 | bool verbose; |
337 | bool event_group; | 337 | bool event_group; |
338 | bool force; | ||
338 | }; | 339 | }; |
339 | 340 | ||
340 | int perf_evsel__fprintf(struct perf_evsel *evsel, | 341 | int perf_evsel__fprintf(struct perf_evsel *evsel, |
diff --git a/tools/perf/util/kvm-stat.h b/tools/perf/util/kvm-stat.h index cf1d7913783b..ae825d4ec110 100644 --- a/tools/perf/util/kvm-stat.h +++ b/tools/perf/util/kvm-stat.h | |||
@@ -99,6 +99,7 @@ struct perf_kvm_stat { | |||
99 | int timerfd; | 99 | int timerfd; |
100 | unsigned int display_time; | 100 | unsigned int display_time; |
101 | bool live; | 101 | bool live; |
102 | bool force; | ||
102 | }; | 103 | }; |
103 | 104 | ||
104 | struct kvm_reg_events_ops { | 105 | struct kvm_reg_events_ops { |
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 46f009aa486c..7831e2d93949 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -460,7 +460,8 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname, | |||
460 | " nor array.\n", varname); | 460 | " nor array.\n", varname); |
461 | return -EINVAL; | 461 | return -EINVAL; |
462 | } | 462 | } |
463 | if (field->ref) { | 463 | /* While prcessing unnamed field, we don't care about this */ |
464 | if (field->ref && dwarf_diename(vr_die)) { | ||
464 | pr_err("Semantic error: %s must be referred by '.'\n", | 465 | pr_err("Semantic error: %s must be referred by '.'\n", |
465 | field->name); | 466 | field->name); |
466 | return -EINVAL; | 467 | return -EINVAL; |
@@ -491,6 +492,11 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname, | |||
491 | } | 492 | } |
492 | ref->offset += (long)offs; | 493 | ref->offset += (long)offs; |
493 | 494 | ||
495 | /* If this member is unnamed, we need to reuse this field */ | ||
496 | if (!dwarf_diename(die_mem)) | ||
497 | return convert_variable_fields(die_mem, varname, field, | ||
498 | &ref, die_mem); | ||
499 | |||
494 | next: | 500 | next: |
495 | /* Converting next field */ | 501 | /* Converting next field */ |
496 | if (field->next) | 502 | if (field->next) |
diff --git a/tools/perf/util/scripting-engines/trace-event-perl.c b/tools/perf/util/scripting-engines/trace-event-perl.c index 8171fed4136e..430b5d27828e 100644 --- a/tools/perf/util/scripting-engines/trace-event-perl.c +++ b/tools/perf/util/scripting-engines/trace-event-perl.c | |||
@@ -360,10 +360,9 @@ static void perl_process_event_generic(union perf_event *event, | |||
360 | static void perl_process_event(union perf_event *event, | 360 | static void perl_process_event(union perf_event *event, |
361 | struct perf_sample *sample, | 361 | struct perf_sample *sample, |
362 | struct perf_evsel *evsel, | 362 | struct perf_evsel *evsel, |
363 | struct thread *thread, | 363 | struct addr_location *al) |
364 | struct addr_location *al __maybe_unused) | ||
365 | { | 364 | { |
366 | perl_process_tracepoint(sample, evsel, thread); | 365 | perl_process_tracepoint(sample, evsel, al->thread); |
367 | perl_process_event_generic(event, sample, evsel); | 366 | perl_process_event_generic(event, sample, evsel); |
368 | } | 367 | } |
369 | 368 | ||
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c index 2ec5dfb5a456..5544b8cdd1ee 100644 --- a/tools/perf/util/scripting-engines/trace-event-python.c +++ b/tools/perf/util/scripting-engines/trace-event-python.c | |||
@@ -381,7 +381,6 @@ exit: | |||
381 | 381 | ||
382 | static void python_process_tracepoint(struct perf_sample *sample, | 382 | static void python_process_tracepoint(struct perf_sample *sample, |
383 | struct perf_evsel *evsel, | 383 | struct perf_evsel *evsel, |
384 | struct thread *thread, | ||
385 | struct addr_location *al) | 384 | struct addr_location *al) |
386 | { | 385 | { |
387 | struct event_format *event = evsel->tp_format; | 386 | struct event_format *event = evsel->tp_format; |
@@ -395,7 +394,7 @@ static void python_process_tracepoint(struct perf_sample *sample, | |||
395 | int cpu = sample->cpu; | 394 | int cpu = sample->cpu; |
396 | void *data = sample->raw_data; | 395 | void *data = sample->raw_data; |
397 | unsigned long long nsecs = sample->time; | 396 | unsigned long long nsecs = sample->time; |
398 | const char *comm = thread__comm_str(thread); | 397 | const char *comm = thread__comm_str(al->thread); |
399 | 398 | ||
400 | t = PyTuple_New(MAX_FIELDS); | 399 | t = PyTuple_New(MAX_FIELDS); |
401 | if (!t) | 400 | if (!t) |
@@ -680,7 +679,7 @@ static int python_export_sample(struct db_export *dbe, | |||
680 | tuple_set_u64(t, 0, es->db_id); | 679 | tuple_set_u64(t, 0, es->db_id); |
681 | tuple_set_u64(t, 1, es->evsel->db_id); | 680 | tuple_set_u64(t, 1, es->evsel->db_id); |
682 | tuple_set_u64(t, 2, es->al->machine->db_id); | 681 | tuple_set_u64(t, 2, es->al->machine->db_id); |
683 | tuple_set_u64(t, 3, es->thread->db_id); | 682 | tuple_set_u64(t, 3, es->al->thread->db_id); |
684 | tuple_set_u64(t, 4, es->comm_db_id); | 683 | tuple_set_u64(t, 4, es->comm_db_id); |
685 | tuple_set_u64(t, 5, es->dso_db_id); | 684 | tuple_set_u64(t, 5, es->dso_db_id); |
686 | tuple_set_u64(t, 6, es->sym_db_id); | 685 | tuple_set_u64(t, 6, es->sym_db_id); |
@@ -766,7 +765,6 @@ static int python_process_call_return(struct call_return *cr, void *data) | |||
766 | 765 | ||
767 | static void python_process_general_event(struct perf_sample *sample, | 766 | static void python_process_general_event(struct perf_sample *sample, |
768 | struct perf_evsel *evsel, | 767 | struct perf_evsel *evsel, |
769 | struct thread *thread, | ||
770 | struct addr_location *al) | 768 | struct addr_location *al) |
771 | { | 769 | { |
772 | PyObject *handler, *t, *dict, *callchain, *dict_sample; | 770 | PyObject *handler, *t, *dict, *callchain, *dict_sample; |
@@ -816,7 +814,7 @@ static void python_process_general_event(struct perf_sample *sample, | |||
816 | pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( | 814 | pydict_set_item_string_decref(dict, "raw_buf", PyString_FromStringAndSize( |
817 | (const char *)sample->raw_data, sample->raw_size)); | 815 | (const char *)sample->raw_data, sample->raw_size)); |
818 | pydict_set_item_string_decref(dict, "comm", | 816 | pydict_set_item_string_decref(dict, "comm", |
819 | PyString_FromString(thread__comm_str(thread))); | 817 | PyString_FromString(thread__comm_str(al->thread))); |
820 | if (al->map) { | 818 | if (al->map) { |
821 | pydict_set_item_string_decref(dict, "dso", | 819 | pydict_set_item_string_decref(dict, "dso", |
822 | PyString_FromString(al->map->dso->name)); | 820 | PyString_FromString(al->map->dso->name)); |
@@ -843,22 +841,20 @@ exit: | |||
843 | static void python_process_event(union perf_event *event, | 841 | static void python_process_event(union perf_event *event, |
844 | struct perf_sample *sample, | 842 | struct perf_sample *sample, |
845 | struct perf_evsel *evsel, | 843 | struct perf_evsel *evsel, |
846 | struct thread *thread, | ||
847 | struct addr_location *al) | 844 | struct addr_location *al) |
848 | { | 845 | { |
849 | struct tables *tables = &tables_global; | 846 | struct tables *tables = &tables_global; |
850 | 847 | ||
851 | switch (evsel->attr.type) { | 848 | switch (evsel->attr.type) { |
852 | case PERF_TYPE_TRACEPOINT: | 849 | case PERF_TYPE_TRACEPOINT: |
853 | python_process_tracepoint(sample, evsel, thread, al); | 850 | python_process_tracepoint(sample, evsel, al); |
854 | break; | 851 | break; |
855 | /* Reserve for future process_hw/sw/raw APIs */ | 852 | /* Reserve for future process_hw/sw/raw APIs */ |
856 | default: | 853 | default: |
857 | if (tables->db_export_mode) | 854 | if (tables->db_export_mode) |
858 | db_export__sample(&tables->dbe, event, sample, evsel, | 855 | db_export__sample(&tables->dbe, event, sample, evsel, al); |
859 | thread, al); | ||
860 | else | 856 | else |
861 | python_process_general_event(sample, evsel, thread, al); | 857 | python_process_general_event(sample, evsel, al); |
862 | } | 858 | } |
863 | } | 859 | } |
864 | 860 | ||
diff --git a/tools/perf/util/trace-event-scripting.c b/tools/perf/util/trace-event-scripting.c index 5c9bdd1591a9..9df61059a85d 100644 --- a/tools/perf/util/trace-event-scripting.c +++ b/tools/perf/util/trace-event-scripting.c | |||
@@ -43,7 +43,6 @@ static int stop_script_unsupported(void) | |||
43 | static void process_event_unsupported(union perf_event *event __maybe_unused, | 43 | static void process_event_unsupported(union perf_event *event __maybe_unused, |
44 | struct perf_sample *sample __maybe_unused, | 44 | struct perf_sample *sample __maybe_unused, |
45 | struct perf_evsel *evsel __maybe_unused, | 45 | struct perf_evsel *evsel __maybe_unused, |
46 | struct thread *thread __maybe_unused, | ||
47 | struct addr_location *al __maybe_unused) | 46 | struct addr_location *al __maybe_unused) |
48 | { | 47 | { |
49 | } | 48 | } |
diff --git a/tools/perf/util/trace-event.h b/tools/perf/util/trace-event.h index 356629a30ca9..d5168f0be4ec 100644 --- a/tools/perf/util/trace-event.h +++ b/tools/perf/util/trace-event.h | |||
@@ -72,8 +72,7 @@ struct scripting_ops { | |||
72 | void (*process_event) (union perf_event *event, | 72 | void (*process_event) (union perf_event *event, |
73 | struct perf_sample *sample, | 73 | struct perf_sample *sample, |
74 | struct perf_evsel *evsel, | 74 | struct perf_evsel *evsel, |
75 | struct thread *thread, | 75 | struct addr_location *al); |
76 | struct addr_location *al); | ||
77 | int (*generate_script) (struct pevent *pevent, const char *outfile); | 76 | int (*generate_script) (struct pevent *pevent, const char *outfile); |
78 | }; | 77 | }; |
79 | 78 | ||