From nobody Tue Dec 2 01:25:09 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D89BD350A1D for ; Fri, 21 Nov 2025 17:45:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747149; cv=none; b=mFs1yF0rFLdl2E+5feRZDtIth0ONYf3QV4klDT5CzG+6ONxeCq4hlEjnOmZ8nlwyEYmiuwc4bHLlTivKHx9fRIe9AI4O5Khvn44OaT7V488/KSPYD0hbBmBS3urFYU5nrY8YBCZMt6V6p75ImPfWPEjVhYzFH3T7GiG+p1mIRXc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747149; c=relaxed/simple; bh=6HtkTrHaTP+JFYuLUkmN198Pzc6w5QKX3HI4CwFiz8Y=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ml9bWy52SASvlgf3YVevQX+j8agN+WYfN7IcrssPq+joj+ORd9ZH0NERLH55lF1Iw6k74SJy0zIT3strWS3pSn2/rCFVAmqfg+1+4g8sAheN3jVJF0jIc1AfPv8AhZyGcjsnmwEymlV9tWgb+cPLbsGz+nOkYQdRepN/g55jLDc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=Ct0ZI2ER; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=VS8Tsoiz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Ct0ZI2ER"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="VS8Tsoiz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763747146; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kDhqvOby/zFkZ07q4dNsAW+VSloRxfxxgo+K0Cbo+L4=; b=Ct0ZI2ER9PkJLXUI8JuvGAuVK21NJfcrl2O9K/nNKz3uTMpU8Kn17MtEu/Ni5Q62H6LkVv HszMQTtlhj+9udtZdenphJR8/kYMzQX+B1PsTYucJ4JbN/BOeTEeWCIc4C+2D4JSFVfWbE ZYGkXyGSg1hhS4foUe2eJmcs7xBwlls= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-660-5DeF5N1oMr2fnBPOchFfsw-1; Fri, 21 Nov 2025 12:45:45 -0500 X-MC-Unique: 5DeF5N1oMr2fnBPOchFfsw-1 X-Mimecast-MFC-AGG-ID: 5DeF5N1oMr2fnBPOchFfsw_1763747144 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-429c95fdba8so1171453f8f.0 for ; Fri, 21 Nov 2025 09:45:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763747144; x=1764351944; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=kDhqvOby/zFkZ07q4dNsAW+VSloRxfxxgo+K0Cbo+L4=; b=VS8TsoizTmjfZb+nC3LWDSx/m5NFztOse/3tGRxACYLm7X7OUynOtYX1dIOc00V6wR zID3e0S+FxEQ+dRJRBl7kZqpeEuxhOOj8EMXWoso/VdZd4TKCbPJGPmAaOJUoHYd0MiH UpBJj0BQf8lrAxWn6xIGoXIX4TMcXKJFQDZjKjQm6B2wCVC8r3MsKVaVHDs8Jv9WktEp eNgcBtxe1pf5koU2rKG568UAs9Ri388rTW1zRc305PKOwcbXB+QdaQ37jRQRQ3RID15z LqEWcWFo+GAOXdeTzmdAmFhTUu0J9WP7CT3H3oEk2A78iVbA4U9owjyB5FP5nkvvaltM iOkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763747144; x=1764351944; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=kDhqvOby/zFkZ07q4dNsAW+VSloRxfxxgo+K0Cbo+L4=; b=IdQ+VV1WgBAJr8v/agrz+4lqdFnVc+C7WyNPjD1eGhgm1La5MylO2jPmRuKAJlsrq3 OPIsuGF2XzFw/KAb707ZtQW1hfwnbBlkwdPL+EGsxuP7km9xIAvK6iw1caqaL1qiFGwS CC4V1hxYfzxL3SL6HQrpGi1pe1pt1U6TbmsDqinZwGWwgi4C5akYsbWJ/+UjRxZ+Ofjb MchFFU6oNZPstOFQENZ+9OvWSRMRBpHvneUERXqHTDfU/lcTJnMwsK5HA8BwxLFtfODm MsJgf0+k8jW4RmL0ieVktAj8E+bJ9plHXomcG34Q7SgN0B3GDtCm8sXIuYHfhup/ILg8 rJmA== X-Forwarded-Encrypted: i=1; AJvYcCUWgTr2Q891RcsYmNQ/b5W3cGCe8FBlrilLvrh6fU5iOdfoQI16MJmkavO52tit5SZzet539zTKAK5SRVk=@vger.kernel.org X-Gm-Message-State: AOJu0YwjIxCJzW4qHOaYHKEQvGlUIPHuABZRsCWJaVCxdeVvxdiXVFsF pfn0XCjpAR84ckrCoSel9HiIdJsAZHN+vqFukCd581leDfyugmMXA9aABrPNrNteWNJ2/yVljzc 4OYdXzbE2N73oFkGFatjtMGALxJ+lTet/1nH3UM9XyKS5l7KcIn0Kv+oFxEMEqBKlkleMd3U1Jr 16 X-Gm-Gg: ASbGncvIXkd109dLedbmBzjiPIRILCRTvn3EMipvMFJzgbmM9eatyfAHKOg5n5G5VdE 0Y+q1RXfvD/fQuEtakHkx5aBCxNABUQMc6my+4mGKNInC5HeYx7uArN2u2a7xfTWCg6MIPYEF0l NqUb6rfgCu+XR++HVb93QMH4Yf+rzjpi3YolHX+/fyA25m/DA9uYnl5Z1IgV7egBm3s0sv0QSEQ QaORnLlr6A0HuejifKDBb4bK6moKWNb3wym9c1m1h1fC/niYk7he6iPYKzDMASnQtvF7uU1zuij 6YY16Uyq6SfkRIIMLGbz2ZmN3L6UeupinXDAV0BiqLhrrV2DFWpsmBHQUbuJv6ooWvQPVZSWifq efMbA4yUl5ZrV05YynlaE++x+ X-Received: by 2002:a05:6000:24c4:b0:42b:3268:bfc0 with SMTP id ffacd0b85a97d-42cc1d51edcmr3330183f8f.49.1763747143839; Fri, 21 Nov 2025 09:45:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFxKNuFIoU06S06x8Gb8WaEp9y+FF/CyN7E0SyCsTyUfV7QzJpyh4EXIBf5slRqz/Hw5NztZg== X-Received: by 2002:a05:6000:24c4:b0:42b:3268:bfc0 with SMTP id ffacd0b85a97d-42cc1d51edcmr3330154f8f.49.1763747143390; Fri, 21 Nov 2025 09:45:43 -0800 (PST) Received: from costa-tp.bos2.lab ([2a00:a041:e294:5000:b694:8e49:4f51:966d]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42cb7ec454csm11529567f8f.0.2025.11.21.09.45.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 09:45:42 -0800 (PST) From: Costa Shulyupin To: Steven Rostedt , Tomas Glozar , Costa Shulyupin , Crystal Wood , Wander Lairson Costa , Ivan Pravdin , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 5/8] tools/rtla: Consolidate -d/--duration option parsing Date: Fri, 21 Nov 2025 19:45:01 +0200 Message-ID: <20251121174504.519230-6-costa.shul@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251121174504.519230-1-costa.shul@redhat.com> References: <20251121174504.519230-1-costa.shul@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Each rtla tool duplicates parsing of -d/--duration. Migrate the option parsing from individual tools to the common_parse_options(). Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/common.c | 8 +++++++- tools/tracing/rtla/src/osnoise_hist.c | 8 +------- tools/tracing/rtla/src/osnoise_top.c | 8 +------- tools/tracing/rtla/src/timerlat_hist.c | 8 +------- tools/tracing/rtla/src/timerlat_top.c | 8 +------- 5 files changed, 11 insertions(+), 29 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index 4d752e438e89..720add9511e8 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -59,11 +59,12 @@ int common_parse_options(int argc, char **argv, struct = common_params *common) {"cpus", required_argument, 0, 'c'}, {"cgroup", optional_argument, 0, 'C'}, {"debug", no_argument, 0, 'D'}, + {"duration", required_argument, 0, 'd'}, {0, 0, 0, 0} }; =20 opterr =3D 0; - c =3D getopt_long(argc, argv, "c:C::D", long_options, NULL); + c =3D getopt_long(argc, argv, "c:C::Dd:", long_options, NULL); =20 switch (c) { case 'c': @@ -78,6 +79,11 @@ int common_parse_options(int argc, char **argv, struct c= ommon_params *common) case 'D': config_debug =3D 1; break; + case 'd': + common->duration =3D parse_seconds_duration(optarg); + if (!common->duration) + fatal("Invalid -d duration"); + break; default: optind =3D saved_state; return 0; diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 6902486fb144..1b79bfefc214 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -491,7 +491,6 @@ static struct common_params {"auto", required_argument, 0, 'a'}, {"bucket-size", required_argument, 0, 'b'}, {"entries", required_argument, 0, 'E'}, - {"duration", required_argument, 0, 'd'}, {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, {"period", required_argument, 0, 'p'}, @@ -518,7 +517,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:b:d:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:", + c =3D getopt_long(argc, argv, "a:b:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -544,11 +543,6 @@ static struct common_params params->common.hist.bucket_size >=3D 1000000) fatal("Bucket size needs to be > 0 and <=3D 1000000"); break; - case 'd': - params->common.duration =3D parse_seconds_duration(optarg); - if (!params->common.duration) - fatal("Invalid -D duration"); - break; case 'e': tevent =3D trace_event_alloc(optarg); if (!tevent) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 4a61fd50b990..619c5bcf8f35 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -346,7 +346,6 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) while (1) { static struct option long_options[] =3D { {"auto", required_argument, 0, 'a'}, - {"duration", required_argument, 0, 'd'}, {"event", required_argument, 0, 'e'}, {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, @@ -370,7 +369,7 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:d:e:hH:p:P:qr:s:S:t::T:0:1:2:3:", + c =3D getopt_long(argc, argv, "a:e:hH:p:P:qr:s:S:t::T:0:1:2:3:", long_options, NULL); =20 /* Detect the end of the options. */ @@ -390,11 +389,6 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) trace_output =3D "osnoise_trace.txt"; =20 break; - case 'd': - params->common.duration =3D parse_seconds_duration(optarg); - if (!params->common.duration) - fatal("Invalid -d duration"); - break; case 'e': tevent =3D trace_event_alloc(optarg); if (!tevent) diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 97d20e272583..0a7e5dcce121 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -798,7 +798,6 @@ static struct common_params {"auto", required_argument, 0, 'a'}, {"bucket-size", required_argument, 0, 'b'}, {"entries", required_argument, 0, 'E'}, - {"duration", required_argument, 0, 'd'}, {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, {"irq", required_argument, 0, 'i'}, @@ -834,7 +833,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:b:d:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8= :9\1\2:\3:", + c =3D getopt_long(argc, argv, "a:b:e:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9= \1\2:\3:", long_options, NULL); =20 /* detect the end of the options. */ @@ -863,11 +862,6 @@ static struct common_params params->common.hist.bucket_size >=3D 1000000) fatal("Bucket size needs to be > 0 and <=3D 1000000"); break; - case 'd': - params->common.duration =3D parse_seconds_duration(optarg); - if (!params->common.duration) - fatal("Invalid -D duration"); - break; case 'e': tevent =3D trace_event_alloc(optarg); if (!tevent) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 96bca67d419f..4340fbf3f879 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -566,7 +566,6 @@ static struct common_params while (1) { static struct option long_options[] =3D { {"auto", required_argument, 0, 'a'}, - {"duration", required_argument, 0, 'd'}, {"event", required_argument, 0, 'e'}, {"help", no_argument, 0, 'h'}, {"house-keeping", required_argument, 0, 'H'}, @@ -598,7 +597,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:d:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:= ", + c =3D getopt_long(argc, argv, "a:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -635,11 +634,6 @@ static struct common_params /* set aa_only to avoid parsing the trace */ params->common.aa_only =3D 1; break; - case 'd': - params->common.duration =3D parse_seconds_duration(optarg); - if (!params->common.duration) - fatal("Invalid -d duration"); - break; case 'e': tevent =3D trace_event_alloc(optarg); if (!tevent) --=20 2.51.1