From nobody Tue Dec 2 01:06:10 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 809841DE4F6 for ; Fri, 21 Nov 2025 17:45:32 +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=1763747134; cv=none; b=qME+kvhTTFye5MnEhGcpLMX4TD2ay+LL8Gk3go7ymz4nXTmXvSLdJZQA939cMaE33lAe0GEpybdw14yVYQoIk59dFf4g0ujSdieamudY9CLj0Y53J+4nH+l5xjf7SjRlpzpFnRB8jmO9lEhi2XubMMf+zRWv6RONh+wOx62u2FQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747134; c=relaxed/simple; bh=hEnSqrU6gyHDpfaTTvuhCk0gZVj3SdwGrgEDkeASOzo=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=t9TW/XQLQ0Qui8uyuHHjPEBr8q0DMtXoxvG8NOj7xbnAxmxKpGl27OZh1bSv20TmDT46N94bij3xVnKkw3o8+NeEDKuygoW/IR0sOZIqopSflpDjlg/wWDSjjhxSkA/fVS08T9rK1k6aaKJDJ8tsvGFFIzfKAgZsmMpY9GnsJQM= 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=XOrx029Y; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Zm7Zc148; 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="XOrx029Y"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Zm7Zc148" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763747131; 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=a8U8k61ooI8uwApq9Nne2HkmVcuivM1F21YTKzt65jc=; b=XOrx029YQpULBALwJFD7a+kMiLybUpejWo9fEV5Clgc4yC/bmQrzUfS67dYBQw6pUE1O63 IjybPpmL0YS6IF/rFLryHl7bQKuUn7QXmajq/eBtJeApHR6fe5gPrQo5y7Hi1nDDwmGsWq 6GXM9l9xCaEJtk/EdonYIY1ZAq2RGd8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-450-ASL0C9V8M3GfYjZyNrdW2A-1; Fri, 21 Nov 2025 12:45:30 -0500 X-MC-Unique: ASL0C9V8M3GfYjZyNrdW2A-1 X-Mimecast-MFC-AGG-ID: ASL0C9V8M3GfYjZyNrdW2A_1763747129 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4779981523fso29224505e9.2 for ; Fri, 21 Nov 2025 09:45:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763747129; x=1764351929; 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=a8U8k61ooI8uwApq9Nne2HkmVcuivM1F21YTKzt65jc=; b=Zm7Zc148otkHb35R1pL3XST0rdKb0QTkVW5Yh3MWARoj6+R5QqSXFK5v9XeIsk71p+ +WlWX5e5obbxJ3zC7SzjEvx32ohe0oxzYeA65XzYq/AnW76KEQkdCGCpKN0YheQX9zdi D8zUGV7XYQLYUA5dkfHJHGFbnF2WeWE0c3TUpiIXrqnrdVmcpmivXLp2EStF4KVezwbI e5OWjWCrhoA4HES46Sd00uNqgV1/LkQi8xjsutYCIeRW4NQYYABqJQeEASyRQfFd/ikt hDQOxbyTaU8ENyDSdyPy8zT3KKTOCkZnqAUTqWoEzsT3Z/LdPtYsoDXawNp9DSs0Q/Iw tZYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763747129; x=1764351929; 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=a8U8k61ooI8uwApq9Nne2HkmVcuivM1F21YTKzt65jc=; b=lQZhi1BQPcWfv4EDu7BWGaUhrvcUKp4vDP+BzJiaKy1q86pChk4xquRzA6/CA8QSJY B0LjlBvlXbg8CobGV+fr+2Df4BiR8bmPYWoC9Wnr9U47+S5Gzeg+tnd6jyyl/dOZKPN0 8SwGt3386qXuFHTswDmqhyf9o3NTcOZAQgnhYe5eClBEL84bwBNs3/nJKUO5/5Hc9nVe ZR5ZuUbX5zkLL5XOzWEQTO00zQk24wnGe+rN9gA35SrTA2eJtxqcqXycNXQmqK7RjEyx T+TKNqVlfBmFMyjqZ3bcsJMpoyshJoUlQCYUQjJrIrjKUHhlwNFVCiJJnCVim85d9S/W iHog== X-Forwarded-Encrypted: i=1; AJvYcCU/wpD0YZEodXGxRiIY9DXCub0AZiVFYB2hbb2LqWuHcTRp4jtbdu2WMfzHW/NmCKkmiAvBbMuBRIztDQg=@vger.kernel.org X-Gm-Message-State: AOJu0Yy0rJAt2gB4OW0s6RqrOM5lcroftX28B/dOcFwkQpZZ8PE1NNzz ZA6CnZ29NyZmKI/HU83/+9wPMvM96a6nEBZSXjTPwaPUkFoURvJ+2LGRzwfeVtS25O07t74DmXg MW5jFVDpzHual0WhOAQFg7Se45uN26it4jXp+yp5ZnEoIAxcfypwBphK9aRKiR7q7Tw== X-Gm-Gg: ASbGncsxTY2x20FPiTTawT+Lj2QH/vgFrgaOjD3Rg+MMVLXbs3q1+rvxrAhVKPTEjuf 8fP+pyqOJTPjSneCjTenP7qbby8b0oQspwfjc6ty8naSxytuKWFe/xdmn4MoelzRwDXT6mWi2io ZuVMC/LaKKCUR9XTHtWcSXwsb+ZncNJNKjoEkK5oWp/MrE+giLmnXrBU5c2s95jeXhAhxB/4aPf V7X70caf5QR2m+0QRYPjdJB5vJMniJAQmi+KAdDGX9HgJsE23/wv44htryj1HbAw9WkRlIJOwGp RgPAU0Von5qnQSzlkV/BkxDq5pKIqMoTdwTLBfqhQVD3QZ3/eOyO1XbJTnXZpAQKsDIpTNDZfpm duv2YkdE53b+e6X4K30FoLV26 X-Received: by 2002:a05:600c:1f85:b0:477:7b30:a6fe with SMTP id 5b1f17b1804b1-477c1116013mr27453345e9.18.1763747128615; Fri, 21 Nov 2025 09:45:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IF+H0undz5MZzoSg1LxF9NOXlTyyk9c7w50TvXj8Zav3XyrYG5bpmJO1uYPj5tlwMHTJM4AzA== X-Received: by 2002:a05:600c:1f85:b0:477:7b30:a6fe with SMTP id 5b1f17b1804b1-477c1116013mr27453165e9.18.1763747128228; Fri, 21 Nov 2025 09:45:28 -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.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 09:45:27 -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 1/8] tools/rtla: Add common_parse_options() Date: Fri, 21 Nov 2025 19:44:57 +0200 Message-ID: <20251121174504.519230-2-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 many common options. This creates maintenance overhead and risks inconsistencies when updating these options. Add common_parse_options() to centralize parsing of options used across all tools. Common options to be migrated in future patches. Signed-off-by: Costa Shulyupin Reviewed-by: Crystal Wood --- tools/tracing/rtla/src/common.c | 34 ++++++++++++++++++++++++++ tools/tracing/rtla/src/common.h | 1 + tools/tracing/rtla/src/osnoise_hist.c | 3 +++ tools/tracing/rtla/src/osnoise_top.c | 3 +++ tools/tracing/rtla/src/timerlat_hist.c | 3 +++ tools/tracing/rtla/src/timerlat_top.c | 3 +++ 6 files changed, 47 insertions(+) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index b197037fc58b..5eaf6d9e11bf 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "common.h" =20 struct trace_instance *trace_inst; @@ -37,6 +38,39 @@ static void set_signals(struct common_params *params) } } =20 +/* + * common_parse_options - parse common command line options + * + * @argc: argument count + * @argv: argument vector + * @common: common parameters structure + * + * Parse command line options that are common to all rtla tools. + * + * Returns: non zero if a common option was parsed, or 0 + * if the option should be handled by tool-specific parsing. + */ +int common_parse_options(int argc, char **argv, struct common_params *comm= on) +{ + int saved_state =3D optind; + int c; + + static struct option long_options[] =3D { + {0, 0, 0, 0} + }; + + opterr =3D 0; + c =3D getopt_long(argc, argv, "", long_options, NULL); + + switch (c) { + default: + optind =3D saved_state; + return 0; + } + + return c; +} + /* * common_apply_config - apply common configs to the initialized tool */ diff --git a/tools/tracing/rtla/src/common.h b/tools/tracing/rtla/src/commo= n.h index 9ec2b7632c37..1066d777a823 100644 --- a/tools/tracing/rtla/src/common.h +++ b/tools/tracing/rtla/src/common.h @@ -153,6 +153,7 @@ struct osnoise_tool *osnoise_init_tool(char *tool_name); struct osnoise_tool *osnoise_init_trace_tool(const char *tracer); bool osnoise_trace_is_off(struct osnoise_tool *tool, struct osnoise_tool *= record); =20 +int common_parse_options(int argc, char **argv, struct common_params *comm= on); int common_apply_config(struct osnoise_tool *tool, struct common_params *p= arams); int top_main_loop(struct osnoise_tool *tool); int hist_main_loop(struct osnoise_tool *tool); diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index ff8c231e47c4..35f4a068af95 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -518,6 +518,9 @@ static struct common_params {0, 0, 0, 0} }; =20 + if (common_parse_options(argc, argv, ¶ms->common)) + continue; + c =3D getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5= :6:7:", long_options, NULL); =20 diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 04c699bdd736..550731c7addd 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -370,6 +370,9 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) {0, 0, 0, 0} }; =20 + if (common_parse_options(argc, argv, ¶ms->common)) + continue; + c =3D getopt_long(argc, argv, "a:c:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:", long_options, NULL); =20 diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 1fb471a787b7..ffcfcabb9964 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -834,6 +834,9 @@ static struct common_params {0, 0, 0, 0} }; =20 + if (common_parse_options(argc, argv, ¶ms->common)) + continue; + c =3D getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU01234= 56:7:8:9\1\2:\3:", long_options, NULL); =20 diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 29c2c1f717ed..d18d48671ccd 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -598,6 +598,9 @@ static struct common_params {0, 0, 0, 0} }; =20 + if (common_parse_options(argc, argv, ¶ms->common)) + continue; + c =3D getopt_long(argc, argv, "a:c:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:34= 5:6:7:", long_options, NULL); =20 --=20 2.51.1 From nobody Tue Dec 2 01:06:10 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 0D60D1DE4F6 for ; Fri, 21 Nov 2025 17:45:38 +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=1763747140; cv=none; b=dkt2rLV3sPhi/7y22w+ySRXD+M2cCLw30bH0NuoM86aOunSB3Tr2uyfFE8U7vx2nUQHLRrD1ZfHJJAR0XaFT0jxL06Y9bmm+rlls7/a0aq8d0eBWJQOT/nOxhbABO9sTfp3cSpGgJuE8xnHaPDrKD3yIoCUBZ5VrK9Baz6DzupA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747140; c=relaxed/simple; bh=pT/n7TwuIIVbjLsRSlAm3v1I6gvrDAWaKDW6YsvrdCs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ju34gcTbzX1Qw/kT9p+S2/mkZ8KZRgLmWUgSfDCHik8vZVkHof5zAx52eys1icWgEQ03ewE38mqew6cPpiPDuyFzGy6P0ky7Gbjczci4sWNa/Yz6YL+FS8fFBysLBW3IlKEz4eTzlHSTlqKCIIJ//mwzDFo9HLjGe4GndoUuyDQ= 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=Jaqkv/pa; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=tv5vXTIa; 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="Jaqkv/pa"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="tv5vXTIa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763747137; 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=YpyZDwI31rENzFfB5C1Wg2Rz+FfMtSQE+luFnR7RLDs=; b=Jaqkv/paoOmOK1UK2dPEs2a/hRPpZRDNWpJIJYA2eH0XvLTLoTc5odM+q1xW0OwUEPmEko PGj6tA4VTqK/AHkwNYBObfycb1i5x4zGlJvdhLuwh3SWFDIp2owNaXUL4WXe8VQd4ScPh5 fYFKb3IMSTVeLhdSdfNCzVcJ/YaWZps= 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-44-c6Xk6DcbNjmkDHnQHx3lpg-1; Fri, 21 Nov 2025 12:45:35 -0500 X-MC-Unique: c6Xk6DcbNjmkDHnQHx3lpg-1 X-Mimecast-MFC-AGG-ID: c6Xk6DcbNjmkDHnQHx3lpg_1763747134 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-42b3155274eso1140073f8f.0 for ; Fri, 21 Nov 2025 09:45:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763747134; x=1764351934; 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=YpyZDwI31rENzFfB5C1Wg2Rz+FfMtSQE+luFnR7RLDs=; b=tv5vXTIapMELPVuRPc1w/MgePpF/c7Y8ve/ztcsQrDf7cYmc6nyH+Vm4TP5RsF+VUd w4KYtqaoI/wV0DjQDIC7tMXeE0f5mV7wff0LERmF0Jdtk/r1bBGl0VUQAOciJ7BbwCwO EHwCJmD6oURuB7IvGOt6MWAiANRRAJCyhcvl/xoHyz2gRspbpl0pkJX+WwRRj0PsYt9Q DZK4akG7KNh/ACCtxeZENmvx/lBN/SK6XWICzsb7cgohfu1XCwCGriYE5pn2m9eMS7B4 CJRwuxP5RDm5Sjbzcyn9iJl7Y6KsG/xMiO+ASsNQQmTHkmycV8fILAuJpsafi0SyeXX1 p9iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763747134; x=1764351934; 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=YpyZDwI31rENzFfB5C1Wg2Rz+FfMtSQE+luFnR7RLDs=; b=eh6xk9emtlbeZfvhO0ZeRJyMV+5Upj3HpY20LoQkbCV/TUywXq8cX8DIJw9OmrwtXe ITVQ3ZkVVxqmAK5Rfh0cWKI/Ix0pU2tNs3I9MvlinaAB4eq8uhhJyE5K7eegCvo8m4ZV BFGLcfT+2uRzVWXCQC6oj3hFvMUZ4J1dAWh4PFEvgBZColfxPycFuu2gyQaqhycVdPSM mdRXR17FuYApGvYmUhMlHotqI5NxEWeIXhuIWJfaFGmg++odwo30Lw6cwVUz3qrlRIUL 5zqn8weEhttjX8LDJZr6N1U4fdOVQahq+CBja6IzbeZ8dlbmr0jObHFHoP0rEnOTAB0Z EJsA== X-Forwarded-Encrypted: i=1; AJvYcCUHGN8PhVREcMZ4qCNMUeml5R8nu3crsi7/oW2DwamHW2RMIwcLH0rrxguHFO9idvly+sCh+yM++H+BLZg=@vger.kernel.org X-Gm-Message-State: AOJu0YwzM1IbG67wE+Rd8CPpI4f63lT9QHAnP7W2BtR5m0cx90PGN+Vx 8Kxp9hhFMp3VZr7H7hGn+5rbg+3/+I2BSHrcdI49Hkh+S3XP/5Vh1JvvgIB6T+wYfhqHOlRXZR1 5qx0mJ1na0cRwYI1ENc0utZvph7bupWT9wbHa0vIBZ7Ev4GqA2naESq2IEGaoNquH6Q== X-Gm-Gg: ASbGncviqVZnhTZUeoSHK7TmBo3Zr3En37vGb9WY9JM/YWVEc59w6UPINesaEe6yoB+ vDbnxpbvizl3qA7iO6RoBOp04qkSwWu6ZeCQunOpYecdHSdFwDWSRUtWcgueEmvHYAi90dSWbFx ENDjdSqAxvoM8xTZEIddBjghoZnru6ahGIbSoz5lxaPqlDyEqzT3ttV9wAbzNtChsRQmhVmHEAr 8fAdN4RLq8yweJXQcdgsUZtTeliT+GvnoT/7yeCk11qEutGFjoudBvIFoEmcNXEcfEzFDwECWBE +199XjeFgxmuaYJiRFrUE1lw/ByuR3ZBgUizdby0CxggdrWu9dMQm2AmPc9nf7ckHnN8Vh7TFjA adsihJYr6sWvIiM8dNfp/2v7v X-Received: by 2002:a05:6000:240b:b0:429:c4bb:fbc4 with SMTP id ffacd0b85a97d-42cc1cc293dmr3253806f8f.25.1763747133666; Fri, 21 Nov 2025 09:45:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIpzBXzy0HPFysMAQjEIJp3Hx8LAxcp7Ta/3C1XrC0QGlsWwYqzq+LzSYTGLDxPDmbXken+A== X-Received: by 2002:a05:6000:240b:b0:429:c4bb:fbc4 with SMTP id ffacd0b85a97d-42cc1cc293dmr3253778f8f.25.1763747133191; Fri, 21 Nov 2025 09:45:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 09:45:32 -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 2/8] tools/rtla: Consolidate -c/--cpus option parsing Date: Fri, 21 Nov 2025 19:44:58 +0200 Message-ID: <20251121174504.519230-3-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/--cpus. Migrate the option parsing from individual tools to the common_parse_options(). Signed-off-by: Costa Shulyupin Reviewed-by: Crystal Wood --- tools/tracing/rtla/src/common.c | 8 +++++++- tools/tracing/rtla/src/osnoise_hist.c | 9 +-------- tools/tracing/rtla/src/osnoise_top.c | 9 +-------- tools/tracing/rtla/src/timerlat_hist.c | 9 +-------- tools/tracing/rtla/src/timerlat_top.c | 9 +-------- 5 files changed, 11 insertions(+), 33 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index 5eaf6d9e11bf..e12192fcb3ab 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -56,13 +56,19 @@ int common_parse_options(int argc, char **argv, struct = common_params *common) int c; =20 static struct option long_options[] =3D { + {"cpus", required_argument, 0, 'c'}, {0, 0, 0, 0} }; =20 opterr =3D 0; - c =3D getopt_long(argc, argv, "", long_options, NULL); + c =3D getopt_long(argc, argv, "c:", long_options, NULL); =20 switch (c) { + case 'c': + if (parse_cpu_set(optarg, &common->monitored_cpus)) + fatal("Invalid -c cpu list"); + common->cpus =3D optarg; + 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 35f4a068af95..9e721362989a 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'}, - {"cpus", required_argument, 0, 'c'}, {"cgroup", optional_argument, 0, 'C'}, {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, @@ -521,7 +520,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:p:P:r:s:S:t::T:01234:5= :6:7:", + c =3D getopt_long(argc, argv, "a:C::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. */ @@ -547,12 +546,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': - retval =3D parse_cpu_set(optarg, ¶ms->common.monitored_cpus); - if (retval) - fatal("Invalid -c cpu list"); - params->common.cpus =3D optarg; - break; case 'C': params->common.cgroup =3D 1; params->common.cgroup_name =3D parse_optional_arg(argc, argv); diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 550731c7addd..73736cefd992 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'}, - {"cpus", required_argument, 0, 'c'}, {"cgroup", optional_argument, 0, 'C'}, {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, @@ -373,7 +372,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:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:", + c =3D getopt_long(argc, argv, "a:C::d:De:hH:p:P:qr:s:S:t::T:0:1:2:3:", long_options, NULL); =20 /* Detect the end of the options. */ @@ -392,12 +391,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': - retval =3D parse_cpu_set(optarg, ¶ms->common.monitored_cpus); - if (retval) - fatal("Invalid -c cpu list"); - params->common.cpus =3D optarg; break; case 'C': params->common.cgroup =3D 1; diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index ffcfcabb9964..4ae77145adea 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'}, - {"cpus", required_argument, 0, 'c'}, {"cgroup", optional_argument, 0, 'C'}, {"bucket-size", required_argument, 0, 'b'}, {"debug", no_argument, 0, 'D'}, @@ -837,7 +836,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:c:C::b:d:e:E:DhH:i:knp:P:s:t::T:uU01234= 56:7:8:9\1\2:\3:", + 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:", long_options, NULL); =20 /* detect the end of the options. */ @@ -859,12 +858,6 @@ static struct common_params if (!trace_output) trace_output =3D "timerlat_trace.txt"; =20 - break; - case 'c': - retval =3D parse_cpu_set(optarg, ¶ms->common.monitored_cpus); - if (retval) - fatal("Invalid -c cpu list"); - params->common.cpus =3D optarg; break; case 'C': params->common.cgroup =3D 1; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index d18d48671ccd..9774c26b27ff 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'}, - {"cpus", required_argument, 0, 'c'}, {"cgroup", optional_argument, 0, 'C'}, {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, @@ -601,7 +600,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:c:C::d:De:hH:i:knp:P:qs:t::T:uU0:1:2:34= 5:6:7:", + c =3D getopt_long(argc, argv, "a:C::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. */ @@ -638,12 +637,6 @@ static struct common_params /* set aa_only to avoid parsing the trace */ params->common.aa_only =3D 1; break; - case 'c': - retval =3D parse_cpu_set(optarg, ¶ms->common.monitored_cpus); - if (retval) - fatal("Invalid -c cpu list"); - params->common.cpus =3D optarg; - break; case 'C': params->common.cgroup =3D 1; params->common.cgroup_name =3D optarg; --=20 2.51.1 From nobody Tue Dec 2 01:06:10 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 Reviewed-by: Crystal Wood --- 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 From nobody Tue Dec 2 01:06:10 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 27AAA350A09 for ; Fri, 21 Nov 2025 17:45:44 +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=1763747146; cv=none; b=NZy0PV740rHDVGV7QyR260b/4V9ZhcFIdWe3JkEXzXpnS4Fj5CkIV/M1hYKG7TqI6O8Vf5W2NUpKGlcQlZkNUvUA4INwpCV231FIG4lemwXAyVwaDkfb+Ub4sXy8mmx4c6urgtz05mQo8q1TwjVi+ceAp8TZAp0eJfaynUGv9fE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747146; c=relaxed/simple; bh=jI07AZA+TX7XdamDHqd4AYGgXdXJ9w/eJer63SI/Klc=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KmPQNxNTArvcOCIDM/9hRKdFCoq2jp6ZKPy5qbCEQ5sYtwIsPEt1wtY9g5/Qnt4nWQKuPeL25m8GbBSyxgf/m8Or8DtTi/ihCZTOZkXE8w6ybQ93CnW7ZwZmE9cas62xoGEApqrnw02AB+DmpPM9IRRXwAChmfdMj5aTteyqvEQ= 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=Ktkup1hn; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=DxWrn98s; 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="Ktkup1hn"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="DxWrn98s" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763747144; 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=g4vTg2SXn5ikmleP2ulGHJRIjy4fI9F/oORLv9vFsuE=; b=Ktkup1hncEIA08Y/o/oZW7dktFT63lZRcpLLQ/BbZe0qWSxafadxqTq8lqGOzU0v/WVwm+ B3FRPCOGxAxu991tSeXNtuDgdnv8VWL1jH+L/Bw64Su+mIKzMW2Nnhueasg1UlmsKuZpK+ nRzcgF/+3/h4MXLj+xUD3/kvERdbPw8= 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-159-rY-omsCtPHCIz3J3ZzpOug-1; Fri, 21 Nov 2025 12:45:42 -0500 X-MC-Unique: rY-omsCtPHCIz3J3ZzpOug-1 X-Mimecast-MFC-AGG-ID: rY-omsCtPHCIz3J3ZzpOug_1763747141 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-429cbed2b8fso1207878f8f.1 for ; Fri, 21 Nov 2025 09:45:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763747141; x=1764351941; 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=g4vTg2SXn5ikmleP2ulGHJRIjy4fI9F/oORLv9vFsuE=; b=DxWrn98sZuuJjqzu7vu2pO1UtqHYAlD0mHv1rxj6H9QVxe2M1xglggTuZ4HIqEsoj2 HLOTU5r07PGHnPTqN5TEJnlKRGLvogAhd3OSJ/nJdw1Nq2dp8Y2pjIJDLm4IabJjDjX4 hoeN9FhamzShvgrc0KtBr/5j1IA0/3jMuu9JtMeM6JpHHVLKG9igWFv1OjLm5oIl0LRO gDwQDwSiJYP5cCXZf6wL88N3GEZaKzJ51n2WYLhDK2+Vgwh7cYIvYCYHKjpSz0+t0IIi CgivBEN+6gmdyxbYyPuYL4s9/qYPsxp0kU3GfPp8sgk/fclR51ENlZOiHs3SfzOwDdES 2x6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763747141; x=1764351941; 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=g4vTg2SXn5ikmleP2ulGHJRIjy4fI9F/oORLv9vFsuE=; b=MlmufXnwXg7FMsk0g/1af9x62fnbnVTrPnIJptFwcHKPlnhi+RtNWJgJvYyeKm2Jc7 8JDaCPxFWkNeBAN8a26LZ77zZGPig6uwFYAer0M2RUfgqGBAoM/jsjlDLuU8wuTN1eUf HsKgYcpGsCMOybghO6j21hx9LYu1Esf3UjKaI8vaqR51WAKVkci39BA1PDc95YjoDl7Z mFyN0IEeqZ6WM8rygX00m3tvA/Ced+axZv3iKPXtPcgQHju14rmdHg/bpRG1YZVSYf25 x9Kia32OMTcIZy2NgEKTNOk8iFKzhuXxnWbNnCV4cW/3qO8jCkwHTAEL2s5bXrgDG8VD Oh+A== X-Forwarded-Encrypted: i=1; AJvYcCVCkM9rVIPsNoIzbOFvSe2xANFAJa0VdwFGDdpaiapjQVfSUJiak8XAfa2eWVHzfzshz5aycqZ3MutSA7I=@vger.kernel.org X-Gm-Message-State: AOJu0YzKM4b108z1GqY9jKbuORMyKC6Q79oQtbKRaKCqmd1OpzrtxeVO aOrokkIths5xnPVYBt1Bq93shfKrqm6/mQjmESuerpmYSIzxg7wt+oq+Ik2wj2a4zuSy3RLi/VN puhwaLafhkgmQwrocgUzcCL3U/O8O8VLYAneQTJKHDVOMvow2YpT4RlIQmrudVByStQ== X-Gm-Gg: ASbGncvaAAvjLu6BEjnEVXZqgjUlDStHtYBt4R4u1r6CLOtPRRHVYnL3R+I85NHF+8f v4gyhIUleaC3biDExZvBxx+1dulnFKpgFY9BO4gBpafIO82F2ZGBcI37g8H4XKm29gvUjWfm8WG EdUj+h3QnuMdwyIl4nYEd91dV4EUTwnS/oUHceWQjmSPMRTmAuQ1UhnGaQ+KehuaOZzQQrVULSO Z9qtucWY+Z81HsMbvG+LRzylfL1ytTuI14yHXcUUhpBuo8n4be3+HUDTYk2ZZSxCDm+SAWjJOMO +oBV2USOxgbSaFCx6S/dNtsgMwBs8YAkdjwQ0PUpBBCBk47Kb2RwlnZI0T+1l3FCjvXTmd0ioGF pYfzpMWtCmWDisUEFIxKOxVyg X-Received: by 2002:a5d:5850:0:b0:429:c709:7b54 with SMTP id ffacd0b85a97d-42cc1cf3c0bmr3187026f8f.36.1763747141413; Fri, 21 Nov 2025 09:45:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHMogGSpPJax38iHwqevfbwGGHtpcSZqT2Cj7PBh9pXn6LQfxQmFEKu2ydXxpCDILAnwUBkIg== X-Received: by 2002:a5d:5850:0:b0:429:c709:7b54 with SMTP id ffacd0b85a97d-42cc1cf3c0bmr3186997f8f.36.1763747140921; Fri, 21 Nov 2025 09:45:40 -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.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 09:45:40 -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 4/8] tools/rtla: Consolidate -D/--debug option parsing Date: Fri, 21 Nov 2025 19:45:00 +0200 Message-ID: <20251121174504.519230-5-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/--debug. Migrate the option parsing from individual tools to the common_parse_options(). Signed-off-by: Costa Shulyupin Reviewed-by: Crystal Wood --- tools/tracing/rtla/src/common.c | 6 +++++- tools/tracing/rtla/src/osnoise_hist.c | 6 +----- tools/tracing/rtla/src/osnoise_top.c | 6 +----- tools/tracing/rtla/src/timerlat_hist.c | 6 +----- tools/tracing/rtla/src/timerlat_top.c | 6 +----- 5 files changed, 9 insertions(+), 21 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index 92fb2973c373..4d752e438e89 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -58,11 +58,12 @@ int common_parse_options(int argc, char **argv, struct = common_params *common) static struct option long_options[] =3D { {"cpus", required_argument, 0, 'c'}, {"cgroup", optional_argument, 0, 'C'}, + {"debug", no_argument, 0, 'D'}, {0, 0, 0, 0} }; =20 opterr =3D 0; - c =3D getopt_long(argc, argv, "c:C::", long_options, NULL); + c =3D getopt_long(argc, argv, "c:C::D", long_options, NULL); =20 switch (c) { case 'c': @@ -74,6 +75,9 @@ int common_parse_options(int argc, char **argv, struct co= mmon_params *common) common->cgroup =3D 1; common->cgroup_name =3D parse_optional_arg(argc, argv); break; + case 'D': + config_debug =3D 1; + 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 5cbe5e1f1b07..6902486fb144 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'}, - {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, @@ -519,7 +518,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:DhH:p:P:r:s:S:t::T:01234:5:6:7:= ", + c =3D getopt_long(argc, argv, "a:b:d:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -545,9 +544,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': - config_debug =3D 1; - break; case 'd': params->common.duration =3D parse_seconds_duration(optarg); if (!params->common.duration) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 35db5b73c0d7..4a61fd50b990 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'}, - {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, {"event", required_argument, 0, 'e'}, {"house-keeping", required_argument, 0, 'H'}, @@ -371,7 +370,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:De:hH:p:P:qr:s:S:t::T:0:1:2:3:", + c =3D getopt_long(argc, argv, "a:d:e:hH:p:P:qr:s:S:t::T:0:1:2:3:", long_options, NULL); =20 /* Detect the end of the options. */ @@ -390,9 +389,6 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) if (!trace_output) trace_output =3D "osnoise_trace.txt"; =20 - break; - case 'D': - config_debug =3D 1; break; case 'd': params->common.duration =3D parse_seconds_duration(optarg); diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 9ecab2bb0f1e..97d20e272583 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -797,7 +797,6 @@ static struct common_params static struct option long_options[] =3D { {"auto", required_argument, 0, 'a'}, {"bucket-size", required_argument, 0, 'b'}, - {"debug", no_argument, 0, 'D'}, {"entries", required_argument, 0, 'E'}, {"duration", required_argument, 0, 'd'}, {"house-keeping", required_argument, 0, 'H'}, @@ -835,7 +834,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: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:hH:i:knp:P:s:t::T:uU0123456:7:8= :9\1\2:\3:", long_options, NULL); =20 /* detect the end of the options. */ @@ -864,9 +863,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': - config_debug =3D 1; - break; case 'd': params->common.duration =3D parse_seconds_duration(optarg); if (!params->common.duration) diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 6329c3a489aa..96bca67d419f 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'}, - {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, {"event", required_argument, 0, 'e'}, {"help", no_argument, 0, 'h'}, @@ -599,7 +598,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:d:De:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7= :", + c =3D getopt_long(argc, argv, "a:d:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:= ", long_options, NULL); =20 /* detect the end of the options. */ @@ -636,9 +635,6 @@ static struct common_params /* set aa_only to avoid parsing the trace */ params->common.aa_only =3D 1; break; - case 'D': - config_debug =3D 1; - break; case 'd': params->common.duration =3D parse_seconds_duration(optarg); if (!params->common.duration) --=20 2.51.1 From nobody Tue Dec 2 01:06:10 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 Reviewed-by: Crystal Wood --- 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 From nobody Tue Dec 2 01:06:10 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 2503734F241 for ; Fri, 21 Nov 2025 17:45:49 +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=QHVJbIQgahNW3yn0Lj9B4wT6ibEacwG3zHCc6GQ7jkGvcaqvhAi7rAB02l7wjXJxak9BiHJN6iaw91fOaDKoFERYG4PwGUwGJb4dRQtq8f0eyhBj5ohvkW7onehvFI0rGKFXrwMjSfw5CHH6adPl84uy93B1nOTCpQh+voneOJY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747151; c=relaxed/simple; bh=U5DeGnZekR8rISaant6f6+HTTp8Iy1SCbciThbchxaM=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IVxXfwzzJ5gIyti3mjbXYVP/CYyAtO0AbLkOT0SUDudXdURJS/sBNnjcBWm5vBQRnVG+9TUTENx19NNa9ebw1I+NgogS2T3JWoi2IxBFA4Wj/1wRWJoRyGKD3W2qD0WCWQBHhpQoIRvVawT9CXzUiNgb5qPUfTGoF5sg13lIwEU= 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=QWOpAsEX; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=iixE4PXw; 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="QWOpAsEX"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="iixE4PXw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763747149; 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=601u8cTJOpTNQMx+d0xy6jF7wJaJPINuIXmBn9DqsBA=; b=QWOpAsEXxfpLOqdUNeLbiZFoO44Z+Goe0ujuQz7FADWz7noMhprsoKMxdLNevRBoasjfO3 P0VCAa05ZxWIWhB5FZNgxNLgOg+Cp0AnuMt6W8PgH7hoXp9MTFzm+6o4FK/GGN4Q9mIwEo +4Z73AO3GMZ3HQMUlmeB/Ut4dUq1/Oc= 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-563-xh4LaqSaNNSfnqkGvguHbw-1; Fri, 21 Nov 2025 12:45:47 -0500 X-MC-Unique: xh4LaqSaNNSfnqkGvguHbw-1 X-Mimecast-MFC-AGG-ID: xh4LaqSaNNSfnqkGvguHbw_1763747146 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-429ca3e7245so1223906f8f.3 for ; Fri, 21 Nov 2025 09:45:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763747146; x=1764351946; 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=601u8cTJOpTNQMx+d0xy6jF7wJaJPINuIXmBn9DqsBA=; b=iixE4PXwU8ttHq0ZwE6pBuZ0X4s9s/tDs+o/xstJOiFc/UpMmvaJJBISuyiJsDJaPE 5JAp2HvgR9Y522i+Ff0FTE4QJzjY4CrAAsAvL5GuWhpyAga+ZqhCqPC9SbLo3idtOPAr fBFp5j3xB5vWy4y2/4DRPgYfG1IEplHMxzjWz3y3s/DXE1jHLcDRGIRGPonqAzte+pGs ZsL+KHuGpHGxCx8fPvUQzg9K/8HHrrz53DEtmA3vpbeFIL5tIYOKkiOINfJqn1OpaUMj wLxA2DOjD3aAQpQCpusqQsS4yTWJqaS6aAXYRBGLzwSZa8X5/Av9SVU3iJxI+696ZKhk E7cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763747146; x=1764351946; 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=601u8cTJOpTNQMx+d0xy6jF7wJaJPINuIXmBn9DqsBA=; b=AR/98ONITcDujBzF2ItFkWOYEmPO6XZwrFEAwyvNGm5vSTrnPCAdvkZEUAfxlYrx4w 9WSmHyLVOj+0FTAqafsrnRFhQw3bsEYewOMYu3M5hwaVLO5EmhYuxnYUuusYs+GEUcNo ytQJvfRSRU8ne44HEWj1G0O4mRIRpo3q0yvoFigXIoENRn1DV6UmY+xp8cIbAqX53cKM jLPSr5hoppgskxXrjVygwN2/90uTJWvyRpH8oFlMLDz+kL4afItoTw6wqSNhrMQt5xTU /0VSrBJt1GwdE5ogYZh7iejcQJbA0n6ShyUHNBLRZ2APLLm+PT83Mr6RTRdxjB6YYkxF 8X8A== X-Forwarded-Encrypted: i=1; AJvYcCUDfl63lefvsYcSg8WBkPNWciUxLx2zczkW/8lbQz1iiBVGS/4FV+fDszZLyfh+WF/tf1s4Hof0WwX8WSA=@vger.kernel.org X-Gm-Message-State: AOJu0YzA0daSazwEEiE1qRYyyfqbirc2di+br7kJHoALuXx5aZh5/HYY mI88aisR/QwxuFBY61OdqnZ11w1uCxkEQR61dV/1YnYReJS+iCOz1+412OqordhlON3MvFKtJzo 6vJYlwdWiCTxtXKPDb4wPHc5BAnzUyZm2Nscc6l5Kd+TUOMH9mxXDnEpQmuhCmO/eqA== X-Gm-Gg: ASbGncsSH/AaW8cLGqTqLKplLbWsRN4owd3d61YkBRE8QE7AhQpC3LR8lGCVvKGZWYf gljEhWyvl3cXIdvffHLDGEROhYH7/Rky5U85G2cq2vY0I5W7RjBjmJop4vwNNYA3JbL6AB7+OCx QZ7SQfcYgDmKx6P+sZI2mSkKzRk8iJK9LmDDi1wE9iI+Oh2UBgcLPWMx6AbXbfITaLyQsII6/um yAekTw8Lt92tMnkjHubAOs+ajgV92XyztH3X/rY5dEI+k/Pkr/Bk5zbnXwd7ui1pIHT6hurvrns WVUPCiYxtPm+kKA2/IGRGx69eHYqsb18lbbOg3LnvxfY8i1zcVU4pzOSfCQKDWAaLRCJP7muL9A T1Q+FYwiTNZ2PVfKjZjTXi/5t X-Received: by 2002:a5d:5d02:0:b0:42b:3339:c7ff with SMTP id ffacd0b85a97d-42cc1d19a16mr3698686f8f.43.1763747146284; Fri, 21 Nov 2025 09:45:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IH8kZ/PfttCKjmF1hEvfyYQbUXFlJLAEN1wlOmdYkHKzzjvrHLPwsh+1ZWK5l8V1ImULMCiQQ== X-Received: by 2002:a5d:5d02:0:b0:42b:3339:c7ff with SMTP id ffacd0b85a97d-42cc1d19a16mr3698652f8f.43.1763747145811; Fri, 21 Nov 2025 09:45:45 -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.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 09:45:45 -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 6/8] tools/rtla: Consolidate -e/--event option parsing Date: Fri, 21 Nov 2025 19:45:02 +0200 Message-ID: <20251121174504.519230-7-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 -e/--event. Migrate the option parsing from individual tools to the common_parse_options(). Signed-off-by: Costa Shulyupin Reviewed-by: Crystal Wood --- tools/tracing/rtla/src/common.c | 13 ++++++++++++- tools/tracing/rtla/src/osnoise_hist.c | 14 +------------- tools/tracing/rtla/src/osnoise_top.c | 14 +------------- tools/tracing/rtla/src/timerlat_hist.c | 14 +------------- tools/tracing/rtla/src/timerlat_top.c | 13 +------------ 5 files changed, 16 insertions(+), 52 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index 720add9511e8..6a1675eba96e 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -52,6 +52,7 @@ static void set_signals(struct common_params *params) */ int common_parse_options(int argc, char **argv, struct common_params *comm= on) { + struct trace_events *tevent; int saved_state =3D optind; int c; =20 @@ -60,11 +61,12 @@ int common_parse_options(int argc, char **argv, struct = common_params *common) {"cgroup", optional_argument, 0, 'C'}, {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, + {"event", required_argument, 0, 'e'}, {0, 0, 0, 0} }; =20 opterr =3D 0; - c =3D getopt_long(argc, argv, "c:C::Dd:", long_options, NULL); + c =3D getopt_long(argc, argv, "c:C::Dd:e:", long_options, NULL); =20 switch (c) { case 'c': @@ -84,6 +86,15 @@ int common_parse_options(int argc, char **argv, struct c= ommon_params *common) if (!common->duration) fatal("Invalid -d duration"); break; + case 'e': + tevent =3D trace_event_alloc(optarg); + if (!tevent) + fatal("Error alloc trace event"); + + if (common->events) + tevent->next =3D common->events; + common->events =3D tevent; + 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 1b79bfefc214..c4013f50e803 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -469,7 +469,6 @@ static struct common_params *osnoise_hist_parse_args(int argc, char *argv[]) { struct osnoise_params *params; - struct trace_events *tevent; int retval; int c; char *trace_output =3D NULL; @@ -499,7 +498,6 @@ static struct common_params {"stop", required_argument, 0, 's'}, {"stop-total", required_argument, 0, 'S'}, {"trace", optional_argument, 0, 't'}, - {"event", required_argument, 0, 'e'}, {"threshold", required_argument, 0, 'T'}, {"no-header", no_argument, 0, '0'}, {"no-summary", no_argument, 0, '1'}, @@ -517,7 +515,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:b:e:E:hH:p:P:r:s:S:t::T:01234:5:6:7:", + c =3D getopt_long(argc, argv, "a:b:E:hH:p:P:r:s:S:t::T:01234:5:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -543,16 +541,6 @@ static struct common_params params->common.hist.bucket_size >=3D 1000000) fatal("Bucket size needs to be > 0 and <=3D 1000000"); break; - case 'e': - tevent =3D trace_event_alloc(optarg); - if (!tevent) - fatal("Error alloc trace event"); - - if (params->common.events) - tevent->next =3D params->common.events; - - params->common.events =3D tevent; - break; case 'E': params->common.hist.entries =3D get_llong_from_str(optarg); if (params->common.hist.entries < 10 || diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 619c5bcf8f35..846d25ee4885 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -322,7 +322,6 @@ static void osnoise_top_usage(struct osnoise_params *pa= rams) struct common_params *osnoise_top_parse_args(int argc, char **argv) { struct osnoise_params *params; - struct trace_events *tevent; int retval; int c; char *trace_output =3D NULL; @@ -346,7 +345,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'}, - {"event", required_argument, 0, 'e'}, {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, {"period", required_argument, 0, 'p'}, @@ -369,7 +367,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:e:hH:p:P:qr:s:S:t::T:0:1:2:3:", + c =3D getopt_long(argc, argv, "a:hH:p:P:qr:s:S:t::T:0:1:2:3:", long_options, NULL); =20 /* Detect the end of the options. */ @@ -388,16 +386,6 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) if (!trace_output) trace_output =3D "osnoise_trace.txt"; =20 - break; - case 'e': - tevent =3D trace_event_alloc(optarg); - if (!tevent) - fatal("Error alloc trace event"); - - if (params->common.events) - tevent->next =3D params->common.events; - params->common.events =3D tevent; - break; case 'h': case '?': diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 0a7e5dcce121..4744f84a452e 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -766,7 +766,6 @@ static struct common_params *timerlat_hist_parse_args(int argc, char *argv[]) { struct timerlat_params *params; - struct trace_events *tevent; int auto_thresh; int retval; int c; @@ -810,7 +809,6 @@ static struct common_params {"user-threads", no_argument, 0, 'u'}, {"kernel-threads", no_argument, 0, 'k'}, {"user-load", no_argument, 0, 'U'}, - {"event", required_argument, 0, 'e'}, {"no-irq", no_argument, 0, '0'}, {"no-thread", no_argument, 0, '1'}, {"no-header", no_argument, 0, '2'}, @@ -833,7 +831,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:b: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:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1= \2:\3:", long_options, NULL); =20 /* detect the end of the options. */ @@ -862,16 +860,6 @@ static struct common_params params->common.hist.bucket_size >=3D 1000000) fatal("Bucket size needs to be > 0 and <=3D 1000000"); break; - case 'e': - tevent =3D trace_event_alloc(optarg); - if (!tevent) - fatal("Error alloc trace event"); - - if (params->common.events) - tevent->next =3D params->common.events; - - params->common.events =3D tevent; - break; case 'E': params->common.hist.entries =3D get_llong_from_str(optarg); if (params->common.hist.entries < 10 || diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 4340fbf3f879..b77e5b6550a1 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -538,7 +538,6 @@ static struct common_params *timerlat_top_parse_args(int argc, char **argv) { struct timerlat_params *params; - struct trace_events *tevent; long long auto_thresh; int retval; int c; @@ -566,7 +565,6 @@ static struct common_params while (1) { static struct option long_options[] =3D { {"auto", required_argument, 0, 'a'}, - {"event", required_argument, 0, 'e'}, {"help", no_argument, 0, 'h'}, {"house-keeping", required_argument, 0, 'H'}, {"irq", required_argument, 0, 'i'}, @@ -597,7 +595,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:e:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:", + c =3D getopt_long(argc, argv, "a:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -634,15 +632,6 @@ static struct common_params /* set aa_only to avoid parsing the trace */ params->common.aa_only =3D 1; break; - case 'e': - tevent =3D trace_event_alloc(optarg); - if (!tevent) - fatal("Error alloc trace event"); - - if (params->common.events) - tevent->next =3D params->common.events; - params->common.events =3D tevent; - break; case 'h': case '?': timerlat_top_usage(); --=20 2.51.1 From nobody Tue Dec 2 01:06:10 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 80B35352939 for ; Fri, 21 Nov 2025 17:45:54 +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=1763747156; cv=none; b=Z0ux8jcSIYK6K6NKRk9ZKKzmodOfNKU09uUuINXXoULcJjeAoVUkN6QWjj9TtOuxgmaEh9ioNPZOXV1+SlpMD2Nq+P5Aag613hl0PV4p+mk2h21jfexvIMiZrHqjMQQxeh7EdbxigfiavGHMyk99qSNndM3MW95upEwYSA4TNw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747156; c=relaxed/simple; bh=vxt6YkT2AJM7gpYvCrWhvWBDfSnksKr0pxtwsqtUlrA=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rU56iibTrlKqZ6j+SdX3mMHW7QD/tf/PKFjLZ0zHFsqU3tL0kOxySk2taTd/PyKudBu+9L8h5dCrHMnc2EaVsLNji0SG9X8l47h7yc6ZHxk9aYv79Vh8Z+qbCWCLWAADcDGwhft43RxyceJKOki2qkOykX1zeM0JLJTBXCfsqZ4= 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=YzPjBQ8a; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=BeM8Oakh; 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="YzPjBQ8a"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="BeM8Oakh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763747153; 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=stUTEue8FT2h1CDBsUSOzIXkuLJSdaVPkM2CKd/Olvo=; b=YzPjBQ8aVgWE7PxfYqfoBSPAeIZdkDvxkQzTe77qfwXgqSdDXGe/uzlg++E2+Ci1y0/jfW 2rx/cXrYBmGC8i0/rvV9sn5eWZMj3aYX2wuPCDhVVBrXifef0ip2yKOy0Zk6WQpz4CFlOZ PzhzqoGfo3755nZwnaQAUWbDSzHHiR0= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-326-jxFsUHD4NP-tg4LNb7kFLw-1; Fri, 21 Nov 2025 12:45:51 -0500 X-MC-Unique: jxFsUHD4NP-tg4LNb7kFLw-1 X-Mimecast-MFC-AGG-ID: jxFsUHD4NP-tg4LNb7kFLw_1763747150 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-477c49f273fso5741335e9.3 for ; Fri, 21 Nov 2025 09:45:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763747150; x=1764351950; 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=stUTEue8FT2h1CDBsUSOzIXkuLJSdaVPkM2CKd/Olvo=; b=BeM8OakhNkZLPZC+zkuvRoCIx/TDcYUMMULL+0UmS9Akdi+N9WJWqpIZsySKKA83Z7 rXeP4/h3U6tYdd1XCAx/9pVmIDF8glf6+tWmUWbdBY6LEdITN0EC+MRjM2Ttfz6slEM2 Ya81b8IzIsWgAngN+HjEVqMNU29ETSeX3zrcYVywmHhASypzZAj7of2bufhAAeZjq4bU mQ7YW2CcygYI+CgCcY8lPAZyBi+M8xbSxNY7p9l0rWLQc1fVpt3BOeu9ZnMCGoFtKQrV puF1heiHcJbp9BLXVbP8hotrnooCVykCuzMuIChGx6+qZBbw2Vdd3ipjOy7hlEjndWwk AXSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763747150; x=1764351950; 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=stUTEue8FT2h1CDBsUSOzIXkuLJSdaVPkM2CKd/Olvo=; b=LQopzBf5oWFF3n4YlO3xHNWnZTm0I2OrOPYZIjGzhyaIzIp5PkTguZiwyGtqBS9v7I raX2u9uj8koLqaShFWLHh18znPxPgMQ9j3x4Y+WYrQKmldIeIpsDKM7uMCU2g8ilSaRp fR0M8/OmaNRsZU2DSDCNYe707/KwXjatA4HKyNpLYPjQjtoUFlXi51qB0NnZuY2tKPFP BTfctQfk7aFfXWZJDrJPW3mKaegQ1eDkwAaz3cRdVKjWRanzuaGTRDaLqedGBzne0T9S QD9IObgr12eAyg9tOXSyan3ZuvxZXarcSgW7DlS+LrfM3wPu3m8pka+N2VRQlXjECDuy 3JEw== X-Forwarded-Encrypted: i=1; AJvYcCUDRG6vhd93Q04nwSU//YcQnrVjGyi7B+H3ucKeIBndR+y0ZQWQlA+G2VhPsdfOdnsWJVPQpyDGaTtoCsE=@vger.kernel.org X-Gm-Message-State: AOJu0YyDOd+GBcx7iREx+FXOmfwpd6zcuye4GEdD0mCUGeuMc1CBH6qS mf8dLwaN7fKAq5AY9Qv2UBPY/nlGllquMRbRTkB1d62xWVYuGjA6u5m0AY5G6M/FdgvAPQe/h9S fpw/HBZoTRfWz8GIiJoX8Y3b3hsGx4c2sPVagcckmhJ+1wRv8+G8yOIlRAnR/WlzWjQ== X-Gm-Gg: ASbGncsbzshD8Phcgh/WEZ8F+0ETUBXGTEoafl4H6WpkNxgLwkdRpp5ZHQCiYyQVBgv 5pfVv1Ju2Rx3NXsUU8EaNZKgauaEverlmzVc31WcvuOtx34o4Gb88vpJ4+aqL8U/KBQPxmdK3+b fSrMdmaJgNPx+4vKjocThycBvilPMyLOwm5hI8o9BV3RqJEoMkUZ3fuI2tPMum3VPu2fR4bVFz1 /nSRSrFRLDF4sujFiXB13Sg6ULiXysAqJO+kFtyp3Gtll5Yn3B+hQIXlGr9/BdhHf2EQ9LQ5s53 BXDmlgyItxuwKaJ/DGH7rab+TIXNSWqoqquUltk9NVgnZRXqW0taEsd5VRl+mV0g0lQOZVJCsfo BKMAGhUPVFY7ZDZ3a+p4bdMDO X-Received: by 2002:a05:6000:2881:b0:429:bc56:cd37 with SMTP id ffacd0b85a97d-42cc1ac9ce9mr3485051f8f.6.1763747149722; Fri, 21 Nov 2025 09:45:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpqCYrgceE1yQxRUQgFRs4ztxop0bpE/tG9aVbffduYMdGlSTjfpT7+d4XAocdRAomj/wX/g== X-Received: by 2002:a05:6000:2881:b0:429:bc56:cd37 with SMTP id ffacd0b85a97d-42cc1ac9ce9mr3485028f8f.6.1763747149258; Fri, 21 Nov 2025 09:45:49 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 09:45:48 -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 7/8] tools/rtla: Consolidate -P/--priority option parsing Date: Fri, 21 Nov 2025 19:45:03 +0200 Message-ID: <20251121174504.519230-8-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 -P/--priority. Migrate the option parsing from individual tools to the common_parse_options(). Signed-off-by: Costa Shulyupin Reviewed-by: Crystal Wood --- tools/tracing/rtla/src/common.c | 8 +++++++- tools/tracing/rtla/src/osnoise_hist.c | 9 +-------- tools/tracing/rtla/src/osnoise_top.c | 9 +-------- tools/tracing/rtla/src/timerlat_hist.c | 9 +-------- tools/tracing/rtla/src/timerlat_top.c | 9 +-------- 5 files changed, 11 insertions(+), 33 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index 6a1675eba96e..dd67c6b47eaa 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -62,11 +62,12 @@ int common_parse_options(int argc, char **argv, struct = common_params *common) {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, {"event", required_argument, 0, 'e'}, + {"priority", required_argument, 0, 'P'}, {0, 0, 0, 0} }; =20 opterr =3D 0; - c =3D getopt_long(argc, argv, "c:C::Dd:e:", long_options, NULL); + c =3D getopt_long(argc, argv, "c:C::Dd:e:P:", long_options, NULL); =20 switch (c) { case 'c': @@ -95,6 +96,11 @@ int common_parse_options(int argc, char **argv, struct c= ommon_params *common) tevent->next =3D common->events; common->events =3D tevent; break; + case 'P': + if (parse_prio(optarg, &common->sched_param) =3D=3D -1) + fatal("Invalid -P priority"); + common->set_sched =3D 1; + 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 c4013f50e803..6ed5f5594960 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -493,7 +493,6 @@ static struct common_params {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, {"period", required_argument, 0, 'p'}, - {"priority", required_argument, 0, 'P'}, {"runtime", required_argument, 0, 'r'}, {"stop", required_argument, 0, 's'}, {"stop-total", required_argument, 0, 'S'}, @@ -515,7 +514,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:b:E:hH:p:P:r:s:S:t::T:01234:5:6:7:", + c =3D getopt_long(argc, argv, "a:b:E:hH:p:r:s:S:t::T:01234:5:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -562,12 +561,6 @@ static struct common_params if (params->period > 10000000) fatal("Period longer than 10 s"); break; - case 'P': - retval =3D parse_prio(optarg, ¶ms->common.sched_param); - if (retval =3D=3D -1) - fatal("Invalid -P priority"); - params->common.set_sched =3D 1; - break; case 'r': params->runtime =3D get_llong_from_str(optarg); if (params->runtime < 100) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index 846d25ee4885..d2dfad960440 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -348,7 +348,6 @@ struct common_params *osnoise_top_parse_args(int argc, = char **argv) {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, {"period", required_argument, 0, 'p'}, - {"priority", required_argument, 0, 'P'}, {"quiet", no_argument, 0, 'q'}, {"runtime", required_argument, 0, 'r'}, {"stop", required_argument, 0, 's'}, @@ -367,7 +366,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:hH:p:P:qr:s:S:t::T:0:1:2:3:", + c =3D getopt_long(argc, argv, "a:hH:p:qr:s:S:t::T:0:1:2:3:", long_options, NULL); =20 /* Detect the end of the options. */ @@ -402,12 +401,6 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) if (params->period > 10000000) fatal("Period longer than 10 s"); break; - case 'P': - retval =3D parse_prio(optarg, ¶ms->common.sched_param); - if (retval =3D=3D -1) - fatal("Invalid -P priority"); - params->common.set_sched =3D 1; - break; case 'q': params->common.quiet =3D 1; break; diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index 4744f84a452e..e7ba083b5eb4 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -802,7 +802,6 @@ static struct common_params {"irq", required_argument, 0, 'i'}, {"nano", no_argument, 0, 'n'}, {"period", required_argument, 0, 'p'}, - {"priority", required_argument, 0, 'P'}, {"stack", required_argument, 0, 's'}, {"thread", required_argument, 0, 'T'}, {"trace", optional_argument, 0, 't'}, @@ -831,7 +830,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:b:E:hH:i:knp:P:s:t::T:uU0123456:7:8:9\1= \2:\3:", + c =3D getopt_long(argc, argv, "a:b:E:hH:i:knp:s:t::T:uU0123456:7:8:9\1\2= :\3:", long_options, NULL); =20 /* detect the end of the options. */ @@ -890,12 +889,6 @@ static struct common_params if (params->timerlat_period_us > 1000000) fatal("Period longer than 1 s"); break; - case 'P': - retval =3D parse_prio(optarg, ¶ms->common.sched_param); - if (retval =3D=3D -1) - fatal("Invalid -P priority"); - params->common.set_sched =3D 1; - break; case 's': params->print_stack =3D get_llong_from_str(optarg); break; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index b77e5b6550a1..8250bea4b2fd 100644 --- a/tools/tracing/rtla/src/timerlat_top.c +++ b/tools/tracing/rtla/src/timerlat_top.c @@ -570,7 +570,6 @@ static struct common_params {"irq", required_argument, 0, 'i'}, {"nano", no_argument, 0, 'n'}, {"period", required_argument, 0, 'p'}, - {"priority", required_argument, 0, 'P'}, {"quiet", no_argument, 0, 'q'}, {"stack", required_argument, 0, 's'}, {"thread", required_argument, 0, 'T'}, @@ -595,7 +594,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:hH:i:knp:P:qs:t::T:uU0:1:2:345:6:7:", + c =3D getopt_long(argc, argv, "a:hH:i:knp:qs:t::T:uU0:1:2:345:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -656,12 +655,6 @@ static struct common_params if (params->timerlat_period_us > 1000000) fatal("Period longer than 1 s"); break; - case 'P': - retval =3D parse_prio(optarg, ¶ms->common.sched_param); - if (retval =3D=3D -1) - fatal("Invalid -P priority"); - params->common.set_sched =3D 1; - break; case 'q': params->common.quiet =3D 1; break; --=20 2.51.1 From nobody Tue Dec 2 01:06:10 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 29F60351FC9 for ; Fri, 21 Nov 2025 17:45:55 +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=1763747157; cv=none; b=NBnRpp/VaOERxSloQMhD/mX4Zrd8CuacThtzHZ5s+NVyHrndPMnMf7qQuqbgnbr3HNKnLCdDPAq8AbhtFUdGwHydUkPjSmWOGcwwTotR0zSc9FXuD5EyLZBta0U4OLllY5Ch/lx4H844YPYMojXhS72rewnXOfpOQCBYQeEBSMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763747157; c=relaxed/simple; bh=D1AdlKWho2by+4CzgvcoFl74FcN82SAXeg9cfxfzFB8=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=q33x7ZaskFUqpfQQCe5btUowX4zLCCqFo74enK3VfvVVbHuYcP1jbVsMTyHawFFNTppOfkUsP+kEbUjJT/0ceLbD9yP3NBBeih/6sjGpSLaVHqqNVkWhSSiAiK/jJ7A61rGR81/lftaA3DLylm1IGnrIVXteTy5gow+w0d8A7j4= 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=CAUqpo6g; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=Y6I//ppT; 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="CAUqpo6g"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y6I//ppT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763747155; 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=4isV2YzTCHizoKjzYDGn0aeaubcmK1LCw5702FwMQNE=; b=CAUqpo6gfmoqODMxXvcNDnUwyQeIcNfC4QNiP24BQQvTjZ3+SivndEIIObXdvms5dO4Pdo l7YMNfjNpVPoVLcL+uzMlyn+BzklkI6WA2VkwciapDjWf14yIJee9etVWJXRtZqkSR4GjH YIzIaJfOIoJyYlr8c43Af6mTDX+FVO4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-52-yAn0C-mCNvyDLwvGV_u5yQ-1; Fri, 21 Nov 2025 12:45:53 -0500 X-MC-Unique: yAn0C-mCNvyDLwvGV_u5yQ-1 X-Mimecast-MFC-AGG-ID: yAn0C-mCNvyDLwvGV_u5yQ_1763747152 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-40cfb98eddbso1675138f8f.0 for ; Fri, 21 Nov 2025 09:45:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1763747152; x=1764351952; 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=4isV2YzTCHizoKjzYDGn0aeaubcmK1LCw5702FwMQNE=; b=Y6I//ppT5rCKr8SoensmGdmkhETA2wsNwUs3bmVk1eE6GMUvzmrI/K5mNfUSywREbG rFyzi26mYXYLzZmuxPqRKYPsqzqbQEROvf9CyoxNNTYLOZxCXeQmOte8Wa5Z73hRFNFT k/xAUg9d5Se+PkulYGobGUQvywF7l1FgeBTVDpyOuXiTOL6zVhq0Gl+KJG//VBcTMMyU Gwp5RGMncRBHnQ8IDjmVwFh7U85MvYXiGS7IhFj7PVpRv3sRylXJaeb5kYRaxvZUSyju 48mKhDo1qQVIQPoLK6J39I2AO6Qkura6OVp+xVQmgYE8sJ5o5XqzYJDDQcRh/jOBjFm+ ESow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763747152; x=1764351952; 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=4isV2YzTCHizoKjzYDGn0aeaubcmK1LCw5702FwMQNE=; b=Mm8llK1C4dewRzzU8gjZlkxhhN2CBfWW91CISbZKWkezu8uUMvzoF8pBLV8QvuUXjd qMXI/ue7zcUvSaku4928l1NMHZ8I5+kkinjWDTu/RGIhPN9eb6ZycDnNeMi/AUOqv8nb VIF9JFuHBlEqKx0Z6R4XC7QoAkPZrJ37z3HdWT7Z9+JwXhKLTpArQ4uCsSmkeeiuca4D MZgHXlTa2DzbZvNPDYzSH6YOxJICTW103UPJ8L/EAkLQIl0xniMUOj0KW4RDBMg4EvCG GnjIkkkb6MEDXCEgAe+g8xSp3Kwl76x+1BaRExQRDzVXGWXHDbIFz5hf8K/2DTT7xHFv 8ObA== X-Forwarded-Encrypted: i=1; AJvYcCX29npWS1Xi/niuXnpp/V0uK9KkQlB0Ln+yA9ZYZJFqvI6xQ2c2XkjsJLpmRsCaxxibwpvsSCVNQG73ahE=@vger.kernel.org X-Gm-Message-State: AOJu0Yx0NoEE3ivba9Z387ee1bKyG4O44mH8bod/FQW6IWSSPGozkbn8 FHzl2e3lsCra2RtHP7Fom0wCUfejSgyr6hhJUyIBTM0r/JmBBdsRPAY6QXomxkxc54kN2Wb7WW3 2JnuGQMf7FETYRWW+/PPNrQ8eeR6y4tQ1Tu7IjsCIIYLIMPsUFiP7HkpkU98lwbGidw== X-Gm-Gg: ASbGncsYRzLQ7xpEVGJJKwlCGQBOlsn/8AXDZpu6ja08ZwXb0CGC7T4laETCGvROkBp GRJmlRIivo1T7qLTkThW41/n0QPbs4p2Jmo1M8ALeW7lBIVzt3ReElyO8qBvR1Ssq9vV2y4ikIU w4R5U5teKJL+07P7NNpyKdH1UcUhvdoim/Prnf8VcLaQVL+Wz9+l+R4yD2vD0hWTtwXHlbMZDa/ eWcyP1ggsUjasNOcRvZrYHeT4Zv1ljdCFWegblsnAekg1qdVePtNlgXs6b4jvreFRS7WT+3wrjD s/f/PfUB2Z6GoJMPJdTropUbiPlZzXrCZPzb4bfmX0EqA6wy0bZFb9AVTIekkG5Obz60jSvl3vo 038D1EU0yv7HkP4tZYEl8z8CV X-Received: by 2002:a5d:5f54:0:b0:42b:3108:5671 with SMTP id ffacd0b85a97d-42cba7c4d96mr8095366f8f.29.1763747151992; Fri, 21 Nov 2025 09:45:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEM8NKpwRcn40VnEReWwYMQNvRZKJQwoTcUDLfVIQM9E7znbRvegTyP8bUUSuZwUOgLpRPQYw== X-Received: by 2002:a5d:5f54:0:b0:42b:3108:5671 with SMTP id ffacd0b85a97d-42cba7c4d96mr8095340f8f.29.1763747151498; Fri, 21 Nov 2025 09:45:51 -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.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Nov 2025 09:45:51 -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 8/8] tools/rtla: Consolidate -H/--house-keeping option parsing Date: Fri, 21 Nov 2025 19:45:04 +0200 Message-ID: <20251121174504.519230-9-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 -H/--house-keeping. Migrate the option parsing from individual tools to the common_parse_options(). Signed-off-by: Costa Shulyupin Reviewed-by: Crystal Wood --- tools/tracing/rtla/src/common.c | 8 +++++++- tools/tracing/rtla/src/osnoise_hist.c | 9 +-------- tools/tracing/rtla/src/osnoise_top.c | 9 +-------- tools/tracing/rtla/src/timerlat_hist.c | 9 +-------- tools/tracing/rtla/src/timerlat_top.c | 9 +-------- 5 files changed, 11 insertions(+), 33 deletions(-) diff --git a/tools/tracing/rtla/src/common.c b/tools/tracing/rtla/src/commo= n.c index dd67c6b47eaa..9d047a64146b 100644 --- a/tools/tracing/rtla/src/common.c +++ b/tools/tracing/rtla/src/common.c @@ -62,12 +62,13 @@ int common_parse_options(int argc, char **argv, struct = common_params *common) {"debug", no_argument, 0, 'D'}, {"duration", required_argument, 0, 'd'}, {"event", required_argument, 0, 'e'}, + {"house-keeping", required_argument, 0, 'H'}, {"priority", required_argument, 0, 'P'}, {0, 0, 0, 0} }; =20 opterr =3D 0; - c =3D getopt_long(argc, argv, "c:C::Dd:e:P:", long_options, NULL); + c =3D getopt_long(argc, argv, "c:C::Dd:e:H:P:", long_options, NULL); =20 switch (c) { case 'c': @@ -96,6 +97,11 @@ int common_parse_options(int argc, char **argv, struct c= ommon_params *common) tevent->next =3D common->events; common->events =3D tevent; break; + case 'H': + common->hk_cpus =3D 1; + if (parse_cpu_set(optarg, &common->hk_cpu_set)) + fatal("Error parsing house keeping CPUs"); + break; case 'P': if (parse_prio(optarg, &common->sched_param) =3D=3D -1) fatal("Invalid -P priority"); diff --git a/tools/tracing/rtla/src/osnoise_hist.c b/tools/tracing/rtla/src= /osnoise_hist.c index 6ed5f5594960..1ebd3b48b2d3 100644 --- a/tools/tracing/rtla/src/osnoise_hist.c +++ b/tools/tracing/rtla/src/osnoise_hist.c @@ -490,7 +490,6 @@ static struct common_params {"auto", required_argument, 0, 'a'}, {"bucket-size", required_argument, 0, 'b'}, {"entries", required_argument, 0, 'E'}, - {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, {"period", required_argument, 0, 'p'}, {"runtime", required_argument, 0, 'r'}, @@ -514,7 +513,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:b:E:hH:p:r:s:S:t::T:01234:5:6:7:", + c =3D getopt_long(argc, argv, "a:b:E:hp:r:s:S:t::T:01234:5:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -550,12 +549,6 @@ static struct common_params case '?': osnoise_hist_usage(); break; - case 'H': - params->common.hk_cpus =3D 1; - retval =3D parse_cpu_set(optarg, ¶ms->common.hk_cpu_set); - if (retval) - fatal("Error parsing house keeping CPUs"); - break; case 'p': params->period =3D get_llong_from_str(optarg); if (params->period > 10000000) diff --git a/tools/tracing/rtla/src/osnoise_top.c b/tools/tracing/rtla/src/= osnoise_top.c index d2dfad960440..02e5e6e18e8d 100644 --- a/tools/tracing/rtla/src/osnoise_top.c +++ b/tools/tracing/rtla/src/osnoise_top.c @@ -345,7 +345,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'}, - {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, {"period", required_argument, 0, 'p'}, {"quiet", no_argument, 0, 'q'}, @@ -366,7 +365,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:hH:p:qr:s:S:t::T:0:1:2:3:", + c =3D getopt_long(argc, argv, "a:hp:qr:s:S:t::T:0:1:2:3:", long_options, NULL); =20 /* Detect the end of the options. */ @@ -390,12 +389,6 @@ struct common_params *osnoise_top_parse_args(int argc,= char **argv) case '?': osnoise_top_usage(params); break; - case 'H': - params->common.hk_cpus =3D 1; - retval =3D parse_cpu_set(optarg, ¶ms->common.hk_cpu_set); - if (retval) - fatal("Error parsing house keeping CPUs"); - break; case 'p': params->period =3D get_llong_from_str(optarg); if (params->period > 10000000) diff --git a/tools/tracing/rtla/src/timerlat_hist.c b/tools/tracing/rtla/sr= c/timerlat_hist.c index e7ba083b5eb4..d1a6cf0c2e0d 100644 --- a/tools/tracing/rtla/src/timerlat_hist.c +++ b/tools/tracing/rtla/src/timerlat_hist.c @@ -797,7 +797,6 @@ static struct common_params {"auto", required_argument, 0, 'a'}, {"bucket-size", required_argument, 0, 'b'}, {"entries", required_argument, 0, 'E'}, - {"house-keeping", required_argument, 0, 'H'}, {"help", no_argument, 0, 'h'}, {"irq", required_argument, 0, 'i'}, {"nano", no_argument, 0, 'n'}, @@ -830,7 +829,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:b:E:hH:i:knp:s:t::T:uU0123456:7:8:9\1\2= :\3:", + c =3D getopt_long(argc, argv, "a:b:E:hi:knp:s:t::T:uU0123456:7:8:9\1\2:\= 3:", long_options, NULL); =20 /* detect the end of the options. */ @@ -869,12 +868,6 @@ static struct common_params case '?': timerlat_hist_usage(); break; - case 'H': - params->common.hk_cpus =3D 1; - retval =3D parse_cpu_set(optarg, ¶ms->common.hk_cpu_set); - if (retval) - fatal("Error parsing house keeping CPUs"); - break; case 'i': params->common.stop_us =3D get_llong_from_str(optarg); break; diff --git a/tools/tracing/rtla/src/timerlat_top.c b/tools/tracing/rtla/src= /timerlat_top.c index 8250bea4b2fd..12e3d8c6f850 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 static struct option long_options[] =3D { {"auto", required_argument, 0, 'a'}, {"help", no_argument, 0, 'h'}, - {"house-keeping", required_argument, 0, 'H'}, {"irq", required_argument, 0, 'i'}, {"nano", no_argument, 0, 'n'}, {"period", required_argument, 0, 'p'}, @@ -594,7 +593,7 @@ static struct common_params if (common_parse_options(argc, argv, ¶ms->common)) continue; =20 - c =3D getopt_long(argc, argv, "a:hH:i:knp:qs:t::T:uU0:1:2:345:6:7:", + c =3D getopt_long(argc, argv, "a:hi:knp:qs:t::T:uU0:1:2:345:6:7:", long_options, NULL); =20 /* detect the end of the options. */ @@ -635,12 +634,6 @@ static struct common_params case '?': timerlat_top_usage(); break; - case 'H': - params->common.hk_cpus =3D 1; - retval =3D parse_cpu_set(optarg, ¶ms->common.hk_cpu_set); - if (retval) - fatal("Error parsing house keeping CPUs"); - break; case 'i': params->common.stop_us =3D get_llong_from_str(optarg); break; --=20 2.51.1