-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Benchmark common tracing operations (spans, events)
As documented in the `Tracy` manual, unsurprisingly, gathering stack frames takes a long time. These changes effectively just add some benchmarks to demonstrate that, as well as the overhead of the tracing-tracy implementation.
- Loading branch information
Showing
6 changed files
with
121 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
use criterion::{criterion_group, criterion_main, Criterion}; | ||
use tracy_client::Client; | ||
|
||
fn client_start(c: &mut Criterion) { | ||
let mut clients = Vec::<Client>::with_capacity(1_000_000_000); | ||
c.bench_function("start", |b| b.iter(|| clients.push(Client::start()))); | ||
} | ||
|
||
fn client_clone(c: &mut Criterion) { | ||
let mut clients = Vec::<Client>::with_capacity(1_000_000_000); | ||
let client = Client::start(); | ||
c.bench_function("clone", |b| b.iter(|| clients.push(client.clone()))); | ||
} | ||
|
||
fn client_running(c: &mut Criterion) { | ||
let _client = Client::start(); | ||
c.bench_function("running", |b| b.iter(|| Client::running())); | ||
} | ||
|
||
fn ops_alloc(c: &mut Criterion) { | ||
let _client = tracy_client::Client::start(); | ||
c.bench_function("span_alloc_callstack/0", |bencher| { | ||
bencher.iter(|| { | ||
Client::running() | ||
.unwrap() | ||
.span_alloc("hello", "function", "file", 42, 0); | ||
}); | ||
}); | ||
c.bench_function("span_alloc_callstack/100", |bencher| { | ||
bencher.iter(|| { | ||
Client::running() | ||
.unwrap() | ||
.span_alloc("hello", "function", "file", 42, 100); | ||
}); | ||
}); | ||
} | ||
|
||
fn ops_static(c: &mut Criterion) { | ||
let client = tracy_client::Client::start(); | ||
c.bench_function("span_callstack/0", |bencher| { | ||
bencher.iter(|| { | ||
tracy_client::span!("some_name", 0); | ||
}); | ||
}); | ||
c.bench_function("span_callstack/100", |bencher| { | ||
bencher.iter(|| { | ||
tracy_client::span!("some_name", 100); | ||
}); | ||
}); | ||
} | ||
|
||
criterion_group!( | ||
benches, | ||
client_start, | ||
client_clone, | ||
client_running, | ||
ops_alloc, | ||
ops_static | ||
); | ||
criterion_main!(benches); |
This file was deleted.
Oops, something went wrong.