Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp86271rdb; Tue, 31 Oct 2023 01:10:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsUW+ejwXRWvVB2U0miAjlPk32mzPRWLSKK5LbrXvVjTNdxqLRt4zvucZs0NQhDx2Szewk X-Received: by 2002:a17:90b:1b0e:b0:280:4a23:3c84 with SMTP id nu14-20020a17090b1b0e00b002804a233c84mr2387897pjb.22.1698739851486; Tue, 31 Oct 2023 01:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698739851; cv=none; d=google.com; s=arc-20160816; b=dk8CZqWGtIE7M7EhadalqeF1hO6eHar2eJcBenAVOHNqTGDO9aoJHw957S9aVeOXRn /gBbF+kEPoOO6WkZbwqyvmdcRS27LzIFJ/ukdOk0Cg5SFOasrHubWr1R/P+9MUnU9/5w DAXXFEY3ki2i8729SrggpKBjlR+LNujdvtavHwO8ttXfMiCef2FqxmQCLC1KXLB7LDiD XGBsW7xhAjyWJZGtMmth62xkbVbQ1kH1KLfwqghQ635VE4r4xrJnBVtFInaOOGomI+HK BJo9rG1hQvVlzZWX90r2WkVYvTn7iiJ3lAPUdtK+44WUBD1Yc0qN8aAZMzu1eRS9x7f3 7HaQ== 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 :message-id:date:subject:cc:to:from; bh=eU4BWW6aVfMfA8cjtAvkRJoZpHyaq9GEz2+NGvg4cGk=; fh=JXx1mv1fB650HoTkc5GIgpDQ5Ey550GcDyaNZ/s6bYc=; b=rOFvNxjnDha3OsxLrcpq7zHN3oZ1IMIJxhzbf0vqw97/xEW/xh9XdTYE6Yi/2mZWNA 7fYClI0h5Cj+Ooe7Hksg0xcDiToSpPluIfaS5ZFru0SrdFJT1FrtxyoYQV1upJII9UZy IoHx3X1qJ3iXZup0XFjD8M2LS9kqZZLP0bOM2GZyI+7AAxW8kfwEU4ZCYgZAo9w4xiaf 8JoHYszYWmzQgKkqPyaRNw+RgR+IrXZ+ItjIGXgKYoMeGj5GtPFG/zx5J3KHg1inQ3qY 0dExHbDgKP0Z389/JzW/tjV4xmy2fif+gujhNw97g4MUtvx1lwPi+JW/+dl2VGWRz1H6 hckA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id w21-20020a634915000000b0056569ee3ae6si664482pga.798.2023.10.31.01.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 01:10:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1564E803F622; Tue, 31 Oct 2023 01:10:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232369AbjJaIKm (ORCPT + 99 others); Tue, 31 Oct 2023 04:10:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbjJaIKl (ORCPT ); Tue, 31 Oct 2023 04:10:41 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8FF4A6; Tue, 31 Oct 2023 01:10:36 -0700 (PDT) Received: from kwepemm000003.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4SKN3z5SQxzvQFr; Tue, 31 Oct 2023 16:05:35 +0800 (CST) Received: from ubuntu2204.huawei.com (10.67.174.22) by kwepemm000003.china.huawei.com (7.193.23.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Tue, 31 Oct 2023 16:10:34 +0800 From: Yang Jihong To: , , , , , , , , , , CC: Subject: [PATCH] perf debug: List available options when no variable is specified Date: Tue, 31 Oct 2023 08:08:23 +0000 Message-ID: <20231031080823.1418025-1-yangjihong1@huawei.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.174.22] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm000003.china.huawei.com (7.193.23.66) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 31 Oct 2023 01:10:49 -0700 (PDT) Minor help message improvement for `perf --debug` Before: # perf --debug No variable specified for --debug. Usage: perf [--version] [--help] [OPTIONS] COMMAND [ARGS] After: # perf --debug No variable specified for --debug, available options: verbose,ordered-events,stderr,data-convert,perf-event-open. Signed-off-by: Yang Jihong --- tools/perf/perf.c | 4 +++- tools/perf/util/debug.c | 3 +++ tools/perf/util/debug.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/perf/perf.c b/tools/perf/perf.c index d3fc8090413c..0fc4719e6825 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c @@ -279,7 +279,9 @@ static int handle_options(const char ***argv, int *argc, int *envchanged) exit(0); } else if (!strcmp(cmd, "--debug")) { if (*argc < 2) { - fprintf(stderr, "No variable specified for --debug.\n"); + fprintf(stderr, + "No variable specified for --debug, available options: %s.\n", + perf_debug_options_string); usage(perf_usage_string); } if (perf_debug_option((*argv)[1])) diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index 88378c4c5dd9..e02f6d97b826 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c @@ -215,6 +215,9 @@ void trace_event(union perf_event *event) trace_event_printer, event); } +const char perf_debug_options_string[] = + "verbose,ordered-events,stderr,data-convert,perf-event-open"; + static struct sublevel_option debug_opts[] = { { .name = "verbose", .value_ptr = &verbose }, { .name = "ordered-events", .value_ptr = &debug_ordered_events}, diff --git a/tools/perf/util/debug.h b/tools/perf/util/debug.h index f99468a7f681..b9b4d17a1845 100644 --- a/tools/perf/util/debug.h +++ b/tools/perf/util/debug.h @@ -13,6 +13,7 @@ extern int debug_peo_args; extern bool quiet, dump_trace; extern int debug_ordered_events; extern int debug_data_convert; +extern const char perf_debug_options_string[]; #ifndef pr_fmt #define pr_fmt(fmt) fmt -- 2.34.1