Skip to content

Commit 03857d0

Browse files
committed
Reduce needless sleeps in collector/collect.sh
Before, the collector would sleep for 2 minutes after every collection, both if something was benchmarked and if nothing was benchmarked because the queue was empty. When the queue is not empty, it's wasteful to sleep for two minutes.
1 parent 0ce7707 commit 03857d0

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

collector/collect.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ while : ; do
2222
# Install measureme tooling
2323
cargo install --git https://github.com/rust-lang/measureme --branch stable flamegraph crox summarize
2424

25-
target/release/collector bench_next $SITE_URL --self-profile --bench-rustc --db $DATABASE;
26-
echo finished run at `date`;
27-
28-
# Wait a little bit before the next run starts.
29-
sleep 120
25+
target/release/collector bench_next $SITE_URL --self-profile --bench-rustc --db $DATABASE
26+
STATUS=$?
27+
echo finished run at `date` with exit code $STATUS
28+
29+
# Wait a bit if the command has failed.
30+
if [ $STATUS -ne 0 ]; then
31+
sleep 120
32+
fi
3033
done

collector/src/bin/collector.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,12 @@ fn main_result() -> anyhow::Result<i32> {
747747
c
748748
} else {
749749
println!("no artifact to benchmark");
750+
751+
// Sleep for a bit to avoid spamming the perf server too much
752+
// This sleep serves to remove a needless sleep in `collector/collect.sh` when
753+
// a benchmark was actually executed.
754+
std::thread::sleep(Duration::from_secs(60 * 2));
755+
750756
// no missing artifacts
751757
return Ok(0);
752758
};

0 commit comments

Comments
 (0)