Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4550517rwb; Mon, 8 Aug 2022 03:07:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR5JV/4OtCTeLjfPZw3vPAkznACHDFAJ/tMIyhKPis6NESvT4K/ViBE4yNjkiJnhJ1XSrZmM X-Received: by 2002:a05:6402:51d4:b0:43d:9c8e:2617 with SMTP id r20-20020a05640251d400b0043d9c8e2617mr17767502edd.146.1659953250249; Mon, 08 Aug 2022 03:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659953250; cv=none; d=google.com; s=arc-20160816; b=WGK1ouoN4pNgZr/QWuKHImfIybmGs2rQg5liW9y0fublfU16UwxQ2tuEJswaStOSJO boIT5aPk5LTWehO+nbBoJGgVthDvO62Td/W3NF0gH/79ZRBfFuY9L68OTjBw8mKlMcI7 xu2MRNfkO2GpCYY2BPN6Hwc3JsE6az0ObiHbgxetFnMM3Ta65fQ4+BGavxxJQGNN1dDS UAIKUq/rsmv+HodhpTsrSZOR8UQzMmOYCducGULFxgKm+a67GNwbv64FrUDsCHZcX3cP tVrULSVxP+qF+9BN7nqvxWGBXVZ8U4/SQ6Vjty9k5NDGgRWGrYv/q3BUoGxzI99xx/qo iniw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=xn13LbQ5bhx6eeA3J8M3Jl+R4odaL0XKPOHQHwZ2yfE=; b=Bich6w5LIWwuMJ1a9CFfCc4ZqdzZ2kfGgZHifGJms0Frn2x2EnmY4fLbX6OzQeNXqb 18l/C4Gh+YQiCxxBjwkPsozDz7wNKfPmpcUh75ZOlxQDO0iHxS8PaonxPnkvUrnCKa2Q yUSnVKA+XrtdCSKScPVtmc6fRncK87BQj/poU1AvCgHmSPSDHV+A8HuGWrO+7NT8fGFO lpy9YLL+SjzXq9lnjvD1x2kmO3ButmFvKi/I43g1XrN5DEQCSgiCOq/b2JT2D7g2sZuU DpHcGg0rX08La794Aa0DuGRnhWa6Wx6vCf1V21OcB1V58DsSG4oDBtr74/+Rg8OnuxAj IWJw== 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dt22-20020a170907729600b0072b2e31d066si10318368ejc.642.2022.08.08.03.07.03; Mon, 08 Aug 2022 03:07:30 -0700 (PDT) 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242385AbiHHJ1P (ORCPT + 99 others); Mon, 8 Aug 2022 05:27:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242352AbiHHJ1J (ORCPT ); Mon, 8 Aug 2022 05:27:09 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75B7510FE0; Mon, 8 Aug 2022 02:27:08 -0700 (PDT) Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4M1W401b7XzlVrR; Mon, 8 Aug 2022 17:24:16 +0800 (CST) Received: from kwepemm600003.china.huawei.com (7.193.23.202) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 8 Aug 2022 17:27:04 +0800 Received: from ubuntu1804.huawei.com (10.67.174.61) by kwepemm600003.china.huawei.com (7.193.23.202) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 8 Aug 2022 17:27:03 +0800 From: Yang Jihong To: , , , , , , , , CC: Subject: [PATCH 2/2] perf sched latency: Fix subcommand matching error Date: Mon, 8 Aug 2022 17:24:08 +0800 Message-ID: <20220808092408.107399-3-yangjihong1@huawei.com> X-Mailer: git-send-email 2.30.GIT In-Reply-To: <20220808092408.107399-1-yangjihong1@huawei.com> References: <20220808092408.107399-1-yangjihong1@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.61] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600003.china.huawei.com (7.193.23.202) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 perf sched latency use strncmp to match subcommands which matching does not meet expectation. Before: # perf sched lat1234 >/dev/null # echo $? 0 # Solution: Use strstarts to match subcommand. After: # perf sched lat1234 Usage: perf sched [] {record|latency|map|replay|script|timehist} -D, --dump-raw-trace dump raw trace in ASCII -f, --force don't complain, do it -i, --input input file name -v, --verbose be more verbose (show symbol address, etc) # echo $? 129 # # perf sched lat >/dev/null # echo $? 0 # Signed-off-by: Yang Jihong --- tools/perf/builtin-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 646bd938927a..2f6cd1b8b662 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -3563,7 +3563,7 @@ int cmd_sched(int argc, const char **argv) if (strlen(argv[0]) > 2 && strstarts("record", argv[0])) { return __cmd_record(argc, argv); - } else if (!strncmp(argv[0], "lat", 3)) { + } else if (strlen(argv[0]) > 2 && strstarts("latency", argv[0])) { sched.tp_handler = &lat_ops; if (argc > 1) { argc = parse_options(argc, argv, latency_options, latency_usage, 0); -- 2.30.GIT