Commit def99d60 authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo

perf stat: Split print_noise_pct() function

Likewise, split print_noise_pct() for each output mode.  Although it's
a tiny function, more logic will be added soon so it'd be better split
it and treat it in the same way.
Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: James Clark <james.clark@arm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com>
Link: https://lore.kernel.org/r/20221114230227.1255976-4-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 31bf6aea
......@@ -62,17 +62,36 @@ static void print_running(struct perf_stat_config *config,
print_running_std(config, run, ena);
}
static void print_noise_pct_std(struct perf_stat_config *config,
double pct)
{
if (pct)
fprintf(config->output, " ( +-%6.2f%% )", pct);
}
static void print_noise_pct_csv(struct perf_stat_config *config,
double pct)
{
fprintf(config->output, "%s%.2f%%", config->csv_sep, pct);
}
static void print_noise_pct_json(struct perf_stat_config *config,
double pct)
{
fprintf(config->output, "\"variance\" : %.2f, ", pct);
}
static void print_noise_pct(struct perf_stat_config *config,
double total, double avg)
{
double pct = rel_stddev_stats(total, avg);
if (config->json_output)
fprintf(config->output, "\"variance\" : %.2f, ", pct);
print_noise_pct_json(config, pct);
else if (config->csv_output)
fprintf(config->output, "%s%.2f%%", config->csv_sep, pct);
else if (pct)
fprintf(config->output, " ( +-%6.2f%% )", pct);
print_noise_pct_csv(config, pct);
else
print_noise_pct_std(config, pct);
}
static void print_noise(struct perf_stat_config *config,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment