Skip to content

Commit

Permalink
Replace hawktracer with tracing-chrome
Browse files Browse the repository at this point in the history
  • Loading branch information
lu-zero committed Nov 16, 2023
1 parent e3d511e commit 1a77439
Show file tree
Hide file tree
Showing 22 changed files with 247 additions and 149 deletions.
175 changes: 139 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ desync_finder = ["backtrace"]
bench = []
check_asm = []
capi = ["scan_fmt"]
tracing = ["rust_hawktracer/profiling_enabled", "rust_hawktracer/pkg_config"]
tracing = [
"profiling/profile-with-tracing",
"tracing-subscriber",
"tracing-chrome",
"dep:tracing"
]
scenechange = []
serialize = ["serde", "toml", "v_frame/serialize", "serde-big-array"]
wasm = ["wasm-bindgen"]
Expand Down Expand Up @@ -102,12 +107,15 @@ fern = { version = "0.6", optional = true }
itertools = "0.11"
simd_helpers = "0.1"
wasm-bindgen = { version = "0.2.88", optional = true }
rust_hawktracer = "0.7.0"
nom = { version = "7.1.3", optional = true }
new_debug_unreachable = "1.0.4"
once_cell = "1.18.0"
av1-grain = { version = "0.2.2", features = ["serialize"] }
serde-big-array = { version = "0.5.1", optional = true }
profiling = { version = "1" }
tracing-subscriber = { version = "0.3.18", optional = true }
tracing-chrome = { version = "0.7.1", optional = true }
tracing = { version = "0.1.40", optional = true }

[dependencies.image]
version = "0.24.7"
Expand Down
20 changes: 8 additions & 12 deletions doc/PROFILING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
- [Instruments](#instruments)
- [Generic profiling](#generic-profiling)
- [Perf](#perf)
- [Instrumented profiling](#instrumented-profiling)
- [uftrace](#uftrace)
- [Tracing](#tracing)
- [Hawktracer](#hawktracer)
- [tracing](#tracing)
- [Codegen Inspection](#codegen-inspection)
- [Assembly](#assembly)
</details>
Expand Down Expand Up @@ -54,6 +54,8 @@ $ perf record --call-graph dwarf target/release/rav1e ~/sample.y4m -o /dev/null
$ perf report
```

## Instrumented profiling

### uftrace

[uftrace](https://github.com/namhyung/uftrace) is an ELF-specific tracer.
Expand All @@ -65,17 +67,11 @@ $ uftrace record --no-libcall -D 5 target/release/rav1e ~/sample.y4m -o /dev/nul
$ uftrace report
```

## Tracing

### Hawktracer

We use [rust\_hawktracer](https://github.com/AlexEne/rust_hawktracer) to
measure specific codepath timings. Building `--features=tracing` enables it.
Use the standard [hawktrace-convert](https://hawktracer.org) to produce graphs.
### tracing

Currently there are issues where rust_hawktracer fails to build, as a result
we have set it to use the system hawktracer library. On Arch Linux this may
be installed from the AUR package hawktracer-git.
We use [profiling](https://crates.io/crates/profiling) to measure specific
codepath timings. Building `--features=tracing` enables it using the
[tracing](https://crates.io/crates/tracing) backend.

## Codegen Inspection

Expand Down
5 changes: 2 additions & 3 deletions src/activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ use crate::rdo::DistortionScale;
use crate::tiling::*;
use crate::util::*;
use itertools::izip;
use rust_hawktracer::*;

#[derive(Debug, Default, Clone)]
pub struct ActivityMask {
variances: Box<[u32]>,
}

impl ActivityMask {
#[hawktracer(ActivityMask_from_plane)]
#[profiling::function]
pub fn from_plane<T: Pixel>(luma_plane: &Plane<T>) -> ActivityMask {
let PlaneConfig { width, height, .. } = luma_plane.cfg;

Expand Down Expand Up @@ -55,7 +54,7 @@ impl ActivityMask {
ActivityMask { variances: variances.into_boxed_slice() }
}

#[hawktracer(ActivityMask_fill_scales)]
#[profiling::function]
pub fn fill_scales(
&self, bit_depth: usize, activity_scales: &mut Box<[DistortionScale]>,
) {
Expand Down
Loading

0 comments on commit 1a77439

Please sign in to comment.