Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions Cargo.lock

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

14 changes: 5 additions & 9 deletions splashsurf_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,12 @@ default-target = "x86_64-unknown-linux-gnu"
targets = []

# Ignore the tests (especially the test mesh files) for publishing
exclude = [
"tests/*",
"benches/*",
]
exclude = ["tests/*", "benches/*"]

[features]
default = []
vtk_extras = ["vtkio"]
profiling = ["lazy_static"]
profiling = []
io = ["vtk_extras", "vtkio", "ply-rs", "nom", "serde_json", "flate2"]

[dependencies]
Expand Down Expand Up @@ -60,13 +57,12 @@ flate2 = { version = "1.0", optional = true }
nom = { version = "7.1.3", optional = true }
serde_json = { version = "1.0", optional = true }

# Needed for profiling feature
lazy_static = { version = "1.4", optional = true }

[dev-dependencies]
criterion = "0.5.1"
ultraviolet = "0.9"
sdfu = { git = "https://github.com/w1th0utnam3/sdfu", features = ["ultraviolet"], rev = "e39a4a8685a56a3430218b9f2dfd546ab2dbe2d6" }
sdfu = { git = "https://github.com/w1th0utnam3/sdfu", features = [
"ultraviolet",
], rev = "e39a4a8685a56a3430218b9f2dfd546ab2dbe2d6" }

[[bench]]
name = "splashsurf_lib_benches"
Expand Down
13 changes: 6 additions & 7 deletions splashsurf_lib/src/profiling.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
//! Implementation details for the [`profile`](crate::profile) macro

use lazy_static::lazy_static;
use parking_lot::RwLock;
use std::collections::hash_map::RandomState;
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::hash::{BuildHasher, Hash};
use std::io;
use std::sync::LazyLock;
use std::time::{Duration, Instant};
use thread_local::ThreadLocal;

lazy_static! {
/// Thread local storage of the [`Profiler`](Profiler)s storing all [`Scope`](Scope)s of the thread
pub static ref PROFILER: ThreadLocal<RwLock<Profiler>> = ThreadLocal::new();
/// `RandomState` used to obtain `Hasher`s to hash [`ScopeId`](ScopeId)s for parent/child identification
pub static ref RANDOM_STATE: RandomState = RandomState::new();
}
/// Thread local storage of the [`Profiler`](Profiler)s storing all [`Scope`](Scope)s of the thread
pub static PROFILER: LazyLock<ThreadLocal<RwLock<Profiler>>> = LazyLock::new(ThreadLocal::new);

/// `RandomState` used to obtain `Hasher`s to hash [`ScopeId`](ScopeId)s for parent/child identification
pub static RANDOM_STATE: LazyLock<RandomState> = LazyLock::new(RandomState::new);

/// Implementation of the profile macro, use [`profile`](crate::profile) instead
#[doc(hidden)]
Expand Down