summaryrefslogtreecommitdiffstats
path: root/tools/perf/util
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2023-02-19 01:28:44 -0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2023-02-19 08:10:25 -0300
commitcc26ffaa01f04cbe5c958df5532f3c23599e7a04 (patch)
treede38d7072850d18db6d5d22560b799dee236d25c /tools/perf/util
parent758bc8e626b76b53ac643dae4128d6f617e24467 (diff)
downloadlinux-stable-cc26ffaa01f04cbe5c958df5532f3c23599e7a04.tar.gz
linux-stable-cc26ffaa01f04cbe5c958df5532f3c23599e7a04.tar.bz2
linux-stable-cc26ffaa01f04cbe5c958df5532f3c23599e7a04.zip
perf stat: Hide runtime_stat
runtime_stat is only shared for the sake of tests that don't care about its value. Move the definition into stat-shadow.c and have the tests also use the global version. 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-48-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
-rw-r--r--tools/perf/util/stat-display.c5
-rw-r--r--tools/perf/util/stat-shadow.c165
-rw-r--r--tools/perf/util/stat.c2
-rw-r--r--tools/perf/util/stat.h17
4 files changed, 75 insertions, 114 deletions
diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index 1b5cb20efd23..6c065d0624c3 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -729,7 +729,7 @@ static void printout(struct perf_stat_config *config, struct outstate *os,
if (ok) {
perf_stat__print_shadow_stats(config, counter, uval, map_idx,
- &out, &config->metric_events, &rt_stat);
+ &out, &config->metric_events);
} else {
pm(config, os, /*color=*/NULL, /*format=*/NULL, /*unit=*/"", /*val=*/0);
}
@@ -1089,8 +1089,7 @@ static void print_metric_headers(struct perf_stat_config *config,
perf_stat__print_shadow_stats(config, counter, 0,
0,
&out,
- &config->metric_events,
- &rt_stat);
+ &config->metric_events);
}
if (!config->json_output)
diff --git a/tools/perf/util/stat-shadow.c b/tools/perf/util/stat-shadow.c
index fc948a7e83b7..f80be6abac90 100644
--- a/tools/perf/util/stat-shadow.c
+++ b/tools/perf/util/stat-shadow.c
@@ -25,10 +25,13 @@
* AGGR_THREAD: Not supported?
*/
-struct runtime_stat rt_stat;
struct stats walltime_nsecs_stats;
struct rusage_stats ru_stats;
+static struct runtime_stat {
+ struct rblist value_list;
+} rt_stat;
+
enum {
CTX_BIT_USER = 1 << 0,
CTX_BIT_KERNEL = 1 << 1,
@@ -125,7 +128,6 @@ static struct saved_value *saved_value_lookup(struct evsel *evsel,
bool create,
enum stat_type type,
int ctx,
- struct runtime_stat *st,
struct cgroup *cgrp)
{
struct rblist *rblist;
@@ -138,7 +140,7 @@ static struct saved_value *saved_value_lookup(struct evsel *evsel,
.cgrp = cgrp,
};
- rblist = &st->value_list;
+ rblist = &rt_stat.value_list;
/* don't use context info for clock events */
if (type == STAT_NSECS)
@@ -156,9 +158,9 @@ static struct saved_value *saved_value_lookup(struct evsel *evsel,
return NULL;
}
-void runtime_stat__init(struct runtime_stat *st)
+void perf_stat__init_shadow_stats(void)
{
- struct rblist *rblist = &st->value_list;
+ struct rblist *rblist = &rt_stat.value_list;
rblist__init(rblist);
rblist->node_cmp = saved_value_cmp;
@@ -166,16 +168,6 @@ void runtime_stat__init(struct runtime_stat *st)
rblist->node_delete = saved_value_delete;
}
-void runtime_stat__exit(struct runtime_stat *st)
-{
- rblist__exit(&st->value_list);
-}
-
-void perf_stat__init_shadow_stats(void)
-{
- runtime_stat__init(&rt_stat);
-}
-
static int evsel_context(struct evsel *evsel)
{
int ctx = 0;
@@ -194,12 +186,12 @@ static int evsel_context(struct evsel *evsel)
return ctx;
}
-static void reset_stat(struct runtime_stat *st)
+void perf_stat__reset_shadow_per_stat(void)
{
struct rblist *rblist;
struct rb_node *pos, *next;
- rblist = &st->value_list;
+ rblist = &rt_stat.value_list;
next = rb_first_cached(&rblist->entries);
while (next) {
pos = next;
@@ -212,28 +204,22 @@ static void reset_stat(struct runtime_stat *st)
void perf_stat__reset_shadow_stats(void)
{
- reset_stat(&rt_stat);
+ perf_stat__reset_shadow_per_stat();
memset(&walltime_nsecs_stats, 0, sizeof(walltime_nsecs_stats));
memset(&ru_stats, 0, sizeof(ru_stats));
}
-void perf_stat__reset_shadow_per_stat(struct runtime_stat *st)
-{
- reset_stat(st);
-}
-
struct runtime_stat_data {
int ctx;
struct cgroup *cgrp;
};
-static void update_runtime_stat(struct runtime_stat *st,
- enum stat_type type,
+static void update_runtime_stat(enum stat_type type,
int map_idx, u64 count,
struct runtime_stat_data *rsd)
{
struct saved_value *v = saved_value_lookup(NULL, map_idx, true, type,
- rsd->ctx, st, rsd->cgrp);
+ rsd->ctx, rsd->cgrp);
if (v)
update_stats(&v->stats, count);
@@ -245,7 +231,7 @@ static void update_runtime_stat(struct runtime_stat *st,
* instruction rates, etc:
*/
void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
- int map_idx, struct runtime_stat *st)
+ int map_idx)
{
u64 count_ns = count;
struct saved_value *v;
@@ -253,43 +239,42 @@ void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
.ctx = evsel_context(counter),
.cgrp = counter->cgrp,
};
-
count *= counter->scale;
if (evsel__is_clock(counter))
- update_runtime_stat(st, STAT_NSECS, map_idx, count_ns, &rsd);
+ update_runtime_stat(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);
+ update_runtime_stat(STAT_CYCLES, map_idx, count, &rsd);
else if (evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_FRONTEND))
- update_runtime_stat(st, STAT_STALLED_CYCLES_FRONT,
+ update_runtime_stat(STAT_STALLED_CYCLES_FRONT,
map_idx, count, &rsd);
else if (evsel__match(counter, HARDWARE, HW_STALLED_CYCLES_BACKEND))
- update_runtime_stat(st, STAT_STALLED_CYCLES_BACK,
+ update_runtime_stat(STAT_STALLED_CYCLES_BACK,
map_idx, count, &rsd);
else if (evsel__match(counter, HARDWARE, HW_BRANCH_INSTRUCTIONS))
- update_runtime_stat(st, STAT_BRANCHES, map_idx, count, &rsd);
+ update_runtime_stat(STAT_BRANCHES, map_idx, count, &rsd);
else if (evsel__match(counter, HARDWARE, HW_CACHE_REFERENCES))
- update_runtime_stat(st, STAT_CACHEREFS, map_idx, count, &rsd);
+ update_runtime_stat(STAT_CACHEREFS, map_idx, count, &rsd);
else if (evsel__match(counter, HW_CACHE, HW_CACHE_L1D))
- update_runtime_stat(st, STAT_L1_DCACHE, map_idx, count, &rsd);
+ update_runtime_stat(STAT_L1_DCACHE, map_idx, count, &rsd);
else if (evsel__match(counter, HW_CACHE, HW_CACHE_L1I))
- update_runtime_stat(st, STAT_L1_ICACHE, map_idx, count, &rsd);
+ update_runtime_stat(STAT_L1_ICACHE, map_idx, count, &rsd);
else if (evsel__match(counter, HW_CACHE, HW_CACHE_LL))
- update_runtime_stat(st, STAT_LL_CACHE, map_idx, count, &rsd);
+ update_runtime_stat(STAT_LL_CACHE, map_idx, count, &rsd);
else if (evsel__match(counter, HW_CACHE, HW_CACHE_DTLB))
- update_runtime_stat(st, STAT_DTLB_CACHE, map_idx, count, &rsd);
+ update_runtime_stat(STAT_DTLB_CACHE, map_idx, count, &rsd);
else if (evsel__match(counter, HW_CACHE, HW_CACHE_ITLB))
- update_runtime_stat(st, STAT_ITLB_CACHE, map_idx, count, &rsd);
+ update_runtime_stat(STAT_ITLB_CACHE, map_idx, count, &rsd);
if (counter->collect_stat) {
- v = saved_value_lookup(counter, map_idx, true, STAT_NONE, 0, st,
+ v = saved_value_lookup(counter, map_idx, true, STAT_NONE, 0,
rsd.cgrp);
update_stats(&v->stats, count);
if (counter->metric_leader)
v->metric_total += count;
} else if (counter->metric_leader && !counter->merged_stat) {
v = saved_value_lookup(counter->metric_leader,
- map_idx, true, STAT_NONE, 0, st, rsd.cgrp);
+ map_idx, true, STAT_NONE, 0, rsd.cgrp);
v->metric_total += count;
v->metric_other++;
}
@@ -322,26 +307,24 @@ static const char *get_ratio_color(enum grc_type type, double ratio)
return color;
}
-static double runtime_stat_avg(struct runtime_stat *st,
- enum stat_type type, int map_idx,
+static double runtime_stat_avg(enum stat_type type, int map_idx,
struct runtime_stat_data *rsd)
{
struct saved_value *v;
- v = saved_value_lookup(NULL, map_idx, false, type, rsd->ctx, st, rsd->cgrp);
+ v = saved_value_lookup(NULL, map_idx, false, type, rsd->ctx, rsd->cgrp);
if (!v)
return 0.0;
return avg_stats(&v->stats);
}
-static double runtime_stat_n(struct runtime_stat *st,
- enum stat_type type, int map_idx,
+static double runtime_stat_n(enum stat_type type, int map_idx,
struct runtime_stat_data *rsd)
{
struct saved_value *v;
- v = saved_value_lookup(NULL, map_idx, false, type, rsd->ctx, st, rsd->cgrp);
+ v = saved_value_lookup(NULL, map_idx, false, type, rsd->ctx, rsd->cgrp);
if (!v)
return 0.0;
@@ -351,13 +334,12 @@ static double runtime_stat_n(struct runtime_stat *st,
static void print_stalled_cycles_frontend(struct perf_stat_config *config,
int map_idx, double avg,
struct perf_stat_output_ctx *out,
- struct runtime_stat *st,
struct runtime_stat_data *rsd)
{
double total, ratio = 0.0;
const char *color;
- total = runtime_stat_avg(st, STAT_CYCLES, map_idx, rsd);
+ total = runtime_stat_avg(STAT_CYCLES, map_idx, rsd);
if (total)
ratio = avg / total * 100.0;
@@ -374,13 +356,12 @@ static void print_stalled_cycles_frontend(struct perf_stat_config *config,
static void print_stalled_cycles_backend(struct perf_stat_config *config,
int map_idx, double avg,
struct perf_stat_output_ctx *out,
- struct runtime_stat *st,
struct runtime_stat_data *rsd)
{
double total, ratio = 0.0;
const char *color;
- total = runtime_stat_avg(st, STAT_CYCLES, map_idx, rsd);
+ total = runtime_stat_avg(STAT_CYCLES, map_idx, rsd);
if (total)
ratio = avg / total * 100.0;
@@ -393,13 +374,12 @@ static void print_stalled_cycles_backend(struct perf_stat_config *config,
static void print_branch_misses(struct perf_stat_config *config,
int map_idx, double avg,
struct perf_stat_output_ctx *out,
- struct runtime_stat *st,
struct runtime_stat_data *rsd)
{
double total, ratio = 0.0;
const char *color;
- total = runtime_stat_avg(st, STAT_BRANCHES, map_idx, rsd);
+ total = runtime_stat_avg(STAT_BRANCHES, map_idx, rsd);
if (total)
ratio = avg / total * 100.0;
@@ -412,13 +392,12 @@ static void print_branch_misses(struct perf_stat_config *config,
static void print_l1_dcache_misses(struct perf_stat_config *config,
int map_idx, double avg,
struct perf_stat_output_ctx *out,
- struct runtime_stat *st,
struct runtime_stat_data *rsd)
{
double total, ratio = 0.0;
const char *color;
- total = runtime_stat_avg(st, STAT_L1_DCACHE, map_idx, rsd);
+ total = runtime_stat_avg(STAT_L1_DCACHE, map_idx, rsd);
if (total)
ratio = avg / total * 100.0;
@@ -431,13 +410,12 @@ static void print_l1_dcache_misses(struct perf_stat_config *config,
static void print_l1_icache_misses(struct perf_stat_config *config,
int map_idx, double avg,
struct perf_stat_output_ctx *out,
- struct runtime_stat *st,
struct runtime_stat_data *rsd)
{
double total, ratio = 0.0;
const char *color;
- total = runtime_stat_avg(st, STAT_L1_ICACHE, map_idx, rsd);
+ total = runtime_stat_avg(STAT_L1_ICACHE, map_idx, rsd);
if (total)
ratio = avg / total * 100.0;
@@ -449,13 +427,12 @@ static void print_l1_icache_misses(struct perf_stat_config *config,
static void print_dtlb_cache_misses(struct perf_stat_config *config,
int map_idx, double avg,
struct perf_stat_output_ctx *out,
- struct runtime_stat *st,
struct runtime_stat_data *rsd)
{
double total, ratio = 0.0;
const char *color;
- total = runtime_stat_avg(st, STAT_DTLB_CACHE, map_idx, rsd);
+ total = runtime_stat_avg(STAT_DTLB_CACHE, map_idx, rsd);
if (total)
ratio = avg / total * 100.0;
@@ -467,13 +444,12 @@ static void print_dtlb_cache_misses(struct perf_stat_config *config,
static void print_itlb_cache_misses(struct perf_stat_config *config,
int map_idx, double avg,
struct perf_stat_output_ctx *out,
- struct runtime_stat *st,
struct runtime_stat_data *rsd)
{
double total, ratio = 0.0;
const char *color;
- total = runtime_stat_avg(st, STAT_ITLB_CACHE, map_idx, rsd);
+ total = runtime_stat_avg(STAT_ITLB_CACHE, map_idx, rsd);
if (total)
ratio = avg / total * 100.0;
@@ -485,13 +461,12 @@ static void print_itlb_cache_misses(struct perf_stat_config *config,
static void print_ll_cache_misses(struct perf_stat_config *config,
int map_idx, double avg,
struct perf_stat_output_ctx *out,
- struct runtime_stat *st,
struct runtime_stat_data *rsd)
{
double total, ratio = 0.0;
const char *color;
- total = runtime_stat_avg(st, STAT_LL_CACHE, map_idx, rsd);
+ total = runtime_stat_avg(STAT_LL_CACHE, map_idx, rsd);
if (total)
ratio = avg / total * 100.0;
@@ -503,8 +478,7 @@ static void print_ll_cache_misses(struct perf_stat_config *config,
static int prepare_metric(struct evsel **metric_events,
struct metric_ref *metric_refs,
struct expr_parse_ctx *pctx,
- int map_idx,
- struct runtime_stat *st)
+ int map_idx)
{
double scale;
char *n;
@@ -543,7 +517,7 @@ static int prepare_metric(struct evsel **metric_events,
}
} else {
v = saved_value_lookup(metric_events[i], map_idx, false,
- STAT_NONE, 0, st,
+ STAT_NONE, 0,
metric_events[i]->cgrp);
if (!v)
break;
@@ -587,8 +561,7 @@ static void generic_metric(struct perf_stat_config *config,
const char *metric_unit,
int runtime,
int map_idx,
- struct perf_stat_output_ctx *out,
- struct runtime_stat *st)
+ struct perf_stat_output_ctx *out)
{
print_metric_t print_metric = out->print_metric;
struct expr_parse_ctx *pctx;
@@ -605,7 +578,7 @@ static void generic_metric(struct perf_stat_config *config,
pctx->sctx.user_requested_cpu_list = strdup(config->user_requested_cpu_list);
pctx->sctx.runtime = runtime;
pctx->sctx.system_wide = config->system_wide;
- i = prepare_metric(metric_events, metric_refs, pctx, map_idx, st);
+ i = prepare_metric(metric_events, metric_refs, pctx, map_idx);
if (i < 0) {
expr__ctx_free(pctx);
return;
@@ -657,7 +630,7 @@ static void generic_metric(struct perf_stat_config *config,
expr__ctx_free(pctx);
}
-double test_generic_metric(struct metric_expr *mexp, int map_idx, struct runtime_stat *st)
+double test_generic_metric(struct metric_expr *mexp, int map_idx)
{
struct expr_parse_ctx *pctx;
double ratio = 0.0;
@@ -666,7 +639,7 @@ double test_generic_metric(struct metric_expr *mexp, int map_idx, struct runtime
if (!pctx)
return NAN;
- if (prepare_metric(mexp->metric_events, mexp->metric_refs, pctx, map_idx, st) < 0)
+ if (prepare_metric(mexp->metric_events, mexp->metric_refs, pctx, map_idx) < 0)
goto out;
if (expr__parse(&ratio, pctx, mexp->metric_expr))
@@ -681,8 +654,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
struct evsel *evsel,
double avg, int map_idx,
struct perf_stat_output_ctx *out,
- struct rblist *metric_events,
- struct runtime_stat *st)
+ struct rblist *metric_events)
{
void *ctxp = out->ctx;
print_metric_t print_metric = out->print_metric;
@@ -697,7 +669,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
if (config->iostat_run) {
iostat_print_metric(config, evsel, out);
} else if (evsel__match(evsel, HARDWARE, HW_INSTRUCTIONS)) {
- total = runtime_stat_avg(st, STAT_CYCLES, map_idx, &rsd);
+ total = runtime_stat_avg(STAT_CYCLES, map_idx, &rsd);
if (total) {
ratio = avg / total;
@@ -707,10 +679,9 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
print_metric(config, ctxp, NULL, NULL, "insn per cycle", 0);
}
- total = runtime_stat_avg(st, STAT_STALLED_CYCLES_FRONT, map_idx, &rsd);
+ total = runtime_stat_avg(STAT_STALLED_CYCLES_FRONT, map_idx, &rsd);
- total = max(total, runtime_stat_avg(st,
- STAT_STALLED_CYCLES_BACK,
+ total = max(total, runtime_stat_avg(STAT_STALLED_CYCLES_BACK,
map_idx, &rsd));
if (total && avg) {
@@ -721,8 +692,8 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
ratio);
}
} else if (evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)) {
- if (runtime_stat_n(st, STAT_BRANCHES, map_idx, &rsd) != 0)
- print_branch_misses(config, map_idx, avg, out, st, &rsd);
+ if (runtime_stat_n(STAT_BRANCHES, map_idx, &rsd) != 0)
+ print_branch_misses(config, map_idx, avg, out, &rsd);
else
print_metric(config, ctxp, NULL, NULL, "of all branches", 0);
} else if (
@@ -731,8 +702,8 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
- if (runtime_stat_n(st, STAT_L1_DCACHE, map_idx, &rsd) != 0)
- print_l1_dcache_misses(config, map_idx, avg, out, st, &rsd);
+ if (runtime_stat_n(STAT_L1_DCACHE, map_idx, &rsd) != 0)
+ print_l1_dcache_misses(config, map_idx, avg, out, &rsd);
else
print_metric(config, ctxp, NULL, NULL, "of all L1-dcache accesses", 0);
} else if (
@@ -741,8 +712,8 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
- if (runtime_stat_n(st, STAT_L1_ICACHE, map_idx, &rsd) != 0)
- print_l1_icache_misses(config, map_idx, avg, out, st, &rsd);
+ if (runtime_stat_n(STAT_L1_ICACHE, map_idx, &rsd) != 0)
+ print_l1_icache_misses(config, map_idx, avg, out, &rsd);
else
print_metric(config, ctxp, NULL, NULL, "of all L1-icache accesses", 0);
} else if (
@@ -751,8 +722,8 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
- if (runtime_stat_n(st, STAT_DTLB_CACHE, map_idx, &rsd) != 0)
- print_dtlb_cache_misses(config, map_idx, avg, out, st, &rsd);
+ if (runtime_stat_n(STAT_DTLB_CACHE, map_idx, &rsd) != 0)
+ print_dtlb_cache_misses(config, map_idx, avg, out, &rsd);
else
print_metric(config, ctxp, NULL, NULL, "of all dTLB cache accesses", 0);
} else if (
@@ -761,8 +732,8 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
- if (runtime_stat_n(st, STAT_ITLB_CACHE, map_idx, &rsd) != 0)
- print_itlb_cache_misses(config, map_idx, avg, out, st, &rsd);
+ if (runtime_stat_n(STAT_ITLB_CACHE, map_idx, &rsd) != 0)
+ print_itlb_cache_misses(config, map_idx, avg, out, &rsd);
else
print_metric(config, ctxp, NULL, NULL, "of all iTLB cache accesses", 0);
} else if (
@@ -771,27 +742,27 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
((PERF_COUNT_HW_CACHE_OP_READ) << 8) |
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
- if (runtime_stat_n(st, STAT_LL_CACHE, map_idx, &rsd) != 0)
- print_ll_cache_misses(config, map_idx, avg, out, st, &rsd);
+ if (runtime_stat_n(STAT_LL_CACHE, map_idx, &rsd) != 0)
+ print_ll_cache_misses(config, map_idx, avg, out, &rsd);
else
print_metric(config, ctxp, NULL, NULL, "of all LL-cache accesses", 0);
} else if (evsel__match(evsel, HARDWARE, HW_CACHE_MISSES)) {
- total = runtime_stat_avg(st, STAT_CACHEREFS, map_idx, &rsd);
+ total = runtime_stat_avg(STAT_CACHEREFS, map_idx, &rsd);
if (total)
ratio = avg * 100 / total;
- if (runtime_stat_n(st, STAT_CACHEREFS, map_idx, &rsd) != 0)
+ if (runtime_stat_n(STAT_CACHEREFS, map_idx, &rsd) != 0)
print_metric(config, ctxp, NULL, "%8.3f %%",
"of all cache refs", ratio);
else
print_metric(config, ctxp, NULL, NULL, "of all cache refs", 0);
} else if (evsel__match(evsel, HARDWARE, HW_STALLED_CYCLES_FRONTEND)) {
- print_stalled_cycles_frontend(config, map_idx, avg, out, st, &rsd);
+ print_stalled_cycles_frontend(config, map_idx, avg, out, &rsd);
} else if (evsel__match(evsel, HARDWARE, HW_STALLED_CYCLES_BACKEND)) {
- print_stalled_cycles_backend(config, map_idx, avg, out, st, &rsd);
+ print_stalled_cycles_backend(config, map_idx, avg, out, &rsd);
} else if (evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)) {
- total = runtime_stat_avg(st, STAT_NSECS, map_idx, &rsd);
+ total = runtime_stat_avg(STAT_NSECS, map_idx, &rsd);
if (total) {
ratio = avg / total;
@@ -805,11 +776,11 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
avg / (ratio * evsel->scale));
else
print_metric(config, ctxp, NULL, NULL, "CPUs utilized", 0);
- } else if (runtime_stat_n(st, STAT_NSECS, map_idx, &rsd) != 0) {
+ } else if (runtime_stat_n(STAT_NSECS, map_idx, &rsd) != 0) {
char unit = ' ';
char unit_buf[10] = "/sec";
- total = runtime_stat_avg(st, STAT_NSECS, map_idx, &rsd);
+ total = runtime_stat_avg(STAT_NSECS, map_idx, &rsd);
if (total)
ratio = convert_unit_double(1000000000.0 * avg / total, &unit);
@@ -829,7 +800,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
generic_metric(config, mexp->metric_expr, mexp->metric_threshold,
mexp->metric_events, mexp->metric_refs, evsel->name,
mexp->metric_name, mexp->metric_unit, mexp->runtime,
- map_idx, out, st);
+ map_idx, out);
}
}
if (num == 0)
diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c
index 8d83d2f4a082..0d7538670d67 100644
--- a/tools/perf/util/stat.c
+++ b/tools/perf/util/stat.c
@@ -659,7 +659,7 @@ static void evsel__update_shadow_stats(struct evsel *evsel)
for (i = 0; i < ps->nr_aggr; i++) {
struct perf_counts_values *aggr_counts = &ps->aggr[i].counts;
- perf_stat__update_shadow_stats(evsel, aggr_counts->val, i, &rt_stat);
+ perf_stat__update_shadow_stats(evsel, aggr_counts->val, i);
}
}
diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h
index 215c0f5c4db7..09975e098bd0 100644
--- a/tools/perf/util/stat.h
+++ b/tools/perf/util/stat.h
@@ -55,10 +55,6 @@ enum aggr_mode {
AGGR_MAX
};
-struct runtime_stat {
- struct rblist value_list;
-};
-
struct rusage_stats {
struct stats ru_utime_usec_stat;
struct stats ru_stime_usec_stat;
@@ -153,7 +149,6 @@ static inline void update_rusage_stats(struct rusage_stats *ru_stats, struct rus
struct evsel;
struct evlist;
-extern struct runtime_stat rt_stat;
extern struct stats walltime_nsecs_stats;
extern struct rusage_stats ru_stats;
@@ -162,13 +157,10 @@ typedef void (*print_metric_t)(struct perf_stat_config *config,
const char *fmt, double val);
typedef void (*new_line_t)(struct perf_stat_config *config, void *ctx);
-void runtime_stat__init(struct runtime_stat *st);
-void runtime_stat__exit(struct runtime_stat *st);
void perf_stat__init_shadow_stats(void);
void perf_stat__reset_shadow_stats(void);
-void perf_stat__reset_shadow_per_stat(struct runtime_stat *st);
-void perf_stat__update_shadow_stats(struct evsel *counter, u64 count,
- int map_idx, struct runtime_stat *st);
+void perf_stat__reset_shadow_per_stat(void);
+void perf_stat__update_shadow_stats(struct evsel *counter, u64 count, int map_idx);
struct perf_stat_output_ctx {
void *ctx;
print_metric_t print_metric;
@@ -180,8 +172,7 @@ void perf_stat__print_shadow_stats(struct perf_stat_config *config,
struct evsel *evsel,
double avg, int map_idx,
struct perf_stat_output_ctx *out,
- struct rblist *metric_events,
- struct runtime_stat *st);
+ struct rblist *metric_events);
int evlist__alloc_stats(struct perf_stat_config *config,
struct evlist *evlist, bool alloc_raw);
@@ -220,5 +211,5 @@ void evlist__print_counters(struct evlist *evlist, struct perf_stat_config *conf
struct target *_target, struct timespec *ts, int argc, const char **argv);
struct metric_expr;
-double test_generic_metric(struct metric_expr *mexp, int map_idx, struct runtime_stat *st);
+double test_generic_metric(struct metric_expr *mexp, int map_idx);
#endif