Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753303AbbB0KVJ (ORCPT ); Fri, 27 Feb 2015 05:21:09 -0500 Received: from szxga03-in.huawei.com ([119.145.14.66]:56631 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751605AbbB0KTc (ORCPT ); Fri, 27 Feb 2015 05:19:32 -0500 From: Yunlong Song To: , , , CC: , Subject: [PATCH v3 2/7] perf list: Fix some inaccuracy problem when parsing the argument Date: Fri, 27 Feb 2015 18:21:26 +0800 Message-ID: <1425032491-20224-3-git-send-email-yunlong.song@huawei.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1425032491-20224-1-git-send-email-yunlong.song@huawei.com> References: <1425032491-20224-1-git-send-email-yunlong.song@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.110.52.30] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.54F044B1.0022,ss=1,re=0.001,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 470cafb6b7dee7c6e12109917035e4a9 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2195 Lines: 60 If somebody happens to name an event with the beginning of 'tracepoint' (e.g. tracepoint_foo), then it will never be showed with perf list event_glob, thus we parse the argument 'tracepoint' more carefully for accuracy. Example: Before this patch: $ perf list tracepoint_foo:* jbd2:jbd2_start_commit [Tracepoint event] jbd2:jbd2_commit_locking [Tracepoint event] jbd2:jbd2_run_stats [Tracepoint event] block:block_rq_issue [Tracepoint event] block:block_bio_complete [Tracepoint event] block:block_bio_backmerge [Tracepoint event] block:block_getrq [Tracepoint event] ... ... As shown above, all of the tracepoint events are printed. In fact, the command's real intention is to print the events of tracepoint_foo. After this patch: $ perf list tracepoint_foo:* tracepoint_foo:tp_foo_enter [Tracepoint event] tracepoint_foo:tp_foo_exit [Tracepoint event] As shown above, only the events of tracepoint_foo are printed. Signed-off-by: Yunlong Song --- tools/perf/builtin-list.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index ad8018e..2acbcf0 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c @@ -50,9 +50,7 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused) } for (i = 0; i < argc; ++i) { - if (i) - putchar('\n'); - if (strncmp(argv[i], "tracepoint", 10) == 0) + if (strcmp(argv[i], "tracepoint") == 0) print_tracepoint_events(NULL, NULL, false); else if (strcmp(argv[i], "hw") == 0 || strcmp(argv[i], "hardware") == 0) -- 1.8.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/