summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-stat.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@kernel.org>2018-07-25 22:31:00 +0200
committerIngo Molnar <mingo@kernel.org>2018-07-25 22:31:00 +0200
commit25a00ac7dc92912f0b1e5e533bf077255c828b02 (patch)
treef6b9b7ae61c70dfa18ce40d2c0b2f24939d09448 /tools/perf/builtin-stat.c
parenta38b0ba1b7d2e7a6d19877540240e8a4352fc93c (diff)
parent9ef0112442bdddef5fb55adf20b3a5464b33de75 (diff)
Merge tag 'perf-core-for-mingo-4.19-20180725' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
Pull perf/cores fixes and improvements from Arnaldo Carvalho de Melo: Tools: top: - Fix 'struct comm_str' removal crash race, detected with refcount_t debugging (Jiri Olsa) - Use last_match threads cache only in single threaded mode, fixing a crash (Jiri Olsa) record: - Synthesize GROUP_DESC feature in pipe mode fixing display of event groups (Jiri Olsa) stat: - Get rid of extra clock display function (Jiri Olsa) perf script: - Show correct offsets for DWARF-based unwinding (Sandipan Das) test: - Check that complex event name is parsed correctly (Alexey Budankov) - Fix subtest number when showing results (Thomas Richter) Arch specific: arm64: - Generate syscall table from the kernel sources (asm/unistd.h) like other arches do, speeding up the support for new system calls in tools such as 'perf trace' (Kim Phillips) arm: - Bail out immediatelly on CoreSight hardware tracing instruction sample failure (Leo Yan) PowerPC: - Fix record+probe_libc_inet_pton.sh 'perf test' entry (Sandipan Das) - Callchain IP filtering fixes (Sandipan Das) S/390: - Add support for detailed S/390 PMU event description in 'perf list' (Thomas Richter) - Add transaction flag (-T) support in 'perf stat' for S/390 (Thomas Richter) - Fix 'perf kvm' S/390 subcommands (Thomas Richter) Infrastructure: hists: - Clarify callchain disabling when available (Arnaldo Carvalho de Melo) evsel: - Use perf_evsel__match instead of open coded equivalent (Jiri Olsa) Documentation: - Add missing documentation for 'perf list' --desc and --debug options (Sangwon Hong) Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf/builtin-stat.c')
-rw-r--r--tools/perf/builtin-stat.c60
1 files changed, 14 insertions, 46 deletions
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 05be023c3f0e..d097b5b47eb8 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -296,18 +296,6 @@ static int create_perf_stat_counter(struct perf_evsel *evsel)
return perf_evsel__open_per_thread(evsel, evsel_list->threads);
}
-/*
- * Does the counter have nsecs as a unit?
- */
-static inline int nsec_counter(struct perf_evsel *evsel)
-{
- if (perf_evsel__match(evsel, SOFTWARE, SW_CPU_CLOCK) ||
- perf_evsel__match(evsel, SOFTWARE, SW_TASK_CLOCK))
- return 1;
-
- return 0;
-}
-
static int process_synthesized_event(struct perf_tool *tool __maybe_unused,
union perf_event *event,
struct perf_sample *sample __maybe_unused,
@@ -1058,34 +1046,6 @@ static void print_metric_header(void *ctx, const char *color __maybe_unused,
fprintf(os->fh, "%*s ", metric_only_len, unit);
}
-static void nsec_printout(int id, int nr, struct perf_evsel *evsel, double avg)
-{
- FILE *output = stat_config.output;
- double msecs = avg / NSEC_PER_MSEC;
- const char *fmt_v, *fmt_n;
- char name[25];
-
- fmt_v = csv_output ? "%.6f%s" : "%18.6f%s";
- fmt_n = csv_output ? "%s" : "%-25s";
-
- aggr_printout(evsel, id, nr);
-
- scnprintf(name, sizeof(name), "%s%s",
- perf_evsel__name(evsel), csv_output ? "" : " (msec)");
-
- fprintf(output, fmt_v, msecs, csv_sep);
-
- if (csv_output)
- fprintf(output, "%s%s", evsel->unit, csv_sep);
- else
- fprintf(output, "%-*s%s", unit_width, evsel->unit, csv_sep);
-
- fprintf(output, fmt_n, name);
-
- if (evsel->cgrp)
- fprintf(output, "%s%s", csv_sep, evsel->cgrp->name);
-}
-
static int first_shadow_cpu(struct perf_evsel *evsel, int id)
{
int i;
@@ -1241,11 +1201,7 @@ static void printout(int id, int nr, struct perf_evsel *counter, double uval,
return;
}
- if (metric_only)
- /* nothing */;
- else if (nsec_counter(counter))
- nsec_printout(id, nr, counter, uval);
- else
+ if (!metric_only)
abs_printout(id, nr, counter, uval);
out.print_metric = pm;
@@ -1331,7 +1287,7 @@ static void collect_all_aliases(struct perf_evsel *counter,
alias->scale != counter->scale ||
alias->cgrp != counter->cgrp ||
strcmp(alias->unit, counter->unit) ||
- nsec_counter(alias) != nsec_counter(counter))
+ perf_evsel__is_clock(alias) != perf_evsel__is_clock(counter))
break;
alias->merged_stat = true;
cb(alias, data, false);
@@ -2449,6 +2405,18 @@ static int add_default_attributes(void)
return 0;
if (transaction_run) {
+ /* Handle -T as -M transaction. Once platform specific metrics
+ * support has been added to the json files, all archictures
+ * will use this approach. To determine transaction support
+ * on an architecture test for such a metric name.
+ */
+ if (metricgroup__has_metric("transaction")) {
+ struct option opt = { .value = &evsel_list };
+
+ return metricgroup__parse_groups(&opt, "transaction",
+ &metric_events);
+ }
+
if (pmu_have_event("cpu", "cycles-ct") &&
pmu_have_event("cpu", "el-start"))
err = parse_events(evsel_list, transaction_attrs,