perf stat: Pass a 'struct perf_stat_config' argument to global print functions
Add 'struct perf_stat_config' argument to the global print functions, so that these functions can be used out of the 'perf stat' command code. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: David Ahern <dsahern@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20180830063252.23729-20-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
f3ca50e61f
commit
6ca9a082b1
@@ -410,7 +410,8 @@ static double runtime_stat_n(struct runtime_stat *st,
|
||||
return v->stats.n;
|
||||
}
|
||||
|
||||
static void print_stalled_cycles_frontend(int cpu,
|
||||
static void print_stalled_cycles_frontend(struct perf_stat_config *config,
|
||||
int cpu,
|
||||
struct perf_evsel *evsel, double avg,
|
||||
struct perf_stat_output_ctx *out,
|
||||
struct runtime_stat *st)
|
||||
@@ -427,13 +428,14 @@ static void print_stalled_cycles_frontend(int cpu,
|
||||
color = get_ratio_color(GRC_STALLED_CYCLES_FE, ratio);
|
||||
|
||||
if (ratio)
|
||||
out->print_metric(out->ctx, color, "%7.2f%%", "frontend cycles idle",
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "frontend cycles idle",
|
||||
ratio);
|
||||
else
|
||||
out->print_metric(out->ctx, NULL, NULL, "frontend cycles idle", 0);
|
||||
out->print_metric(config, out->ctx, NULL, NULL, "frontend cycles idle", 0);
|
||||
}
|
||||
|
||||
static void print_stalled_cycles_backend(int cpu,
|
||||
static void print_stalled_cycles_backend(struct perf_stat_config *config,
|
||||
int cpu,
|
||||
struct perf_evsel *evsel, double avg,
|
||||
struct perf_stat_output_ctx *out,
|
||||
struct runtime_stat *st)
|
||||
@@ -449,10 +451,11 @@ static void print_stalled_cycles_backend(int cpu,
|
||||
|
||||
color = get_ratio_color(GRC_STALLED_CYCLES_BE, ratio);
|
||||
|
||||
out->print_metric(out->ctx, color, "%7.2f%%", "backend cycles idle", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "backend cycles idle", ratio);
|
||||
}
|
||||
|
||||
static void print_branch_misses(int cpu,
|
||||
static void print_branch_misses(struct perf_stat_config *config,
|
||||
int cpu,
|
||||
struct perf_evsel *evsel,
|
||||
double avg,
|
||||
struct perf_stat_output_ctx *out,
|
||||
@@ -469,10 +472,11 @@ static void print_branch_misses(int cpu,
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
|
||||
out->print_metric(out->ctx, color, "%7.2f%%", "of all branches", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all branches", ratio);
|
||||
}
|
||||
|
||||
static void print_l1_dcache_misses(int cpu,
|
||||
static void print_l1_dcache_misses(struct perf_stat_config *config,
|
||||
int cpu,
|
||||
struct perf_evsel *evsel,
|
||||
double avg,
|
||||
struct perf_stat_output_ctx *out,
|
||||
@@ -490,10 +494,11 @@ static void print_l1_dcache_misses(int cpu,
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
|
||||
out->print_metric(out->ctx, color, "%7.2f%%", "of all L1-dcache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-dcache hits", ratio);
|
||||
}
|
||||
|
||||
static void print_l1_icache_misses(int cpu,
|
||||
static void print_l1_icache_misses(struct perf_stat_config *config,
|
||||
int cpu,
|
||||
struct perf_evsel *evsel,
|
||||
double avg,
|
||||
struct perf_stat_output_ctx *out,
|
||||
@@ -510,10 +515,11 @@ static void print_l1_icache_misses(int cpu,
|
||||
ratio = avg / total * 100.0;
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
out->print_metric(out->ctx, color, "%7.2f%%", "of all L1-icache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all L1-icache hits", ratio);
|
||||
}
|
||||
|
||||
static void print_dtlb_cache_misses(int cpu,
|
||||
static void print_dtlb_cache_misses(struct perf_stat_config *config,
|
||||
int cpu,
|
||||
struct perf_evsel *evsel,
|
||||
double avg,
|
||||
struct perf_stat_output_ctx *out,
|
||||
@@ -529,10 +535,11 @@ static void print_dtlb_cache_misses(int cpu,
|
||||
ratio = avg / total * 100.0;
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
out->print_metric(out->ctx, color, "%7.2f%%", "of all dTLB cache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all dTLB cache hits", ratio);
|
||||
}
|
||||
|
||||
static void print_itlb_cache_misses(int cpu,
|
||||
static void print_itlb_cache_misses(struct perf_stat_config *config,
|
||||
int cpu,
|
||||
struct perf_evsel *evsel,
|
||||
double avg,
|
||||
struct perf_stat_output_ctx *out,
|
||||
@@ -548,10 +555,11 @@ static void print_itlb_cache_misses(int cpu,
|
||||
ratio = avg / total * 100.0;
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
out->print_metric(out->ctx, color, "%7.2f%%", "of all iTLB cache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all iTLB cache hits", ratio);
|
||||
}
|
||||
|
||||
static void print_ll_cache_misses(int cpu,
|
||||
static void print_ll_cache_misses(struct perf_stat_config *config,
|
||||
int cpu,
|
||||
struct perf_evsel *evsel,
|
||||
double avg,
|
||||
struct perf_stat_output_ctx *out,
|
||||
@@ -567,7 +575,7 @@ static void print_ll_cache_misses(int cpu,
|
||||
ratio = avg / total * 100.0;
|
||||
|
||||
color = get_ratio_color(GRC_CACHE_MISSES, ratio);
|
||||
out->print_metric(out->ctx, color, "%7.2f%%", "of all LL-cache hits", ratio);
|
||||
out->print_metric(config, out->ctx, color, "%7.2f%%", "of all LL-cache hits", ratio);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -674,7 +682,8 @@ static double td_be_bound(int ctx, int cpu, struct runtime_stat *st)
|
||||
return sanitize_val(1.0 - sum);
|
||||
}
|
||||
|
||||
static void print_smi_cost(int cpu, struct perf_evsel *evsel,
|
||||
static void print_smi_cost(struct perf_stat_config *config,
|
||||
int cpu, struct perf_evsel *evsel,
|
||||
struct perf_stat_output_ctx *out,
|
||||
struct runtime_stat *st)
|
||||
{
|
||||
@@ -694,11 +703,12 @@ static void print_smi_cost(int cpu, struct perf_evsel *evsel,
|
||||
|
||||
if (cost > 10)
|
||||
color = PERF_COLOR_RED;
|
||||
out->print_metric(out->ctx, color, "%8.1f%%", "SMI cycles%", cost);
|
||||
out->print_metric(out->ctx, NULL, "%4.0f", "SMI#", smi_num);
|
||||
out->print_metric(config, out->ctx, color, "%8.1f%%", "SMI cycles%", cost);
|
||||
out->print_metric(config, out->ctx, NULL, "%4.0f", "SMI#", smi_num);
|
||||
}
|
||||
|
||||
static void generic_metric(const char *metric_expr,
|
||||
static void generic_metric(struct perf_stat_config *config,
|
||||
const char *metric_expr,
|
||||
struct perf_evsel **metric_events,
|
||||
char *name,
|
||||
const char *metric_name,
|
||||
@@ -737,20 +747,21 @@ static void generic_metric(const char *metric_expr,
|
||||
const char *p = metric_expr;
|
||||
|
||||
if (expr__parse(&ratio, &pctx, &p) == 0)
|
||||
print_metric(ctxp, NULL, "%8.1f",
|
||||
print_metric(config, ctxp, NULL, "%8.1f",
|
||||
metric_name ?
|
||||
metric_name :
|
||||
out->force_header ? name : "",
|
||||
ratio);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL,
|
||||
print_metric(config, ctxp, NULL, NULL,
|
||||
out->force_header ?
|
||||
(metric_name ? metric_name : name) : "", 0);
|
||||
} else
|
||||
print_metric(ctxp, NULL, NULL, "", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "", 0);
|
||||
}
|
||||
|
||||
void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
void perf_stat__print_shadow_stats(struct perf_stat_config *config,
|
||||
struct perf_evsel *evsel,
|
||||
double avg, int cpu,
|
||||
struct perf_stat_output_ctx *out,
|
||||
struct rblist *metric_events,
|
||||
@@ -769,10 +780,10 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
|
||||
if (total) {
|
||||
ratio = avg / total;
|
||||
print_metric(ctxp, NULL, "%7.2f ",
|
||||
print_metric(config, ctxp, NULL, "%7.2f ",
|
||||
"insn per cycle", ratio);
|
||||
} else {
|
||||
print_metric(ctxp, NULL, NULL, "insn per cycle", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "insn per cycle", 0);
|
||||
}
|
||||
|
||||
total = runtime_stat_avg(st, STAT_STALLED_CYCLES_FRONT,
|
||||
@@ -783,20 +794,20 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
ctx, cpu));
|
||||
|
||||
if (total && avg) {
|
||||
out->new_line(ctxp);
|
||||
out->new_line(config, ctxp);
|
||||
ratio = total / avg;
|
||||
print_metric(ctxp, NULL, "%7.2f ",
|
||||
print_metric(config, ctxp, NULL, "%7.2f ",
|
||||
"stalled cycles per insn",
|
||||
ratio);
|
||||
} else if (have_frontend_stalled) {
|
||||
print_metric(ctxp, NULL, NULL,
|
||||
print_metric(config, ctxp, NULL, NULL,
|
||||
"stalled cycles per insn", 0);
|
||||
}
|
||||
} else if (perf_evsel__match(evsel, HARDWARE, HW_BRANCH_MISSES)) {
|
||||
if (runtime_stat_n(st, STAT_BRANCHES, ctx, cpu) != 0)
|
||||
print_branch_misses(cpu, evsel, avg, out, st);
|
||||
print_branch_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "of all branches", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all branches", 0);
|
||||
} else if (
|
||||
evsel->attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->attr.config == ( PERF_COUNT_HW_CACHE_L1D |
|
||||
@@ -804,9 +815,9 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
|
||||
|
||||
if (runtime_stat_n(st, STAT_L1_DCACHE, ctx, cpu) != 0)
|
||||
print_l1_dcache_misses(cpu, evsel, avg, out, st);
|
||||
print_l1_dcache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "of all L1-dcache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all L1-dcache hits", 0);
|
||||
} else if (
|
||||
evsel->attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->attr.config == ( PERF_COUNT_HW_CACHE_L1I |
|
||||
@@ -814,9 +825,9 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
|
||||
|
||||
if (runtime_stat_n(st, STAT_L1_ICACHE, ctx, cpu) != 0)
|
||||
print_l1_icache_misses(cpu, evsel, avg, out, st);
|
||||
print_l1_icache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "of all L1-icache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all L1-icache hits", 0);
|
||||
} else if (
|
||||
evsel->attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->attr.config == ( PERF_COUNT_HW_CACHE_DTLB |
|
||||
@@ -824,9 +835,9 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
|
||||
|
||||
if (runtime_stat_n(st, STAT_DTLB_CACHE, ctx, cpu) != 0)
|
||||
print_dtlb_cache_misses(cpu, evsel, avg, out, st);
|
||||
print_dtlb_cache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "of all dTLB cache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all dTLB cache hits", 0);
|
||||
} else if (
|
||||
evsel->attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->attr.config == ( PERF_COUNT_HW_CACHE_ITLB |
|
||||
@@ -834,9 +845,9 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
|
||||
|
||||
if (runtime_stat_n(st, STAT_ITLB_CACHE, ctx, cpu) != 0)
|
||||
print_itlb_cache_misses(cpu, evsel, avg, out, st);
|
||||
print_itlb_cache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "of all iTLB cache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all iTLB cache hits", 0);
|
||||
} else if (
|
||||
evsel->attr.type == PERF_TYPE_HW_CACHE &&
|
||||
evsel->attr.config == ( PERF_COUNT_HW_CACHE_LL |
|
||||
@@ -844,9 +855,9 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
((PERF_COUNT_HW_CACHE_RESULT_MISS) << 16))) {
|
||||
|
||||
if (runtime_stat_n(st, STAT_LL_CACHE, ctx, cpu) != 0)
|
||||
print_ll_cache_misses(cpu, evsel, avg, out, st);
|
||||
print_ll_cache_misses(config, cpu, evsel, avg, out, st);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "of all LL-cache hits", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all LL-cache hits", 0);
|
||||
} else if (perf_evsel__match(evsel, HARDWARE, HW_CACHE_MISSES)) {
|
||||
total = runtime_stat_avg(st, STAT_CACHEREFS, ctx, cpu);
|
||||
|
||||
@@ -854,32 +865,32 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
ratio = avg * 100 / total;
|
||||
|
||||
if (runtime_stat_n(st, STAT_CACHEREFS, ctx, cpu) != 0)
|
||||
print_metric(ctxp, NULL, "%8.3f %%",
|
||||
print_metric(config, ctxp, NULL, "%8.3f %%",
|
||||
"of all cache refs", ratio);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "of all cache refs", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "of all cache refs", 0);
|
||||
} else if (perf_evsel__match(evsel, HARDWARE, HW_STALLED_CYCLES_FRONTEND)) {
|
||||
print_stalled_cycles_frontend(cpu, evsel, avg, out, st);
|
||||
print_stalled_cycles_frontend(config, cpu, evsel, avg, out, st);
|
||||
} else if (perf_evsel__match(evsel, HARDWARE, HW_STALLED_CYCLES_BACKEND)) {
|
||||
print_stalled_cycles_backend(cpu, evsel, avg, out, st);
|
||||
print_stalled_cycles_backend(config, cpu, evsel, avg, out, st);
|
||||
} else if (perf_evsel__match(evsel, HARDWARE, HW_CPU_CYCLES)) {
|
||||
total = runtime_stat_avg(st, STAT_NSECS, 0, cpu);
|
||||
|
||||
if (total) {
|
||||
ratio = avg / total;
|
||||
print_metric(ctxp, NULL, "%8.3f", "GHz", ratio);
|
||||
print_metric(config, ctxp, NULL, "%8.3f", "GHz", ratio);
|
||||
} else {
|
||||
print_metric(ctxp, NULL, NULL, "Ghz", 0);
|
||||
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, ctx, cpu);
|
||||
|
||||
if (total)
|
||||
print_metric(ctxp, NULL,
|
||||
print_metric(config, ctxp, NULL,
|
||||
"%7.2f%%", "transactional cycles",
|
||||
100.0 * (avg / total));
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "transactional cycles",
|
||||
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, ctx, cpu);
|
||||
@@ -888,10 +899,10 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
if (total2 < avg)
|
||||
total2 = avg;
|
||||
if (total)
|
||||
print_metric(ctxp, NULL, "%7.2f%%", "aborted cycles",
|
||||
print_metric(config, ctxp, NULL, "%7.2f%%", "aborted cycles",
|
||||
100.0 * ((total2-avg) / total));
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "aborted cycles", 0);
|
||||
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,
|
||||
ctx, cpu);
|
||||
@@ -900,10 +911,10 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
ratio = total / avg;
|
||||
|
||||
if (runtime_stat_n(st, STAT_CYCLES_IN_TX, ctx, cpu) != 0)
|
||||
print_metric(ctxp, NULL, "%8.0f",
|
||||
print_metric(config, ctxp, NULL, "%8.0f",
|
||||
"cycles / transaction", ratio);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "cycles / transaction",
|
||||
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,
|
||||
@@ -912,33 +923,33 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
if (avg)
|
||||
ratio = total / avg;
|
||||
|
||||
print_metric(ctxp, NULL, "%8.0f", "cycles / elision", ratio);
|
||||
print_metric(config, ctxp, NULL, "%8.0f", "cycles / elision", ratio);
|
||||
} else if (perf_evsel__is_clock(evsel)) {
|
||||
if ((ratio = avg_stats(&walltime_nsecs_stats)) != 0)
|
||||
print_metric(ctxp, NULL, "%8.3f", "CPUs utilized",
|
||||
print_metric(config, ctxp, NULL, "%8.3f", "CPUs utilized",
|
||||
avg / (ratio * evsel->scale));
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, "CPUs utilized", 0);
|
||||
print_metric(config, ctxp, NULL, NULL, "CPUs utilized", 0);
|
||||
} else if (perf_stat_evsel__is(evsel, TOPDOWN_FETCH_BUBBLES)) {
|
||||
double fe_bound = td_fe_bound(ctx, cpu, st);
|
||||
|
||||
if (fe_bound > 0.2)
|
||||
color = PERF_COLOR_RED;
|
||||
print_metric(ctxp, color, "%8.1f%%", "frontend bound",
|
||||
print_metric(config, ctxp, color, "%8.1f%%", "frontend bound",
|
||||
fe_bound * 100.);
|
||||
} else if (perf_stat_evsel__is(evsel, TOPDOWN_SLOTS_RETIRED)) {
|
||||
double retiring = td_retiring(ctx, cpu, st);
|
||||
|
||||
if (retiring > 0.7)
|
||||
color = PERF_COLOR_GREEN;
|
||||
print_metric(ctxp, color, "%8.1f%%", "retiring",
|
||||
print_metric(config, ctxp, color, "%8.1f%%", "retiring",
|
||||
retiring * 100.);
|
||||
} else if (perf_stat_evsel__is(evsel, TOPDOWN_RECOVERY_BUBBLES)) {
|
||||
double bad_spec = td_bad_spec(ctx, cpu, st);
|
||||
|
||||
if (bad_spec > 0.1)
|
||||
color = PERF_COLOR_RED;
|
||||
print_metric(ctxp, color, "%8.1f%%", "bad speculation",
|
||||
print_metric(config, ctxp, color, "%8.1f%%", "bad speculation",
|
||||
bad_spec * 100.);
|
||||
} else if (perf_stat_evsel__is(evsel, TOPDOWN_SLOTS_ISSUED)) {
|
||||
double be_bound = td_be_bound(ctx, cpu, st);
|
||||
@@ -955,12 +966,12 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
if (be_bound > 0.2)
|
||||
color = PERF_COLOR_RED;
|
||||
if (td_total_slots(ctx, cpu, st) > 0)
|
||||
print_metric(ctxp, color, "%8.1f%%", name,
|
||||
print_metric(config, ctxp, color, "%8.1f%%", name,
|
||||
be_bound * 100.);
|
||||
else
|
||||
print_metric(ctxp, NULL, NULL, name, 0);
|
||||
print_metric(config, ctxp, NULL, NULL, name, 0);
|
||||
} else if (evsel->metric_expr) {
|
||||
generic_metric(evsel->metric_expr, evsel->metric_events, evsel->name,
|
||||
generic_metric(config, evsel->metric_expr, evsel->metric_events, evsel->name,
|
||||
evsel->metric_name, avg, cpu, out, st);
|
||||
} else if (runtime_stat_n(st, STAT_NSECS, 0, cpu) != 0) {
|
||||
char unit = 'M';
|
||||
@@ -975,9 +986,9 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
unit = 'K';
|
||||
}
|
||||
snprintf(unit_buf, sizeof(unit_buf), "%c/sec", unit);
|
||||
print_metric(ctxp, NULL, "%8.3f", unit_buf, ratio);
|
||||
print_metric(config, ctxp, NULL, "%8.3f", unit_buf, ratio);
|
||||
} else if (perf_stat_evsel__is(evsel, SMI_NUM)) {
|
||||
print_smi_cost(cpu, evsel, out, st);
|
||||
print_smi_cost(config, cpu, evsel, out, st);
|
||||
} else {
|
||||
num = 0;
|
||||
}
|
||||
@@ -987,12 +998,12 @@ void perf_stat__print_shadow_stats(struct perf_evsel *evsel,
|
||||
|
||||
list_for_each_entry (mexp, &me->head, nd) {
|
||||
if (num++ > 0)
|
||||
out->new_line(ctxp);
|
||||
generic_metric(mexp->metric_expr, mexp->metric_events,
|
||||
out->new_line(config, ctxp);
|
||||
generic_metric(config, mexp->metric_expr, mexp->metric_events,
|
||||
evsel->name, mexp->metric_name,
|
||||
avg, cpu, out, st);
|
||||
}
|
||||
}
|
||||
if (num == 0)
|
||||
print_metric(ctxp, NULL, NULL, NULL, 0);
|
||||
print_metric(config, ctxp, NULL, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user