aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-script.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r--tools/perf/builtin-script.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index 5e1865408aa5..5e2f9d20a296 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -677,10 +677,46 @@ static void process_event(struct perf_script *script __maybe_unused, union perf_
677 677
678static struct scripting_ops *scripting_ops; 678static struct scripting_ops *scripting_ops;
679 679
680static void __process_stat(struct perf_evsel *counter, u64 tstamp)
681{
682 int nthreads = thread_map__nr(counter->threads);
683 int ncpus = perf_evsel__nr_cpus(counter);
684 int cpu, thread;
685 static int header_printed;
686
687 if (counter->system_wide)
688 nthreads = 1;
689
690 if (!header_printed) {
691 printf("%3s %8s %15s %15s %15s %15s %s\n",
692 "CPU", "THREAD", "VAL", "ENA", "RUN", "TIME", "EVENT");
693 header_printed = 1;
694 }
695
696 for (thread = 0; thread < nthreads; thread++) {
697 for (cpu = 0; cpu < ncpus; cpu++) {
698 struct perf_counts_values *counts;
699
700 counts = perf_counts(counter->counts, cpu, thread);
701
702 printf("%3d %8d %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %15" PRIu64 " %s\n",
703 counter->cpus->map[cpu],
704 thread_map__pid(counter->threads, thread),
705 counts->val,
706 counts->ena,
707 counts->run,
708 tstamp,
709 perf_evsel__name(counter));
710 }
711 }
712}
713
680static void process_stat(struct perf_evsel *counter, u64 tstamp) 714static void process_stat(struct perf_evsel *counter, u64 tstamp)
681{ 715{
682 if (scripting_ops && scripting_ops->process_stat) 716 if (scripting_ops && scripting_ops->process_stat)
683 scripting_ops->process_stat(&stat_config, counter, tstamp); 717 scripting_ops->process_stat(&stat_config, counter, tstamp);
718 else
719 __process_stat(counter, tstamp);
684} 720}
685 721
686static void process_stat_interval(u64 tstamp) 722static void process_stat_interval(u64 tstamp)