Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6269078rwb; Tue, 22 Nov 2022 10:56:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Ydc1uZ3X2P3GGFZGmr3KWeDxOZnjOX+HU5L2qciz6iZsN5/UzAvOA98dp5dWy1VJnch+v X-Received: by 2002:a17:90a:7e87:b0:212:f810:a846 with SMTP id j7-20020a17090a7e8700b00212f810a846mr33934672pjl.71.1669143417320; Tue, 22 Nov 2022 10:56:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669143417; cv=none; d=google.com; s=arc-20160816; b=hjVT6GBPovbqm8n1QlaIo7suMMLjFBipDGk/5BBvjom+bWrDJFJ3L216mQvK19w+XK /oil69PNmUphFr+8mhudv9HFJH53So8JtQrr/BWVrHm96WRYiucwYvnhgxF0emswOUao oDZ62R8npIP6tTZLCYEGMePLK4Sn07qCfzPVdAsh2kskbz11s2sXvOyu8t3T1thU8Lpq 1AotmirTlF9IS+9TweTprb6PWV2gTaVAOv6/+uvPa6/vpSImC8FXerCYeAVPKWLuG8hi UNdSEuP3YvRvkuA8zGOJxTZ8Pzq4tYdXm9H2CiDMheY6guMLmARhfAyV01F0dopV+Afi GI6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=DLf/Jej73pbXy0+YMDLop67VGOTWqbO44Re8jeCONjk=; b=rpfrtovc/QLUHc0FEuSYlz3oG2PgYuLs24K4rpz6CpwDB7+lBOkcUIPX4EHH6B4O5i zVCeZjIyZoAdVLxbwqkTCMLmZeu69A4/vrEKykLNQ1a5zAzwdXARZo4JIazKb23qNi8M FeCU+4h59YFxcUxhqEKs4nJSh61muUVp9Kc3d9/jFEASwT9vpbgN1ONLk6ApPpSU+oIW xZwZXuMBb2RW41mxehALm+sj6uEM+ynDTZ65l292ujXHtRrSLwMaQhlUwVFq0nNlpbhq Ujh7Fl6Qd8RAbC0g46wAV0haWH+QMAnCPd0m7KquOHQc0cOx4836ZaXU2+0jJEKi4uly u/8A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id na18-20020a17090b4c1200b00218641b1acdsi18189907pjb.68.2022.11.22.10.56.45; Tue, 22 Nov 2022 10:56:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234505AbiKVSbb (ORCPT + 91 others); Tue, 22 Nov 2022 13:31:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234012AbiKVSb3 (ORCPT ); Tue, 22 Nov 2022 13:31:29 -0500 Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EFC87FF21; Tue, 22 Nov 2022 10:31:28 -0800 (PST) Received: by mail-io1-f41.google.com with SMTP id 11so11619722iou.0; Tue, 22 Nov 2022 10:31:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DLf/Jej73pbXy0+YMDLop67VGOTWqbO44Re8jeCONjk=; b=zuCe34C2RvNH2OUEiLG/pILURn+tdDierOy1QXd1VgEgOaaKbTrT1CaLLMTggVU+ee EQNa4dwbwHCSEzJu0Yqx3pWlnNn3rbFxhTUKbhsQd5Xcblq1qmwabG1RSglKE2YgR07A NasfhurL9uhqZ5y2BRQLS2HTsddQifOG9OikPSxGDN0ZvxxkMJC3MIvkYy4l0BlNg+ZE r1Z1wboeSlniY4y45ZEdZ0WDffpXnbGh08de5QlN7QHVU7F1lyuoBwJ080df3mshlcpw xfr55CtikvMH9g2skAxkSU4wBEUDehBJOvoG5swMR9ByWp7nMcutdCyXyqSK9o2yOw2S P59w== X-Gm-Message-State: ANoB5pmiqVnEaanL/uqErazfSqjZAJmLojpkY1kijD2Dv8pDoWirVNw3 laZPYocpmhgZqda4yFVRyEhH6dlCMYGef1D4tf0= X-Received: by 2002:a5d:97c9:0:b0:6a2:e3df:a40e with SMTP id k9-20020a5d97c9000000b006a2e3dfa40emr11439527ios.113.1669141887813; Tue, 22 Nov 2022 10:31:27 -0800 (PST) MIME-Version: 1.0 References: <202211222011006572179@zte.com.cn> In-Reply-To: <202211222011006572179@zte.com.cn> From: Namhyung Kim Date: Tue, 22 Nov 2022 10:31:16 -0800 Message-ID: Subject: Re: [PATCH linux-next] perf stat: use sysfs_streq() instead of strncmp() To: yang.yang29@zte.com.cn Cc: mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, james.clark@arm.com, kan.liang@linux.intel.com, zhengjun.xing@linux.intel.com, cjense@google.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, xu.panda@zte.com.cn Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Tue, Nov 22, 2022 at 4:11 AM wrote: > > From: Xu Panda > > Replace the open-code with sysfs_streq(). I don't think it's equivalent to strncmp() and it seems not available in the tools. Thanks, Namhyung > > Signed-off-by: Xu Panda > Signed-off-by: Yang Yang > --- > 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