Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4434815pxb; Mon, 21 Feb 2022 21:31:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAr2jPHZU/iWI6oTs6rfygQ2zRo95sYX7upfe+lofzIXy2LPEOXV0HPjnf0jrEFH0OyNrf X-Received: by 2002:a17:90a:5402:b0:1b9:68e8:282e with SMTP id z2-20020a17090a540200b001b968e8282emr2427262pjh.62.1645507872681; Mon, 21 Feb 2022 21:31:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645507872; cv=none; d=google.com; s=arc-20160816; b=lxGPLRif7jJI1zjZ29YPxrlE0GpOWy+keKbfdZYZSOU/hqVppXqLdKtC4UxFxYQbk8 ppyIVVW1KTr1fg3HjRYpKNRw2ugsZoWlWB1PA5Bl+QFP//pwuhqGPtWtJgBq4ul9FJ6/ Pa8vMbhsh6WuXnOIb56calnigW+VOea2iaUSXmeZJm8/WtgYVXX5nwUv8lkq2+e7XCFG 1t3EvWYhrWmCccgUJsiPOzST1FY4af5gaB1KiUfuJiscuQZnOSOBetu9+LMky0LEtoBu CvrhMYiHk5ez9inYfy+pTbseUVLWdXJlu7iBmxMRCprluwD48hLvkqwaFuEFwIu4E/4Y 1VJg== 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=+0CyGJdqiP/yUC33nuh3mAei7JhsL0wkw5KtXbaBKnA=; b=lfB6j7gcCawQCvIroWUKV9C/jy6x9gZThxPDuxx5OhKGoPK+rirpG74oP1AQLhPiMN 5BODK5DTq0qwYXMJamx5LZ/4atT8liALrGtN4dn6GE5N/HhH//zRXMNuU/hAYOv1j/dM XVeWrmHEJiPjqqVdvPJvsLRrWHiUyNCyWjk+zz3K6X2gN6lGON/zxCQqJk7vj5wQWYFq Om9665R4XHDKYzl5QFsO3EUKxRMz3Bdz1SeQVMHWi0LqzLSLFXvHdvSPUYxMuOsH19wU Go2FFzD/EEZkNpEVvUq5LhVA6hqsQLOuG/IDvbtvKlH0KRejdP0aBJx2qx6FtG+P/v+H G7nA== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id s18si13921758plk.162.2022.02.21.21.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:31:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9593F10CF19; Mon, 21 Feb 2022 20:59:43 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235389AbiBUWRu convert rfc822-to-8bit (ORCPT + 99 others); Mon, 21 Feb 2022 17:17:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235345AbiBUWRp (ORCPT ); Mon, 21 Feb 2022 17:17:45 -0500 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [205.139.111.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 30B0222BE8 for ; Mon, 21 Feb 2022 14:17:21 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-64-d95cq2uBMm6z6KoVtTt_zg-1; Mon, 21 Feb 2022 17:17:17 -0500 X-MC-Unique: d95cq2uBMm6z6KoVtTt_zg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C58761853020; Mon, 21 Feb 2022 22:17:15 +0000 (UTC) Received: from x1.com (unknown [10.22.16.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7EE505DB91; Mon, 21 Feb 2022 22:17:13 +0000 (UTC) From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Jonathan Corbet , Clark Williams , Juri Lelli , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org Subject: [PATCH V2 03/11] rtla/osnoise: Add the automatic trace option Date: Mon, 21 Feb 2022 23:16:48 +0100 Message-Id: <333068e89fa2def34158f2c86df1eacde43ec879.1645481500.git.bristot@kernel.org> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Add the -a/--auto option. This option sets some commonly used options while debugging the system. It aims to help users produce reports in the field, reducing the number of arguments passed to the tool in the first approach to a problem. It is equivalent to setting osnoise/stop_tracing_us with the argument, setting tracing_thresh to 1 us, and saving the trace to osnoise_trace.txt file if the trace is stopped automatically. Cc: Daniel Bristot de Oliveira Cc: Steven Rostedt Cc: Jonathan Corbet Signed-off-by: Daniel Bristot de Oliveira --- .../tools/rtla/common_osnoise_options.rst | 5 +++++ tools/tracing/rtla/src/osnoise_hist.c | 19 ++++++++++++++++--- tools/tracing/rtla/src/osnoise_top.c | 19 ++++++++++++++++--- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/Documentation/tools/rtla/common_osnoise_options.rst b/Documentation/tools/rtla/common_osnoise_options.rst index 27f1493f7bc0..f792ca58c211 100644 --- a/Documentation/tools/rtla/common_osnoise_options.rst +++ b/Documentation/tools/rtla/common_osnoise_options.rst @@ -1,3 +1,8 @@ +**-a**, **--auto** *us* + + Set the automatic trace mode. This mode sets some commonly used options + while debugging the system. It is equivalent to use **-s** *us* **-T 1 -t**. + **-p**, **--period** *us* Set the *osnoise* tracer period in microseconds. diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c index ab02219de528..5698da2fe3dd 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -426,11 +426,12 @@ static void osnoise_hist_usage(char *usage) static const char * const msg[] = { "", - " usage: rtla osnoise hist [-h] [-D] [-d s] [-p us] [-r us] [-s us] [-S us] [-T us] \\", - " [-t[=file]] [-c cpu-list] [-P priority] [-b N] [-E N] [--no-header] \\", + " usage: rtla osnoise hist [-h] [-D] [-d s] [-a us] [-p us] [-r us] [-s us] [-S us] \\", + " [-T us] [-t[=file]] [-c cpu-list] [-P priority] [-b N] [-E N] [--no-header] \\", " [--no-summary] [--no-index] [--with-zeros]", "", " -h/--help: print this menu", + " -a/--auto: set automatic trace mode, stopping the session if argument in us sample is hit", " -p/--period us: osnoise period in us", " -r/--runtime us: osnoise runtime in us", " -s/--stop us: stop trace if a single sample is higher than the argument in us", @@ -487,6 +488,7 @@ static struct osnoise_hist_params while (1) { static struct option long_options[] = { + {"auto", required_argument, 0, 'a'}, {"bucket-size", required_argument, 0, 'b'}, {"entries", required_argument, 0, 'E'}, {"cpus", required_argument, 0, 'c'}, @@ -510,7 +512,7 @@ static struct osnoise_hist_params /* getopt_long stores the option index here. */ int option_index = 0; - c = getopt_long(argc, argv, "c:b:d:E:Dhp:P:r:s:S:t::T:0123", + c = getopt_long(argc, argv, "a:c:b:d:E:Dhp:P:r:s:S:t::T:0123", long_options, &option_index); /* detect the end of the options. */ @@ -518,6 +520,17 @@ static struct osnoise_hist_params break; switch (c) { + case 'a': + /* set sample stop to auto_thresh */ + params->stop_us = get_llong_from_str(optarg); + + /* set sample threshold to 1 */ + params->threshold = 1; + + /* set trace */ + params->trace_output = "osnoise_trace.txt"; + + break; case 'b': params->bucket_size = get_llong_from_str(optarg); if ((params->bucket_size == 0) || (params->bucket_size >= 1000000)) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c index 07fb1b8314d3..a6f434f85738 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -245,10 +245,11 @@ void osnoise_top_usage(char *usage) int i; static const char * const msg[] = { - " usage: rtla osnoise [top] [-h] [-q] [-D] [-d s] [-p us] [-r us] [-s us] [-S us] [-T us] \\", - " [-t[=file]] [-c cpu-list] [-P priority]", + " usage: rtla osnoise [top] [-h] [-q] [-D] [-d s] [-a us] [-p us] [-r us] [-s us] [-S us] \\", + " [-T us] [-t[=file]] [-c cpu-list] [-P priority]", "", " -h/--help: print this menu", + " -a/--auto: set automatic trace mode, stopping the session if argument in us sample is hit", " -p/--period us: osnoise period in us", " -r/--runtime us: osnoise runtime in us", " -s/--stop us: stop trace if a single sample is higher than the argument in us", @@ -294,6 +295,7 @@ struct osnoise_top_params *osnoise_top_parse_args(int argc, char **argv) while (1) { static struct option long_options[] = { + {"auto", required_argument, 0, 'a'}, {"cpus", required_argument, 0, 'c'}, {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, @@ -312,7 +314,7 @@ struct osnoise_top_params *osnoise_top_parse_args(int argc, char **argv) /* getopt_long stores the option index here. */ int option_index = 0; - c = getopt_long(argc, argv, "c:d:Dhp:P:qr:s:S:t::T:", + c = getopt_long(argc, argv, "a:c:d:Dhp:P:qr:s:S:t::T:", long_options, &option_index); /* Detect the end of the options. */ @@ -320,6 +322,17 @@ struct osnoise_top_params *osnoise_top_parse_args(int argc, char **argv) break; switch (c) { + case 'a': + /* set sample stop to auto_thresh */ + params->stop_us = get_llong_from_str(optarg); + + /* set sample threshold to 1 */ + params->threshold = 1; + + /* set trace */ + params->trace_output = "osnoise_trace.txt"; + + break; case 'c': retval = parse_cpu_list(optarg, ¶ms->monitored_cpus); if (retval) -- 2.34.1