#macro #hitrace #trace #instrumenting #spans #hi-trace #convienience

macro hitrace-macro

Convienience macros for instrumenting code with hitrace

1 unstable release

0.1.0 Apr 19, 2024

#1417 in Procedural macros

Apache-2.0

3KB

HiTrace

Safe bindings for the HiTrace tracing system on OpenHarmony. This crate does nothing if not compiled for OpenHarmony (target_env = ohos).

Development

Contributions are welcome.

License

This project is licensed under the Apache-2.0 license, matching the license of OpenHarmony. See LICENSE for details.


lib.rs:

Convenience macro to instrument a function as a HiTrace span

The macro will automatically start a span when the function is entered, and close the span when the function is left.

Examples

Cargo.toml:

[dependencies]
hitrace = "0.1"
hitrace-macro = "0.1"
use hitrace_macro::trace_fn;
#[trace_fn]
fn do_something_and_measure() {
    println!("Doing something expensive....")
}

Dependencies

~205–640KB
~15K SLoC