perf test workload: Add code_with_type test workload
authorDmitrii Dolgov <9erthalion6@gmail.com>
Sun, 8 Feb 2026 12:22:24 +0000 (13:22 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sun, 8 Feb 2026 22:16:24 +0000 (19:16 -0300)
commit2e05bb52a12d3cdb81f3b6f5de5cb3905d383552
tree38b851124b1bc6fca2c918aa2446b239a47036d2
parent6a32fa5ccd33da5d187ec6e78f3b45683399ab66
perf test workload: Add code_with_type test workload

The purpose of the workload is to gather samples of rust runtime. To
achieve that it has a dummy rust library linked with it.

Per recommendations for such scenarios [1], the rust library is
statically linked.

An example:

$ perf record perf test -w code_with_type
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.160 MB perf.data (4074 samples) ]

$ perf report --stdio --dso perf -s srcfile,srcline
    45.16%  ub_checks.rs       ub_checks.rs:72
     6.72%  code_with_type.rs  code_with_type.rs:15
     6.64%  range.rs           range.rs:767
     4.26%  code_with_type.rs  code_with_type.rs:21
     4.23%  range.rs           range.rs:0
     3.99%  code_with_type.rs  code_with_type.rs:16
    [...]

[1]: https://doc.rust-lang.org/reference/linkage.html#mixed-rust-and-foreign-codebases

Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/build/Makefile.build
tools/perf/Makefile.perf
tools/perf/tests/builtin-test.c
tools/perf/tests/tests.h
tools/perf/tests/workloads/Build
tools/perf/tests/workloads/code_with_type.c [new file with mode: 0644]
tools/perf/tests/workloads/code_with_type.rs [new file with mode: 0644]
tools/scripts/Makefile.include