Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp1374734pxb; Fri, 18 Feb 2022 06:36:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxO1pVRtF30hb8QlVvelnDKKYem30e3MWN4B84lVG3cuPtRefvxzVAMtDLXE1Cc/vYYlBsS X-Received: by 2002:a17:90a:2e07:b0:1b9:e28d:4f6d with SMTP id q7-20020a17090a2e0700b001b9e28d4f6dmr12926973pjd.81.1645194988881; Fri, 18 Feb 2022 06:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645194988; cv=none; d=google.com; s=arc-20160816; b=aQseIsk73hbrUPfNl6Mh0l1YlEmMeOZlQQWWq9d4254Z88pKVOlUM0j3JZO0af5Euo 5bwTUOE8D23SitW+Ie0s1YhLGLk/hsNnd06Kkl4RGWY2vL5uygcYTbtiUi5mOdPq83m7 Vo9JxgO+6NnGZ+8yoVkBsa0tgqyv97PEYsuNX6gmzSiseqcZ1EPFEf09i934hGPBjU0k HF86VSUvSB1TPC57wxaLr4d/wwPpPFiofcn32DrMzk2c52wN/NH6NwHO997FIdEwTNnB 0K26vQB4SDdtIUxqT9Ydq2VWKU9E6RRjxoXwsql/NZr7P3A7XzUPGlxX2vFJQpP4/wrc S9rA== 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=AgelnckiVxVMYQ/WrNnNu62yM05JISS7fGQsgOQiTCY=; b=WrunP9q2wU/CkD08sEYWR7r7UQnRZ5EObDNAUu/x1ktkLrgjSBu4jtsk0p8y79JMxg 0SRrs4KzR4N4YsjIKXtFIUq5Ih9ha0BZpXB3xly8mJNNixXyAdaf/OzW35Bk9jSeuYt0 6dhfV0YPTSca7CSnqcC+L9g5JgdXapISoQMIdJHAHycXhp71oaUVUrLZ3LxOfdM5bzo5 OS17R9ea7F8n4k1VipKs62EoOxao43nFcbnYg7Hp5aQmcWboV93UH793tVFDzbjQjEi9 /S6uIPqRjBSDdWp++wUyG5HZlGYmh0kzZ4ZFqKLN9eBm+LveU0CcNfIM/J8xxU9I7p9K ZJVg== 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 u8si725933pls.292.2022.02.18.06.36.12; Fri, 18 Feb 2022 06:36:28 -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 S234445AbiBRLKA convert rfc822-to-8bit (ORCPT + 99 others); Fri, 18 Feb 2022 06:10:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234388AbiBRLJ4 (ORCPT ); Fri, 18 Feb 2022 06:09:56 -0500 Received: from us-smtp-delivery-44.mimecast.com (us-smtp-delivery-44.mimecast.com [207.211.30.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 31F0C2AEDA2 for ; Fri, 18 Feb 2022 03:09:40 -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-495-gxrR3mq-M1GIme7GRRwvIg-1; Fri, 18 Feb 2022 06:09:34 -0500 X-MC-Unique: gxrR3mq-M1GIme7GRRwvIg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 95315814245; Fri, 18 Feb 2022 11:09:32 +0000 (UTC) Received: from x1.com (unknown [10.22.32.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id F202C2B4B5; Fri, 18 Feb 2022 11:09:30 +0000 (UTC) From: Daniel Bristot de Oliveira To: Steven Rostedt Cc: Daniel Bristot de Oliveira , Jonathan Corbet , linux-trace-devel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] rtla/osnoise: Add an option to set the threshold Date: Fri, 18 Feb 2022 12:09:14 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_SOFTFAIL,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 -T/--threshold option to set the minimum threshold to be considered a noise to osnoise top and hist commands. Also update the man pages. Cc: Daniel Bristot de Oliveira Cc: Steven Rostedt Cc: Jonathan Corbet Cc: linux-trace-devel@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Daniel Bristot de Oliveira --- .../tools/rtla/common_osnoise_options.rst | 5 +++++ tools/tracing/rtla/src/osnoise_hist.c | 16 +++++++++++++++- tools/tracing/rtla/src/osnoise_top.c | 16 +++++++++++++++- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/Documentation/tools/rtla/common_osnoise_options.rst b/Documentation/tools/rtla/common_osnoise_options.rst index d556883e4e26..27f1493f7bc0 100644 --- a/Documentation/tools/rtla/common_osnoise_options.rst +++ b/Documentation/tools/rtla/common_osnoise_options.rst @@ -15,3 +15,8 @@ Stop the trace if the total sample is higher than the argument in microseconds. If **-T** is set, it will also save the trace to the output. + +**-T**, **--threshold** *us* + + Specify the minimum delta between two time reads to be considered noise. + The default threshold is *5 us*. diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src/osnoise_hist.c index 1f0b7fce55cf..a6ce312ef621 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -21,6 +21,7 @@ struct osnoise_hist_params { char *trace_output; unsigned long long runtime; unsigned long long period; + long long threshold; long long stop_us; long long stop_total_us; int sleep_time; @@ -434,6 +435,7 @@ static void osnoise_hist_usage(char *usage) " -r/--runtime us: osnoise runtime in us", " -s/--stop us: stop trace if a single sample is higher than the argument in us", " -S/--stop-total us: stop trace if the total sample is higher than the argument in us", + " -T/--threshold us: the minimum delta to be considered a noise", " -c/--cpus cpu-list: list of cpus to run osnoise threads", " -d/--duration time[s|m|h|d]: duration of the session", " -D/--debug: print debug info", @@ -497,6 +499,7 @@ static struct osnoise_hist_params {"stop", required_argument, 0, 's'}, {"stop-total", required_argument, 0, 'S'}, {"trace", optional_argument, 0, 't'}, + {"threshold", required_argument, 0, 'T'}, {"no-header", no_argument, 0, '0'}, {"no-summary", no_argument, 0, '1'}, {"no-index", no_argument, 0, '2'}, @@ -507,7 +510,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::0123", + c = getopt_long(argc, argv, "c:b:d:e:Dhp:P:r:s:S:t::T:0123", long_options, &option_index); /* detect the end of the options. */ @@ -565,6 +568,9 @@ static struct osnoise_hist_params case 'S': params->stop_total_us = get_llong_from_str(optarg); break; + case 'T': + params->threshold = get_llong_from_str(optarg); + break; case 't': if (optarg) /* skip = */ @@ -645,6 +651,14 @@ osnoise_hist_apply_config(struct osnoise_tool *tool, struct osnoise_hist_params } } + if (params->threshold) { + retval = osnoise_set_tracing_thresh(tool->context, params->threshold); + if (retval) { + err_msg("Failed to set tracing_thresh\n"); + goto out_err; + } + } + return 0; out_err: diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/osnoise_top.c index c67dc28ef716..613c9486a01e 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -23,6 +23,7 @@ struct osnoise_top_params { char *trace_output; unsigned long long runtime; unsigned long long period; + long long threshold; long long stop_us; long long stop_total_us; int sleep_time; @@ -252,6 +253,7 @@ void osnoise_top_usage(char *usage) " -r/--runtime us: osnoise runtime in us", " -s/--stop us: stop trace if a single sample is higher than the argument in us", " -S/--stop-total us: stop trace if the total sample is higher than the argument in us", + " -T/--threshold us: the minimum delta to be considered a noise", " -c/--cpus cpu-list: list of cpus to run osnoise threads", " -d/--duration time[s|m|h|d]: duration of the session", " -D/--debug: print debug info", @@ -302,6 +304,7 @@ struct osnoise_top_params *osnoise_top_parse_args(int argc, char **argv) {"runtime", required_argument, 0, 'r'}, {"stop", required_argument, 0, 's'}, {"stop-total", required_argument, 0, 'S'}, + {"threshold", required_argument, 0, 'T'}, {"trace", optional_argument, 0, 't'}, {0, 0, 0, 0} }; @@ -309,7 +312,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::", + c = getopt_long(argc, argv, "c:d:Dhp:P:qr:s:S:t::T:", long_options, &option_index); /* Detect the end of the options. */ @@ -367,6 +370,9 @@ struct osnoise_top_params *osnoise_top_parse_args(int argc, char **argv) else params->trace_output = "osnoise_trace.txt"; break; + case 'T': + params->threshold = get_llong_from_str(optarg); + break; default: osnoise_top_usage("Invalid option"); } @@ -425,6 +431,14 @@ osnoise_top_apply_config(struct osnoise_tool *tool, struct osnoise_top_params *p } } + if (params->threshold) { + retval = osnoise_set_tracing_thresh(tool->context, params->threshold); + if (retval) { + err_msg("Failed to set tracing_thresh\n"); + goto out_err; + } + } + return 0; out_err: -- 2.34.1