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
3 changes: 0 additions & 3 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion puffin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ web = ["dep:js-sys", "dep:web-time"]
byteorder = { version = "1.0" }
cfg-if = "1.0"
itertools = "0.10"
once_cell = "1.0"
parking_lot = { version = "0.12"}

# Optional:
Expand Down
11 changes: 6 additions & 5 deletions puffin/src/global_profiler.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{collections::BTreeMap, sync::Arc};

use once_cell::sync::Lazy;
use std::{
collections::BTreeMap,
sync::{Arc, LazyLock},
};

use crate::{
Error, FrameData, FrameIndex, FrameSinkId, ScopeCollection, ScopeDetails, ScopeId, StreamInfo,
Expand Down Expand Up @@ -44,8 +45,8 @@ impl Default for GlobalProfiler {
impl GlobalProfiler {
/// Access to the global profiler singleton.
pub fn lock() -> parking_lot::MutexGuard<'static, Self> {
static GLOBAL_PROFILER: Lazy<parking_lot::Mutex<GlobalProfiler>> =
Lazy::new(Default::default);
static GLOBAL_PROFILER: LazyLock<parking_lot::Mutex<GlobalProfiler>> =
LazyLock::new(Default::default);
GLOBAL_PROFILER.lock()
}

Expand Down
5 changes: 3 additions & 2 deletions puffin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,14 @@ pub fn now_ns() -> NanoSecond {

// This can maybe be optimized

use std::sync::LazyLock;
#[cfg(not(target_arch = "wasm32"))]
use std::time::Instant;
#[cfg(target_arch = "wasm32")]
use web_time::Instant;

static START_TIME: once_cell::sync::Lazy<(NanoSecond, Instant)> =
once_cell::sync::Lazy::new(|| (nanos_since_epoch(), Instant::now()));
static START_TIME: LazyLock<(NanoSecond, Instant)> =
LazyLock::new(|| (nanos_since_epoch(), Instant::now()));
START_TIME.0 + START_TIME.1.elapsed().as_nanos() as NanoSecond
}

Expand Down
1 change: 0 additions & 1 deletion puffin_egui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ indexmap = { version = "2.1.0", features = ["serde"] }
log = "0.4"
log-once = "0.4"
natord = "1.0.9"
once_cell = "1.7"
parking_lot = "0.12"
puffin = { version = "0.19.1", path = "../puffin", features = ["packing"] }
serde = { version = "1.0", features = ["derive"], optional = true }
Expand Down
4 changes: 2 additions & 2 deletions puffin_egui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ pub fn profiler_window(ctx: &egui::Context) -> bool {
open
}

static PROFILE_UI: once_cell::sync::Lazy<parking_lot::Mutex<GlobalProfilerUi>> =
once_cell::sync::Lazy::new(Default::default);
static PROFILE_UI: std::sync::LazyLock<parking_lot::Mutex<GlobalProfilerUi>> =
std::sync::LazyLock::new(Default::default);

/// Show the profiler.
///
Expand Down
1 change: 0 additions & 1 deletion puffin_http/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ puffin = { version = "0.19.1", path = "../puffin", features = [
[dev-dependencies]
simple_logger = "4.2"
paste = "1.0.15"
once_cell = "1.19.0"
6 changes: 3 additions & 3 deletions puffin_http/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ impl Server {
/// }
///
/// #[doc = concat!("The instance of the ", std::stringify!([< $name:lower >]), " thread profiler's server")]
/// pub static [< $name:upper _PROFILER_SERVER >] : once_cell::sync::Lazy<std::sync::Mutex<puffin_http::Server>>
/// = once_cell::sync::Lazy::new(|| {
/// pub static [< $name:upper _PROFILER_SERVER >] : std::sync::LazyLock<std::sync::Mutex<puffin_http::Server>>
/// = std::sync::LazyLock::new(|| {
/// eprintln!(
/// "starting puffin_http server for {} profiler at {}",
/// std::stringify!([<$name:lower>]),
Expand All @@ -182,7 +182,7 @@ impl Server {
///
/// #[doc = concat!("Accessor for the ", std::stringify!([< $name:lower >]), " thread reporter")]
/// pub fn [< $name:lower _profiler_lock >]() -> std::sync::MutexGuard<'static, puffin::GlobalProfiler> {
/// static [< $name _PROFILER >] : once_cell::sync::Lazy<std::sync::Mutex<puffin::GlobalProfiler>> = once_cell::sync::Lazy::new(Default::default);
/// static [< $name _PROFILER >] : std::sync::LazyLock<std::sync::Mutex<puffin::GlobalProfiler>> = std::sync::LazyLock::new(Default::default);
/// [< $name _PROFILER >].lock().expect("poisoned std::sync::mutex")
/// }
///
Expand Down
Loading