perf stat: Split print_cgroup() function
Likewise, split print_cgroup() for each output mode. Signed-off-by: Namhyung 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.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
def99d60df
commit
41cb875242
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue