diff options
author | Yanteng Si <siyanteng@loongson.cn> | 2023-08-25 14:28:02 +0300 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2023-08-29 20:13:48 +0300 |
commit | c56f286f24c4b56d9ae81fa381c02af56ab9bfb2 (patch) | |
tree | 2bb6a7bfacbd9f3499afc1b0cc52d8ee2d575b91 /tools/perf/util/svghelper.c | |
parent | 0f2418fddb6dddd5f6f9fc4e2375bdaa0d7e0174 (diff) | |
download | linux-c56f286f24c4b56d9ae81fa381c02af56ab9bfb2.tar.xz |
perf tools: Allow to use cpuinfo on LoongArch
Define these macros so that the CPU name can be displayed when running
'perf report' and 'perf timechart'.
Committer notes:
No need to have:
if (strcasestr(buf, "Model Name")) {
strlcpy(cpu_m, &buf[13], 255);
break;
} else if (strcasestr(buf, "model name")) {
strlcpy(cpu_m, &buf[13], 255);
break;
}
As the point of strcasestr() is to be case insensitive to both the
haystack and the needle, so simplify the above to just:
if (strcasestr(buf, "model name")) {
strlcpy(cpu_m, &buf[13], 255);
break;
}
Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: loongarch@lists.linux.dev
Cc: loongson-kernel@lists.loongnix.cn
Link: https://lore.kernel.org/r/db968a186a10e4629fe10c26a1210f7126ad41ec.1692962043.git.siyanteng@loongson.cn
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/svghelper.c')
-rw-r--r-- | tools/perf/util/svghelper.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index 5c62d3118c41..0e4dc31c6c9c 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c @@ -331,7 +331,7 @@ static char *cpu_model(void) file = fopen("/proc/cpuinfo", "r"); if (file) { while (fgets(buf, 255, file)) { - if (strstr(buf, "model name")) { + if (strcasestr(buf, "model name")) { strlcpy(cpu_m, &buf[13], 255); break; } |