diff options
Diffstat (limited to 'tools/perf/builtin-script.c')
| -rw-r--r-- | tools/perf/builtin-script.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index d079f36d342d..ac221f137ed2 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
| @@ -1681,13 +1681,8 @@ static void perf_sample__fprint_metric(struct perf_script *script, | |||
| 1681 | .force_header = false, | 1681 | .force_header = false, |
| 1682 | }; | 1682 | }; |
| 1683 | struct perf_evsel *ev2; | 1683 | struct perf_evsel *ev2; |
| 1684 | static bool init; | ||
| 1685 | u64 val; | 1684 | u64 val; |
| 1686 | 1685 | ||
| 1687 | if (!init) { | ||
| 1688 | perf_stat__init_shadow_stats(); | ||
| 1689 | init = true; | ||
| 1690 | } | ||
| 1691 | if (!evsel->stats) | 1686 | if (!evsel->stats) |
| 1692 | perf_evlist__alloc_stats(script->session->evlist, false); | 1687 | perf_evlist__alloc_stats(script->session->evlist, false); |
| 1693 | if (evsel_script(evsel->leader)->gnum++ == 0) | 1688 | if (evsel_script(evsel->leader)->gnum++ == 0) |
| @@ -1794,7 +1789,7 @@ static void process_event(struct perf_script *script, | |||
| 1794 | return; | 1789 | return; |
| 1795 | } | 1790 | } |
| 1796 | 1791 | ||
| 1797 | if (PRINT_FIELD(TRACE)) { | 1792 | if (PRINT_FIELD(TRACE) && sample->raw_data) { |
| 1798 | event_format__fprintf(evsel->tp_format, sample->cpu, | 1793 | event_format__fprintf(evsel->tp_format, sample->cpu, |
| 1799 | sample->raw_data, sample->raw_size, fp); | 1794 | sample->raw_data, sample->raw_size, fp); |
| 1800 | } | 1795 | } |
| @@ -2359,6 +2354,8 @@ static int __cmd_script(struct perf_script *script) | |||
| 2359 | 2354 | ||
| 2360 | signal(SIGINT, sig_handler); | 2355 | signal(SIGINT, sig_handler); |
| 2361 | 2356 | ||
| 2357 | perf_stat__init_shadow_stats(); | ||
| 2358 | |||
| 2362 | /* override event processing functions */ | 2359 | /* override event processing functions */ |
| 2363 | if (script->show_task_events) { | 2360 | if (script->show_task_events) { |
| 2364 | script->tool.comm = process_comm_event; | 2361 | script->tool.comm = process_comm_event; |
