From nobody Wed Nov 27 06:30:26 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9CC951448C5; Fri, 11 Oct 2024 14:39:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728657564; cv=none; b=A8XiKPsxYlm4wik66DF+QSNOuU0MZj6QxvNb53JmYX5sCt4G2Q9DpISYn5kvXcSjrvj19IgjWmFoZUYnuWPMD8ZZx7lk4Iloalg9dXaaqfDkDmpmIIMsfVaANvDFuZGAYFoNXMtcP8z9TQ5mA/o6s13rikYukqiH4Vhf2Hwfo9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728657564; c=relaxed/simple; bh=HyPQqIrYRFgt5XqFmmijbWcVkh1OJkkmK7bDD2qKDn4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HFb1FXmVYdZvb5UfTycRtBfDnBJlVKrYf7v8MLzVF8ySPCwoAf6Ahee6Cusw5NiI9ndwPNFOdyRTx+0lYJFatMY9X2vCUNa6pXZTa2hIaH0fjWKkqcrbzNv4CwxIDFhbGZXtvu4fMCqvpj/dkJiP9RJcBM2UoxLjCXEuDDKdPkA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f3aW+t14; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="f3aW+t14" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ABEBC4CECE; Fri, 11 Oct 2024 14:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728657564; bh=HyPQqIrYRFgt5XqFmmijbWcVkh1OJkkmK7bDD2qKDn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f3aW+t14ZO9nprJoiUdCADdZT/wUYKI7XO72GEgeH5QmsqIfDW7uDzhQUWHlcHfYJ VJYkj1GQSA5SIWXAzUoWnzfEjRbH9813wAQcuv3S/SMSNROEmhc0ADQHq2K0n4Eh9n Brnx8M8765PK50V2y4Qu+KPrRX+NUUbP9OSFY2n02gEbXM4l8VrY2lAgHtMwqGr5Xl qH5QyAqBCWCgxzgt5OfZ6ufHKxiINx/GrutJRxu78XNhmsFHNOZMtdsVUBzm8WJo8p kSgI/Bw8XOk/U+cSRSLGvjFIYLgzpPkTQbIZVMcZgYKuPoXct3Et2etFjP0tsA1/aq nT2CpSm0XwAOw== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 1/3] perf test: Introduce workloads__for_each() Date: Fri, 11 Oct 2024 11:39:04 -0300 Message-ID: <20241011143906.1285675-2-acme@kernel.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241011143906.1285675-1-acme@kernel.org> References: <20241011143906.1285675-1-acme@kernel.org> 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" From: Arnaldo Carvalho de Melo And use it in run_workload(). Testing it: root@x1:~# perf trace -e *landlock* perf test -w landlock 0.000 ( 0.015 ms): :1274331/1274331 landlock_add_rule(ruleset_fd: 11= , rule_type: LANDLOCK_RULE_PATH_BENEATH, rule_attr: 0x7ffd3fea55e0, flags: = 45) =3D -1 EINVAL (Invalid argument) 0.018 ( 0.003 ms): :1274331/1274331 landlock_add_rule(ruleset_fd: 11= , rule_type: LANDLOCK_RULE_NET_PORT, rule_attr: 0x7ffd3fea55f0, flags: 45) = =3D -1 EINVAL (Invalid argument) root@x1:~# perf test -w bla No workload found: bla root@x1:~# Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/builtin-test.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-tes= t.c index 470a9709427ddaad..2201f7ed432ce9f2 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -155,6 +155,9 @@ static struct test_workload *workloads[] =3D { &workload__landlock, }; =20 +#define workloads__for_each(workload) \ + for (unsigned i =3D 0; i < ARRAY_SIZE(workloads) && ({ workload =3D workl= oads[i]; 1; }); i++) + static int num_subtests(const struct test_suite *t) { int num; @@ -504,11 +507,9 @@ static int perf_test__list(int argc, const char **argv) =20 static int run_workload(const char *work, int argc, const char **argv) { - unsigned int i =3D 0; struct test_workload *twl; =20 - for (i =3D 0; i < ARRAY_SIZE(workloads); i++) { - twl =3D workloads[i]; + workloads__for_each(twl) { if (!strcmp(twl->name, work)) return twl->func(argc, argv); } --=20 2.47.0 From nobody Wed Nov 27 06:30:26 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5203B194A66; Fri, 11 Oct 2024 14:39:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728657569; cv=none; b=rhMkOtlv8vmsWtHB9aANKkprUF+n9j7uam/HrF3FuCqWBgk5wijnSlCW4iaNubAsiE8jS7KPpIG66FoFFIor1FF117TZNQlTMQWKYsVMnNbAcV5jEGBfHR5YYSU3n5IMJmwvrYlhN0kOBVzZGg/aWPjeg3TFUjtyGCX+vRrVZI4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728657569; c=relaxed/simple; bh=M0bxNF/7gQO27/WxyyVyqteQfl7qRroKTDHq6/ghdmQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=myAWIG3+KDEriruF/WtT7OauPvWSz5EkIgfS4Rabu93T5qZ4/DVR8dQKSdfdq7IWlMbRL+XHIssTgGEhnlDbQzgQBh+j38xcXSyGyzAACTDLDHw4tBuhaRTP5HSc/15FwIG4vKbg+uJ7pktzvuqn2WyKeVGspxGkSC+W15nOcaU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GZ/iVVcm; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GZ/iVVcm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0BB96C4CEC3; Fri, 11 Oct 2024 14:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728657568; bh=M0bxNF/7gQO27/WxyyVyqteQfl7qRroKTDHq6/ghdmQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GZ/iVVcmZvQxtQW1EGXKQSwTPgrjx+u0budEo9MEEu0g6dcaycGuGNwIg42beXlkT /+m2zmHyYO4/AYxjXKASjEhgb5xvqwQcaJo8RjogQTgkNt35LLOrXGwWpnYsRSu00T DBtgQrOi5y0xtGlGuWCz0wbb2yzcGYgCxw1o0XU4rOebbfaG0njdXjkct6nR01CDsS frZMYoll5qE6TH864XrhYvVS0Z4IvMV+RGd2JzD4vQWIdLPb6vsVQNG6keYfVgm2Ce 7aOztJqjrU7qqu7ZljzrJRflPgEtPLNDHlcZSLRzhoaNIuLsQfgEQ7lfu/6F9E+w9H onpR0swtIKhmg== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 2/3] perf test: Introduce '-w --list' to list the available workloads Date: Fri, 11 Oct 2024 11:39:05 -0300 Message-ID: <20241011143906.1285675-3-acme@kernel.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241011143906.1285675-1-acme@kernel.org> References: <20241011143906.1285675-1-acme@kernel.org> 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" From: Arnaldo Carvalho de Melo Using it: $ perf test -w noplop No workload found: noplop $ $ perf test -w Error: switch `w' requires a value Usage: perf test [] [{list |[|]}] -w, --workload workload to run for testing, use '-w --list' to= list the available ones. $ $ perf test -w --list noploop thloop leafloop sqrtloop brstack datasym landlock $ Would be good at some point to have a description in 'struct test_workload'. Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/tests/builtin-test.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-tes= t.c index 2201f7ed432ce9f2..f0d10d2dd0d40019 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -505,10 +505,26 @@ static int perf_test__list(int argc, const char **arg= v) return 0; } =20 +static int workloads__fprintf_list(FILE *fp) +{ + struct test_workload *twl; + int printed =3D 0; + + workloads__for_each(twl) + printed +=3D fprintf(fp, "%s\n", twl->name); + + return printed; +} + static int run_workload(const char *work, int argc, const char **argv) { struct test_workload *twl; =20 + if (!strcmp(work, "--list")) { + workloads__fprintf_list(stdout); + return 0; + } + workloads__for_each(twl) { if (!strcmp(twl->name, work)) return twl->func(argc, argv); @@ -544,7 +560,7 @@ int cmd_test(int argc, const char **argv) OPT_BOOLEAN('p', "parallel", ¶llel, "Run the tests in parallel"), OPT_BOOLEAN('S', "sequential", &sequential, "Run the tests one after another rather than in parallel"), - OPT_STRING('w', "workload", &workload, "work", "workload to run for testi= ng"), + OPT_STRING('w', "workload", &workload, "work", "workload to run for testi= ng, use '-w --list' to list the available ones."), OPT_STRING(0, "dso", &dso_to_test, "dso", "dso to test"), OPT_STRING(0, "objdump", &test_objdump_path, "path", "objdump binary to use for disassembly and annotations"), --=20 2.47.0 From nobody Wed Nov 27 06:30:26 2024 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9AB48194C8F; Fri, 11 Oct 2024 14:39:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728657573; cv=none; b=Wp3oY1KmMQSdlNJRcqR5xPCyoaxZS9JoN6UvOpQvHwy3pq5O30CDltS0rIYZWvG2zof1vcWqjulHaW89JprHBNkGZT0v/DsQl1aqamPyQsLsM0TtzX/Y+HZ8n8tk4JzRBZQXvMiN46EL7swVvV3wnjYGkUPuGzt7AVrwdpQbe0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728657573; c=relaxed/simple; bh=8tSTm2TVIpuR+nPouNS+bDuyIwnTzkRZZjoUPOHgQw8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NBBwE4yAJcnvFS70ecc9UkFh3RcS888AjSqMDBYYktusCDr7ZlSMc8do74hIcyjeVNNSO+gJ1FKhr4cAnplwRWNiKEKW8QiSlsuQbnfrjlCxKA7uBoPojJDfOeDSImU5VPQ/BlQhBNNMjQTEbCMs1n3uCX4N4DP/azeugZqQLUM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=j30VXZZV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="j30VXZZV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6398AC4CECE; Fri, 11 Oct 2024 14:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1728657573; bh=8tSTm2TVIpuR+nPouNS+bDuyIwnTzkRZZjoUPOHgQw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j30VXZZVc6DIUj5UpwYkgFRRIn5zNdZpVkw3nXjfcDAixd1QDZIy7e2K8oXa2q/CN Us67atlCU8/5ZzYxKMLosuzhVAjrXLfh7nsIu4PTPwxT3u5Qgo782ixaRS1jBHB9/N glTZHBxmxhQWc+h9a+x8C2h4Hx1uBChefXlgm5dYDR6304GXGfMBEwAWadoGDVWSvG L2XGtL/PvRKAC9zsVYWkEHnoQ1XSIAKtEcVPi6Ph1/YiH/RbbGYVZR3KUdtmmCQ0rB RPd92Uj85Lm5662nDzW01G8iiIYbqG4aLK+Oo34m/CHXffRIHARsYkUGYJavUQQD82 pIdhtfX7VuyVA== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Clark Williams , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo Subject: [PATCH 3/3] perf test: Document the -w/--workload option Date: Fri, 11 Oct 2024 11:39:06 -0300 Message-ID: <20241011143906.1285675-4-acme@kernel.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241011143906.1285675-1-acme@kernel.org> References: <20241011143906.1285675-1-acme@kernel.org> 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" From: Arnaldo Carvalho de Melo Wasn't documented so far, mention that it is mostly used in the shell regression tests. Cc: Adrian Hunter Cc: Ian Rogers Cc: Jiri Olsa Cc: Kan Liang Cc: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/Documentation/perf-test.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/perf/Documentation/perf-test.txt b/tools/perf/Documentat= ion/perf-test.txt index 9acb8d1f658890e9..e03c1cabdcd37594 100644 --- a/tools/perf/Documentation/perf-test.txt +++ b/tools/perf/Documentation/perf-test.txt @@ -48,3 +48,9 @@ OPTIONS =20 --dso:: Specify a DSO for the "Symbols" test. + +-w:: +--workload=3D:: + Run a built-in workload, to list them use '-w --list', current ones inclu= de: + noploop, thloop, leafloop, sqrtloop, brstack, datasym and landlock. + Used with the shell script regression tests. --=20 2.47.0