lkml.org 
[lkml]   [2022]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH linux-next] perf stat: use sysfs streq() instead of strncmp()
From: Xu Panda <xu.panda@zte.com.cn>

Replace the open-code with sysfs_streq().

Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
---
tools/perf/util/stat-display.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
index f5501760ff2e..1fd9f7e9d2a1 100644
--- a/tools/perf/util/stat-display.c
+++ b/tools/perf/util/stat-display.c
@@ -463,7 +463,7 @@ static bool valid_only_metric(const char *unit)
static const char *fixunit(char *buf, struct evsel *evsel,
const char *unit)
{
- if (!strncmp(unit, "of all", 6)) {
+ if (sysfs_streq(unit, "of all")) {
snprintf(buf, 1024, "%s %s", evsel__name(evsel),
unit);
return buf;
@@ -767,8 +767,7 @@ static void uniquify_event_name(struct evsel *counter)
int ret = 0;

if (counter->uniquified_name || counter->use_config_name ||
- !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
- strlen(counter->pmu_name)))
+ !counter->pmu_name || sysfs_streq(counter->name, counter->pmu_name))
return;

config = strchr(counter->name, '/');
--
2.15.2
\
 
 \ /
  Last update: 2022-11-22 13:12    [W:0.032 / U:0.664 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site