From nobody Tue Dec 2 01:25:49 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 03D69350A21 for ; Fri, 21 Nov 2025 17:45:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747151; cv=none; b=jI/2EVVc5G6flpLXo+Rb/BkxCiL0FXBuujN6Nvh0tTqs4mYYEvG9nGOLnNSEXaT+8R8yMM7fwjAO5wOXCDEv+PRKDEkFmBeGOghOW5Zr7kpeCegBDaBlN1Q9YnpHUKrtvRzPpoyQiFGjhYKErVXDxNZvIPhsl+k86XmOp1A44bo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747151; c=relaxed/simple; bh=MAliK+IcsyTe77pfxDlXugqDqQMD4jUXrAsnDuEV7lU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HvJHL0W/uMsFNu/z7MIY9yEBiaX8J3wBd+KMsIK0cxLFY9RFKsthW3IW5e+ZwFR2b+l4B/yNluJgzHML/uTX9MSuvFjxcECR8s13eGXRT0xvKOJBHCqQMYC3eXHjjkkZ/1Qnq2MYX49lSqcCQpOl5uz/KWPBe9+75sojkMaFXI4= 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=ACASHLi9; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=t0rc22Qf; arc=none smtp.client-ip=170.10.129.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="ACASHLi9"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="t0rc22Qf" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763747147; 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=cfAuXX383Gya5pnw9IELY8Vpi4DW1gQ6wftsJO5f6yw=; b=ACASHLi9PFY6TQOO8Puf4Cs8iEJqmLEuAkHWcCTmtabZFWBREcTbB5XjVb1EWwaxQrI9MF yMKgqGbI5NX6I+Vt2B10ld+miz3IDN853fSnLncEiisnXsPNhkeoj3xA1rTojzvFpxYlI+ tKxGXp/HDsfqVOeC7ERB0anwcMRsHL4= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-215-1Y_E6IddPFW4S7Tgqh3uvQ-1; Fri, 21 Nov 2025 12:45:38 -0500 X-MC-Unique: 1Y_E6IddPFW4S7Tgqh3uvQ-1 X-Mimecast-MFC-AGG-ID: 1Y_E6IddPFW4S7Tgqh3uvQ_1763747137 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-42b478551a6so1152505f8f.1 for ; Fri, 21 Nov 2025 09:45:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763747137; x=1764351937; 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=cfAuXX383Gya5pnw9IELY8Vpi4DW1gQ6wftsJO5f6yw=; b=t0rc22Qf5fCa+Q++DnBW9y3Ws3Rzji4BWHqFbzqhnhHkOrfsrveYsiqpwj/q1ondTK kKJIKjyA/MN1N/XxIGP8AYMSiZrTVYYEGnz6EhBHfqFEM7ILDPkkhyVpzJ9R42/XjiSz 7oCq6wFBQAvd2weIkeFj+JbjQk7Q9QvDAA8xcwObXBBzlkL1oF79BEeMv+7wNg4gLW0h y3TQhY2ZVUokJjwlvoHIEpIhM1pOcBkHmSTuBMmO3ndiwhmf8QT9RZx3BKL98UKrjn/D nGJf8rxZE38mELds7Yjl7ItOVy04OOFsCZ+90iHYta+fZyp9yBh+jncNEERWq2OSqmOG myXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763747137; x=1764351937; 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=cfAuXX383Gya5pnw9IELY8Vpi4DW1gQ6wftsJO5f6yw=; b=Hd+AZQZto0mErRzEEHKF5cq1WrWAS50JMXENFPif3cA8ziJzgtNbrSKQ0lubUBCEdq 3anHjWYoCIa5hWZfStvE1MLiGZmiPCOvo9FxJzio0u3JXGsrS3tY3L2JAlrTGlGivDRv 4OMCTBPl7yP023DUcFPFkuZrUaJmZIQ3t/Ma33Oj9oLBfoWhlyF+JYfkGzIRW29k4ke1 cZoGRIbQkfzcfyYRhJZOlOad1ENaCcVXTdVm8xz4C4i9oE2Xil4JCeoz2szhL8hFpanq XbMY2ef46jBoYr+wjsBRxPi61LYf2jyNPJTqWWF9Ij8d5hfMOi0EpaS70uAE5TLb+Ozk f8Yw== X-Forwarded-Encrypted: i=1; AJvYcCWepjs8pf3qPtB+IOgyx//alvoUhG6srmVpYmXuAMUV4JMsL5hvPoCPGEXtdRoLG47QfYNz0KlbfrBvJlg=@vger.kernel.org X-Gm-Message-State: AOJu0Yyjty7snL58Sb5VxZtHCUZEr2RWtefTGR3FIHRcdo/mBkDmp4e1 SNkkwOivYIvWeqrps8YjnCpH4Sazzyd+M3K38Y01SnijZCLpg6fhEnROBxrvjTXpPnNrYAIixVX 8qCvug1MwUH4sDGu9MRc0yJDE4X/cTGvdseLIrghT8s5WHG7osbiO4BgSHxFaHUZNQw== X-Gm-Gg: ASbGncsj28baah+SM8YVzK8qSgCaQUaRWXm9CaWNwz0+DAZCc2V2nFPfwvl86XdIA9s 4hB20/VB/c/S26p9qvDlw4mBWxBky7lEMFOYyQZwZ3lYxr/nbz5OL/xb6jSRPn3uUgNo2d6256T MP5ROGK9+J1c+JDJDdNk1AkcXN1Sb5uTXMabM/0D6EYvjrLfGrSRLGf5th31/bVReLRxX3w+kiT 8xtB8FlX6Cpe+z2OXaHKuxqqA31sKcfALKBHGXCPHnqCnvR0spwRpKWpJIwHwFQLJj34FHHRu59 kyVjdq3NnshGo2xluJv/4iakGs4epIpW9ozAaG7Jx2qGZAFfJtZ00mZtjMPcF2VhTM0Ml72ffNO F/2Q7ESJxerC6RlKn/qD21186 X-Received: by 2002:a05:6000:2681:b0:42b:4177:7139 with SMTP id ffacd0b85a97d-42cc1d520famr3437648f8f.46.1763747136940; Fri, 21 Nov 2025 09:45:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXmjn5aMQprmB6OepUqjNn0qu4/rJ18fZB8DnVYStyugXuxWVhu6KeoKnCXw+hhS3XPNSxRA== X-Received: by 2002:a05:6000:2681:b0:42b:4177:7139 with SMTP id ffacd0b85a97d-42cc1d520famr3437620f8f.46.1763747136526; Fri, 21 Nov 2025 09:45:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 09:45:36 -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 3/8] tools/rtla: Consolidate -C/--cgroup option parsing Date: Fri, 21 Nov 2025 19:44:59 +0200 Message-ID: <20251121174504.519230-4-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 -C/--cgroup. Migrate the option parsing from individual tools to the common_parse_options(). Signed-off-by: Costa Shulyupin --- tools/tracing/rtla/src/common.c | 7 ++++++- tools/tracing/rtla/src/osnoise_hist.c | 7 +------ tools/tracing/rtla/src/osnoise_top.c | 7 +------ tools/tracing/rtla/src/timerlat_hist.c | 7 +------ tools/tracing/rtla/src/timerlat_top.c | 7 +------ 5 files changed, 10 insertions(+), 25 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index e12192fcb3ab..92fb2973c373 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -57,11 +57,12 @@ int common_parse_options(int argc, char **argv, struct = common_params *common) =20 static struct option long_options[] =3D { {"cpus", required_argument, 0, 'c'}, + {"cgroup", optional_argument, 0, 'C'}, {0, 0, 0, 0} }; =20 opterr =3D 0; - c =3D getopt_long(argc, argv, "c:", long_options, NULL); + c =3D getopt_long(argc, argv, "c:C::", long_options, NULL); =20 switch (c) { case 'c': @@ -69,6 +70,10 @@ int common_parse_options(int argc, char **argv, struct c= ommon_params *common) fatal("Invalid -c cpu list"); common->cpus =3D optarg; break; + case 'C': + common->cgroup =3D 1; + common->cgroup_name =3D parse_optional_arg(argc, argv); + 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 9e721362989a..5cbe5e1f1b07 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'}, - {"cgroup", optional_argument, 0, 'C'}, {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, {"house-keeping", required_argument, 0, 'H'}, @@ -520,7 +519,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6= :7:", + c =3D getopt_long(argc, argv, "a:b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5:6:7:= ", long_options, NULL); =20 /* detect the end of the options. */ @@ -546,10 +545,6 @@ static struct common_params params->common.hist.bucket_size >=3D 1000000) fatal("Bucket size needs to be > 0 and <=3D 1000000"); break; - case 'C': - params->common.cgroup =3D 1; - params->common.cgroup_name =3D parse_optional_arg(argc, argv); - break; case 'D': config_debug =3D 1; break; diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 73736cefd992..35db5b73c0d7 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'}, - {"cgroup", optional_argument, 0, 'C'}, {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, {"event", required_argument, 0, 'e'}, @@ -372,7 +371,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:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:", + c =3D getopt_long(argc, argv, "a:d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:", long_options, NULL); =20 /* Detect the end of the options. */ @@ -391,10 +390,6 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) if (!trace_output) trace_output =3D "osnoise_trace.txt"; =20 - break; - case 'C': - params->common.cgroup =3D 1; - params->common.cgroup_name =3D parse_optional_arg(argc, argv); break; case 'D': config_debug =3D 1; diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 4ae77145adea..9ecab2bb0f1e 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -796,7 +796,6 @@ static struct common_params while (1) { static struct option long_options[] =3D { {"auto", required_argument, 0, 'a'}, - {"cgroup", optional_argument, 0, 'C'}, {"bucket-size", required_argument, 0, 'b'}, {"debug", no_argument, 0, 'D'}, {"entries", required_argument, 0, 'E'}, @@ -836,7 +835,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456= :7:8:9\1\2:\3:", + c =3D getopt_long(argc, argv, "a:b:d:e:E:DhH:i:knp:P:s:t::T:uU0123456:7:= 8:9\1\2:\3:", long_options, NULL); =20 /* detect the end of the options. */ @@ -858,10 +857,6 @@ static struct common_params if (!trace_output) trace_output =3D "timerlat_trace.txt"; =20 - break; - case 'C': - params->common.cgroup =3D 1; - params->common.cgroup_name =3D parse_optional_arg(argc, argv); break; case 'b': params->common.hist.bucket_size =3D get_llong_from_str(optarg); diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 9774c26b27ff..6329c3a489aa 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'}, - {"cgroup", optional_argument, 0, 'C'}, {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, {"event", required_argument, 0, 'e'}, @@ -600,7 +599,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:= 6:7:", + c =3D getopt_long(argc, argv, "a:d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7= :", long_options, NULL); =20 /* detect the end of the options. */ @@ -637,10 +636,6 @@ static struct common_params /* set aa_only to avoid parsing the trace */ params->common.aa_only =3D 1; break; - case 'C': - params->common.cgroup =3D 1; - params->common.cgroup_name =3D optarg; - break; case 'D': config_debug =3D 1; break; --=20 2.51.1