aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRavi Bangoria <[email protected]>2022-06-04 10:15:14 +0530
committerArnaldo Carvalho de Melo <[email protected]>2022-06-24 13:18:55 -0300
commit2a12bef413bb278db202ecb6adbd9c18dec4b260 (patch)
treea981dfd358b3e2f5a02b7e3bf9303fbc5fe49fe2
parent3339ec44be7f9963c82d5d21e163f16f96e5ca58 (diff)
perf header: Pass "cpu" pmu name while printing caps
Avoid unnecessary conditional code to check if pmu name is NULL or not by passing "cpu" pmu name to the printing function. Reviewed-by: Kan Liang <[email protected]> Signed-off-by: Ravi Bangoria <[email protected]> Acked-by: Namhyung Kim <[email protected]> Cc: Ananth Narayan <[email protected]> Cc: Andi Kleen <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: James Clark <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Kim Phillips <[email protected]> Cc: Leo Yan <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Robert Richter <[email protected]> Cc: Sandipan Das <[email protected]> Cc: Santosh Shukla <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
-rw-r--r--tools/perf/util/header.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index de5b7a023e9e..8c0b85e3851c 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2058,17 +2058,11 @@ static void print_per_cpu_pmu_caps(FILE *fp, int nr_caps, char *cpu_pmu_caps,
char *str, buf[128];
if (!nr_caps) {
- if (!pmu_name)
- fprintf(fp, "# cpu pmu capabilities: not available\n");
- else
- fprintf(fp, "# %s pmu capabilities: not available\n", pmu_name);
+ fprintf(fp, "# %s pmu capabilities: not available\n", pmu_name);
return;
}
- if (!pmu_name)
- scnprintf(buf, sizeof(buf), "# cpu pmu capabilities: ");
- else
- scnprintf(buf, sizeof(buf), "# %s pmu capabilities: ", pmu_name);
+ scnprintf(buf, sizeof(buf), "# %s pmu capabilities: ", pmu_name);
delimiter = buf;
@@ -2085,7 +2079,7 @@ static void print_per_cpu_pmu_caps(FILE *fp, int nr_caps, char *cpu_pmu_caps,
static void print_cpu_pmu_caps(struct feat_fd *ff, FILE *fp)
{
print_per_cpu_pmu_caps(fp, ff->ph->env.nr_cpu_pmu_caps,
- ff->ph->env.cpu_pmu_caps, NULL);
+ ff->ph->env.cpu_pmu_caps, (char *)"cpu");
}
static void print_hybrid_cpu_pmu_caps(struct feat_fd *ff, FILE *fp)