Skip to content

Commit

Permalink
introduce re_tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed May 31, 2023
1 parent 880aff0 commit 532f87b
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 11 deletions.
30 changes: 19 additions & 11 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ re_smart_channel = { path = "crates/re_smart_channel", version = "0.7.0-alpha.0"
re_string_interner = { path = "crates/re_string_interner", version = "0.7.0-alpha.0", default-features = false }
re_tensor_ops = { path = "crates/re_tensor_ops", version = "0.7.0-alpha.0", default-features = false }
re_time_panel = { path = "crates/re_time_panel", version = "=0.7.0-alpha.0", default-features = false }
re_tracing = { path = "crates/re_tracing", version = "0.7.0-alpha.0", default-features = false }
re_tuid = { path = "crates/re_tuid", version = "0.7.0-alpha.0", default-features = false }
re_ui = { path = "crates/re_ui", version = "0.7.0-alpha.0", default-features = false }
re_viewer = { path = "crates/re_viewer", version = "0.7.0-alpha.0", default-features = false }
Expand Down
21 changes: 21 additions & 0 deletions crates/re_tracing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "re_tracing"
authors.workspace = true
description = "Helpers for tracing/spans/flamegraphs and such."
edition.workspace = true
homepage.workspace = true
include.workspace = true
license.workspace = true
publish = true
readme = "README.md"
repository.workspace = true
rust-version.workspace = true
version.workspace = true


[package.metadata.docs.rs]
all-features = true


[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
puffin.workspace = true
10 changes: 10 additions & 0 deletions crates/re_tracing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# re_tracing

Part of the [`rerun`](https://github.com/rerun-io/rerun) family of crates.

[![Latest version](https://img.shields.io/crates/v/re_tracing.svg)](https://crates.io/crates/re_tracing)
[![Documentation](https://docs.rs/re_tracing/badge.svg)](https://docs.rs/re_tracing)
![MIT](https://img.shields.io/badge/license-MIT-blue.svg)
![Apache](https://img.shields.io/badge/license-Apache-blue.svg)

Helpers for tracing/spans/flamegraphs and such.
23 changes: 23 additions & 0 deletions crates/re_tracing/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//! Helpers for tracing/spans/flamegraphs and such.

pub mod reexports {
pub use puffin;
}

/// Wrapper around puffin profiler on native, no-op on wasm.
#[macro_export]
macro_rules! profile_function {
($($arg: tt)*) => {
#[cfg(not(target_arch = "wasm32"))]
$crate::reexports::puffin::profile_function!($($arg)*);
};
}

/// Wrapper around puffin profiler on native, no-op on wasm.
#[macro_export]
macro_rules! profile_scope {
($($arg: tt)*) => {
#[cfg(not(target_arch = "wasm32"))]
$crate::reexports::puffin::profile_scope!($($arg)*);
};
}

0 comments on commit 532f87b

Please sign in to comment.