mirror of
https://github.com/torvalds/linux.git
synced 2026-05-24 07:03:03 +02:00
perf stat: Remove hard coded transaction events
The metric group "transaction" is now present for Intel architectures so the legacy hard coded approach won't be used. Remove the associated logic. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Alexandre Torgue <alexandre.torgue@foss.st.com> Cc: Andrii Nakryiko <andrii@kernel.org> Cc: Athira Rajeev <atrajeev@linux.vnet.ibm.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Eduard Zingerman <eddyz87@gmail.com> Cc: Florian Fischer <florian.fischer@muhq.space> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jing Zhang <renyu.zj@linux.alibaba.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.g.garry@oracle.com> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ravi Bangoria <ravi.bangoria@amd.com> Cc: Sandipan Das <sandipan.das@amd.com> Cc: Sean Christopherson <seanjc@google.com> Cc: Stephane Eranian <eranian@google.com> Cc: Suzuki Poulouse <suzuki.poulose@arm.com> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-stm32@st-md-mailman.stormreply.com Link: https://lore.kernel.org/r/20230219092848.639226-44-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
20cb10eadb
commit
d6964c5b1f
|
|
@ -100,30 +100,6 @@
|
|||
|
||||
static void print_counters(struct timespec *ts, int argc, const char **argv);
|
||||
|
||||
/* Default events used for perf stat -T */
|
||||
static const char *transaction_attrs = {
|
||||
"task-clock,"
|
||||
"{"
|
||||
"instructions,"
|
||||
"cycles,"
|
||||
"cpu/cycles-t/,"
|
||||
"cpu/tx-start/,"
|
||||
"cpu/el-start/,"
|
||||
"cpu/cycles-ct/"
|
||||
"}"
|
||||
};
|
||||
|
||||
/* More limited version when the CPU does not have all events. */
|
||||
static const char * transaction_limited_attrs = {
|
||||
"task-clock,"
|
||||
"{"
|
||||
"instructions,"
|
||||
"cycles,"
|
||||
"cpu/cycles-t/,"
|
||||
"cpu/tx-start/"
|
||||
"}"
|
||||
};
|
||||
|
||||
static const char *smi_cost_attrs = {
|
||||
"{"
|
||||
"msr/aperf/,"
|
||||
|
|
@ -1811,37 +1787,22 @@ static int add_default_attributes(void)
|
|||
return 0;
|
||||
|
||||
if (transaction_run) {
|
||||
struct parse_events_error errinfo;
|
||||
/* Handle -T as -M transaction. Once platform specific metrics
|
||||
* support has been added to the json files, all architectures
|
||||
* will use this approach. To determine transaction support
|
||||
* on an architecture test for such a metric name.
|
||||
*/
|
||||
if (metricgroup__has_metric("transaction")) {
|
||||
return metricgroup__parse_groups(evsel_list, "transaction",
|
||||
stat_config.metric_no_group,
|
||||
stat_config.metric_no_merge,
|
||||
stat_config.metric_no_threshold,
|
||||
stat_config.user_requested_cpu_list,
|
||||
stat_config.system_wide,
|
||||
&stat_config.metric_events);
|
||||
if (!metricgroup__has_metric("transaction")) {
|
||||
pr_err("Missing transaction metrics");
|
||||
return -1;
|
||||
}
|
||||
|
||||
parse_events_error__init(&errinfo);
|
||||
if (pmu_have_event("cpu", "cycles-ct") &&
|
||||
pmu_have_event("cpu", "el-start"))
|
||||
err = parse_events(evsel_list, transaction_attrs,
|
||||
&errinfo);
|
||||
else
|
||||
err = parse_events(evsel_list,
|
||||
transaction_limited_attrs,
|
||||
&errinfo);
|
||||
if (err) {
|
||||
fprintf(stderr, "Cannot set up transaction events\n");
|
||||
parse_events_error__print(&errinfo, transaction_attrs);
|
||||
}
|
||||
parse_events_error__exit(&errinfo);
|
||||
return err ? -1 : 0;
|
||||
return metricgroup__parse_groups(evsel_list, "transaction",
|
||||
stat_config.metric_no_group,
|
||||
stat_config.metric_no_merge,
|
||||
stat_config.metric_no_threshold,
|
||||
stat_config.user_requested_cpu_list,
|
||||
stat_config.system_wide,
|
||||
&stat_config.metric_events);
|
||||
}
|
||||
|
||||
if (smi_cost) {
|
||||
|
|
|
|||
|
|
@ -235,12 +235,6 @@ void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
|
|||
update_runtime_stat(st, STAT_NSECS, map_idx, count_ns, &rsd);
|
||||
else if (evsel__match(counter, HARDWARE, HW_CPU_CYCLES))
|
||||
update_runtime_stat(st, STAT_CYCLES, map_idx, count, &rsd);
|
||||
else if (perf_stat_evsel__is(counter, CYCLES_IN_TX))
|
||||
update_runtime_stat(st, STAT_CYCLES_IN_TX, map_idx, count, &rsd);
|
||||
else if (perf_stat_evsel__is(counter, TRANSACTION_START))
|
||||
update_runtime_stat(st, STAT_TRANSACTION, map_idx, count, &rsd);
|
||||
else if (perf_stat_evsel__is(counter, ELISION_START))
|
||||
update_runtime_stat(st, STAT_ELISION, map_idx, count, &rsd);
|
||||
else if (evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_FRONTEND))
|
||||
update_runtime_stat(st, STAT_STALLED_CYCLES_FRONT,
|
||||
map_idx, count, &rsd);
|
||||
|
|
@ -695,7 +689,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
|
|||
{
|
||||
void *ctxp = out->ctx;
|
||||
print_metric_t print_metric = out->print_metric;
|
||||
double total, ratio = 0.0, total2;
|
||||
double total, ratio = 0.0;
|
||||
struct runtime_stat_data rsd = {
|
||||
.ctx = evsel_context(evsel),
|
||||
.cgrp = evsel->cgrp,
|
||||
|
|
@ -808,46 +802,6 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
|
|||
} else {
|
||||
print_metric(config, ctxp, NULL, NULL, "Ghz", 0);
|
||||
}
|
||||
} else if (perf_stat_evsel__is(evsel, CYCLES_IN_TX)) {
|
||||
total = runtime_stat_avg(st, STAT_CYCLES, map_idx, &rsd);
|
||||
|
||||
if (total)
|
||||
print_metric(config, ctxp, NULL,
|
||||
"%7.2f%%", "transactional cycles",
|
||||
100.0 * (avg / total));
|
||||
else
|
||||
print_metric(config, ctxp, NULL, NULL, "transactional cycles",
|
||||
0);
|
||||
} else if (perf_stat_evsel__is(evsel, CYCLES_IN_TX_CP)) {
|
||||
total = runtime_stat_avg(st, STAT_CYCLES, map_idx, &rsd);
|
||||
total2 = runtime_stat_avg(st, STAT_CYCLES_IN_TX, map_idx, &rsd);
|
||||
|
||||
if (total2 < avg)
|
||||
total2 = avg;
|
||||
if (total)
|
||||
print_metric(config, ctxp, NULL, "%7.2f%%", "aborted cycles",
|
||||
100.0 * ((total2-avg) / total));
|
||||
else
|
||||
print_metric(config, ctxp, NULL, NULL, "aborted cycles", 0);
|
||||
} else if (perf_stat_evsel__is(evsel, TRANSACTION_START)) {
|
||||
total = runtime_stat_avg(st, STAT_CYCLES_IN_TX, map_idx, &rsd);
|
||||
|
||||
if (avg)
|
||||
ratio = total / avg;
|
||||
|
||||
if (runtime_stat_n(st, STAT_CYCLES_IN_TX, map_idx, &rsd) != 0)
|
||||
print_metric(config, ctxp, NULL, "%8.0f",
|
||||
"cycles / transaction", ratio);
|
||||
else
|
||||
print_metric(config, ctxp, NULL, NULL, "cycles / transaction",
|
||||
0);
|
||||
} else if (perf_stat_evsel__is(evsel, ELISION_START)) {
|
||||
total = runtime_stat_avg(st, STAT_CYCLES_IN_TX, map_idx, &rsd);
|
||||
|
||||
if (avg)
|
||||
ratio = total / avg;
|
||||
|
||||
print_metric(config, ctxp, NULL, "%8.0f", "cycles / elision", ratio);
|
||||
} else if (evsel__is_clock(evsel)) {
|
||||
if ((ratio = avg_stats(&walltime_nsecs_stats)) != 0)
|
||||
print_metric(config, ctxp, NULL, "%8.3f", "CPUs utilized",
|
||||
|
|
|
|||
|
|
@ -87,10 +87,6 @@ bool __perf_stat_evsel__is(struct evsel *evsel, enum perf_stat_evsel_id id)
|
|||
#define ID(id, name) [PERF_STAT_EVSEL_ID__##id] = #name
|
||||
static const char *id_str[PERF_STAT_EVSEL_ID__MAX] = {
|
||||
ID(NONE, x),
|
||||
ID(CYCLES_IN_TX, cpu/cycles-t/),
|
||||
ID(TRANSACTION_START, cpu/tx-start/),
|
||||
ID(ELISION_START, cpu/el-start/),
|
||||
ID(CYCLES_IN_TX_CP, cpu/cycles-ct/),
|
||||
ID(SMI_NUM, msr/smi/),
|
||||
ID(APERF, msr/aperf/),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,10 +21,6 @@ struct stats {
|
|||
|
||||
enum perf_stat_evsel_id {
|
||||
PERF_STAT_EVSEL_ID__NONE = 0,
|
||||
PERF_STAT_EVSEL_ID__CYCLES_IN_TX,
|
||||
PERF_STAT_EVSEL_ID__TRANSACTION_START,
|
||||
PERF_STAT_EVSEL_ID__ELISION_START,
|
||||
PERF_STAT_EVSEL_ID__CYCLES_IN_TX_CP,
|
||||
PERF_STAT_EVSEL_ID__SMI_NUM,
|
||||
PERF_STAT_EVSEL_ID__APERF,
|
||||
PERF_STAT_EVSEL_ID__MAX,
|
||||
|
|
@ -92,9 +88,6 @@ enum stat_type {
|
|||
STAT_LL_CACHE,
|
||||
STAT_ITLB_CACHE,
|
||||
STAT_DTLB_CACHE,
|
||||
STAT_CYCLES_IN_TX,
|
||||
STAT_TRANSACTION,
|
||||
STAT_ELISION,
|
||||
STAT_SMI_NUM,
|
||||
STAT_APERF,
|
||||
STAT_MAX
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user