From 8fa1ba34465efc46ebb6c7e3b9744997325f6c52 Mon Sep 17 00:00:00 2001 From: "Gubrud, Aaron D" Date: Fri, 21 Aug 2026 16:13:33 -0700 Subject: [PATCH 1/6] fix asprof issue --- internal/script/scripts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/script/scripts.go b/internal/script/scripts.go index c856c524..036819f7 100644 --- a/internal/script/scripts.go +++ b/internal/script/scripts.go @@ -1879,7 +1879,7 @@ stop_profiling() { # stop async-profiler for pid in "${java_pids[@]}"; do # this call is synchronous and will wait until the profile is written to file before returning - async-profiler/bin/asprof stop -o collapsed -f ap_folded_"$pid" "$pid" + async-profiler/bin/asprof stop "${asprof_arguments[@]}" -o collapsed "$pid" | tee ap_folded_"$pid" done # wait for perf processes to finish and exit if [ -n "$perf_fp_pid" ]; then From b6be904c233ce17b1b91de9be5380334321c8935 Mon Sep 17 00:00:00 2001 From: "Gubrud, Aaron D" Date: Mon, 24 Aug 2026 12:54:14 -0700 Subject: [PATCH 2/6] trying readme adjustments --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 18c1c7f6..4a8d5c08 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,12 @@ Software flamegraphs are useful in diagnosing software performance bottlenecks. > [!TIP] > By default, flamegraphs are collected using the `cycles:P` event. To analyze different performance aspects, use the `--perf-event` flag to specify an alternative perf event (e.g., `cache-misses`, `instructions`, `branches`, `context-switches`, `mem-loads`, `mem-stores`, etc.). +> [!TIP] +> It's possible to use asprof to profile a Java workload within a Docker container, but it's first necessary to copy the asprof .so library into each container where Java profiling is to happen. To do this: +> 1. Extract PerfSpect's embedded resources with `perfspect extract --output resources` +> 2. For each container you would like to profile Java code: `docker cp resources/${ARCH}/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/dest/path/` +> 3. When running PerfSpect flamegraph, add this flag: `--asprof-args "--libpath /dest/path/libasyncProfiler.so"` +> e.g. `docker cp resources/x86_64/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/tmp/ && ./perfspect flamegraph --asprof-args "--libpath /tmp/libasyncProfiler.so" ![screenshot of a flamegraph from the HTML output of the flamegraph command](docs/images/flamegraph.png) From a572151e3b1b952101c48d5f13254954b6d870ee Mon Sep 17 00:00:00 2001 From: "Gubrud, Aaron D" Date: Mon, 24 Aug 2026 12:55:05 -0700 Subject: [PATCH 3/6] formatting --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 4a8d5c08..bc139d74 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,7 @@ Software flamegraphs are useful in diagnosing software performance bottlenecks. > [!TIP] > By default, flamegraphs are collected using the `cycles:P` event. To analyze different performance aspects, use the `--perf-event` flag to specify an alternative perf event (e.g., `cache-misses`, `instructions`, `branches`, `context-switches`, `mem-loads`, `mem-stores`, etc.). + > [!TIP] > It's possible to use asprof to profile a Java workload within a Docker container, but it's first necessary to copy the asprof .so library into each container where Java profiling is to happen. To do this: > 1. Extract PerfSpect's embedded resources with `perfspect extract --output resources` From 0d9db376cd011173af74388a00215c0556635b89 Mon Sep 17 00:00:00 2001 From: "Gubrud, Aaron D" Date: Mon, 24 Aug 2026 12:56:51 -0700 Subject: [PATCH 4/6] formatting pt 2 --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bc139d74..79d8129e 100644 --- a/README.md +++ b/README.md @@ -159,10 +159,11 @@ Software flamegraphs are useful in diagnosing software performance bottlenecks. > By default, flamegraphs are collected using the `cycles:P` event. To analyze different performance aspects, use the `--perf-event` flag to specify an alternative perf event (e.g., `cache-misses`, `instructions`, `branches`, `context-switches`, `mem-loads`, `mem-stores`, etc.). > [!TIP] -> It's possible to use asprof to profile a Java workload within a Docker container, but it's first necessary to copy the asprof .so library into each container where Java profiling is to happen. To do this: +> It's possible to use PerfSpect to extract a flamegraph of a Java workload within a Docker container, but it's first necessary to copy the async profiler library into each container where Java profiling is to happen. To do this: > 1. Extract PerfSpect's embedded resources with `perfspect extract --output resources` > 2. For each container you would like to profile Java code: `docker cp resources/${ARCH}/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/dest/path/` > 3. When running PerfSpect flamegraph, add this flag: `--asprof-args "--libpath /dest/path/libasyncProfiler.so"` +> > e.g. `docker cp resources/x86_64/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/tmp/ && ./perfspect flamegraph --asprof-args "--libpath /tmp/libasyncProfiler.so" ![screenshot of a flamegraph from the HTML output of the flamegraph command](docs/images/flamegraph.png) From c764749c5f66e0ddcfec96e72818763fe8741859 Mon Sep 17 00:00:00 2001 From: "Gubrud, Aaron D" Date: Mon, 24 Aug 2026 12:57:28 -0700 Subject: [PATCH 5/6] formatting pt 3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 79d8129e..8c43ece7 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ Software flamegraphs are useful in diagnosing software performance bottlenecks. > 2. For each container you would like to profile Java code: `docker cp resources/${ARCH}/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/dest/path/` > 3. When running PerfSpect flamegraph, add this flag: `--asprof-args "--libpath /dest/path/libasyncProfiler.so"` > -> e.g. `docker cp resources/x86_64/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/tmp/ && ./perfspect flamegraph --asprof-args "--libpath /tmp/libasyncProfiler.so" +> e.g. `docker cp resources/x86_64/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/tmp/ && ./perfspect flamegraph --asprof-args "--libpath /tmp/libasyncProfiler.so"` ![screenshot of a flamegraph from the HTML output of the flamegraph command](docs/images/flamegraph.png) From fca9e29df6adc71d26c89b38cab82a89d9495391 Mon Sep 17 00:00:00 2001 From: "Gubrud, Aaron D" Date: Mon, 24 Aug 2026 13:04:11 -0700 Subject: [PATCH 6/6] extra notes and formatting --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8c43ece7..30915457 100644 --- a/README.md +++ b/README.md @@ -160,11 +160,13 @@ Software flamegraphs are useful in diagnosing software performance bottlenecks. > [!TIP] > It's possible to use PerfSpect to extract a flamegraph of a Java workload within a Docker container, but it's first necessary to copy the async profiler library into each container where Java profiling is to happen. To do this: -> 1. Extract PerfSpect's embedded resources with `perfspect extract --output resources` +> 1. Extract PerfSpect's embedded resources with `./perfspect extract --output resources` > 2. For each container you would like to profile Java code: `docker cp resources/${ARCH}/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/dest/path/` > 3. When running PerfSpect flamegraph, add this flag: `--asprof-args "--libpath /dest/path/libasyncProfiler.so"` > -> e.g. `docker cp resources/x86_64/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/tmp/ && ./perfspect flamegraph --asprof-args "--libpath /tmp/libasyncProfiler.so"` +> e.g. `./perfspect extract --output resources && docker cp resources/x86_64/async-profiler/lib/libasyncProfiler.so ${CONT_NAME}:/tmp/ && ./perfspect flamegraph --asprof-args "--libpath /tmp/libasyncProfiler.so"` +> +> Note that if PerfSpect is being run remotely, then the async profiler library will need to be copied to the test system and then into the test system's containers. ![screenshot of a flamegraph from the HTML output of the flamegraph command](docs/images/flamegraph.png)