Skip to content

Commit f571dfe

Browse files
author
Ariel Ben-Yehuda
committed
ci: use async-profiler from upstream
the original example code didn't call `handle.stop`, which led to a race between shutdown and async-profiler pushing the new JFR. In upstream async-profiler, the race was often lost.
1 parent b993ac4 commit f571dfe

File tree

2 files changed

+8
-24
lines changed

2 files changed

+8
-24
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,27 +69,10 @@ jobs:
6969
with:
7070
name: pollcatch-decoder
7171
path: ./decoder/target/debug/pollcatch-decoder
72-
build-async-profiler:
73-
name: Build async-profiler
74-
runs-on: ubuntu-latest
75-
steps:
76-
- name: Checkout
77-
uses: actions/checkout@v4
78-
- name: Install async-profiler Dependencies
79-
run: sudo apt-get update && sudo apt-get install -y sudo libicu-dev patchelf curl make g++ openjdk-11-jdk-headless gcovr
80-
- name: Build async-profiler
81-
working-directory: tests
82-
shell: bash
83-
run: ./build-async-profiler.sh
84-
- name: Upload artifact
85-
uses: actions/upload-artifact@v4
86-
with:
87-
name: libasyncProfiler
88-
path: ./tests/async-profiler/build/lib/libasyncProfiler.so
8972
test:
9073
name: Integration Test
9174
runs-on: ubuntu-latest
92-
needs: [build-for-testing, build-decoder, build-async-profiler]
75+
needs: [build-for-testing, build-decoder]
9376
steps:
9477
- uses: actions/checkout@v4
9578
- name: Download pollcatch-decoder
@@ -102,11 +85,10 @@ jobs:
10285
with:
10386
name: example-simple
10487
path: ./tests
105-
- name: Download libasyncProfiler
106-
uses: actions/download-artifact@v4
107-
with:
108-
name: libasyncProfiler
109-
path: ./tests
88+
- name: Download async-profiler
89+
shell: bash
90+
working-directory: tests
91+
run: wget https://github.com/async-profiler/async-profiler/releases/download/v4.1/async-profiler-4.1-linux-x64.tar.gz -O async-profiler.tar.gz && tar xvf async-profiler.tar.gz && mv -vf async-profiler-*/lib/libasyncProfiler.so .
11092
- name: Run integration test
11193
shell: bash
11294
working-directory: tests

examples/simple/main.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ async fn main_internal(args: Args) -> Result<(), anyhow::Error> {
134134
.build();
135135

136136
tracing::info!("starting profiler");
137-
profiler.spawn()?;
137+
let handle = profiler.spawn_controllable()?;
138138
tracing::info!("profiler started");
139139

140140
if let Some(timeout) = args.duration {
@@ -145,5 +145,7 @@ async fn main_internal(args: Args) -> Result<(), anyhow::Error> {
145145
slow::run().await;
146146
}
147147

148+
handle.stop().await;
149+
148150
Ok(())
149151
}

0 commit comments

Comments
 (0)