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

perf stat: Split print_cgroup() function

Likewise, split print_cgroup() for each output mode.
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-5-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent def99d60
......@@ -106,15 +106,32 @@ static void print_noise(struct perf_stat_config *config,
print_noise_pct(config, stddev_stats(&ps->res_stats), avg);
}
static void print_cgroup_std(struct perf_stat_config *config, const char *cgrp_name)
{
fprintf(config->output, " %s", cgrp_name);
}
static void print_cgroup_csv(struct perf_stat_config *config, const char *cgrp_name)
{
fprintf(config->output, "%s%s", config->csv_sep, cgrp_name);
}
static void print_cgroup_json(struct perf_stat_config *config, const char *cgrp_name)
{
fprintf(config->output, "\"cgroup\" : \"%s\", ", cgrp_name);
}
static void print_cgroup(struct perf_stat_config *config, struct evsel *evsel)
{
if (nr_cgroups) {
const char *cgrp_name = evsel->cgrp ? evsel->cgrp->name : "";
if (config->json_output)
fprintf(config->output, "\"cgroup\" : \"%s\", ", cgrp_name);
print_cgroup_json(config, cgrp_name);
if (config->csv_output)
print_cgroup_csv(config, cgrp_name);
else
fprintf(config->output, "%s%s", config->csv_sep, cgrp_name);
print_cgroup_std(config, cgrp_name);
}
}
......
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