diff options
| author | Mica White <botahamec@outlook.com> | 2024-10-07 20:45:14 -0400 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2024-10-07 20:45:14 -0400 |
| commit | ea5db5846bc700f0da912225ddcb4be372359044 (patch) | |
| tree | f478f7a1e9e3fbb6ca162ea51c5c626ceb3898c2 /profiler/src/lib.rs | |
| parent | 509e5ce1e17417a70b9bcce8bc6e33c05106811d (diff) | |
Finish basic windowing stuff
Diffstat (limited to 'profiler/src/lib.rs')
| -rw-r--r-- | profiler/src/lib.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/profiler/src/lib.rs b/profiler/src/lib.rs index d23ad24..1a9558d 100644 --- a/profiler/src/lib.rs +++ b/profiler/src/lib.rs @@ -8,15 +8,11 @@ static GLOBAL_PROFILER: OnceLock<Profiler> = OnceLock::new(); struct Profiler { logger: ConsoleLogger, - start_time: DateTime<Utc>, } impl Profiler { fn new(logger: ConsoleLogger) -> Self { - Self { - logger, - start_time: Utc::now(), - } + Self { logger } } fn current_timestamp(&self) -> i64 { @@ -51,18 +47,17 @@ pub fn set_profiler(logger: ConsoleLogger) { } pub fn finish_frame() { - GLOBAL_PROFILER.get().unwrap().finish_frame(); + GLOBAL_PROFILER.get().inspect(|p| p.finish_frame()); } pub fn start_scope(scope_name: impl AsRef<str>) { GLOBAL_PROFILER .get() - .unwrap() - .start_scope(scope_name.as_ref().to_string()); + .inspect(|p| p.start_scope(scope_name.as_ref().to_string())); } pub fn end_scope() { - GLOBAL_PROFILER.get().unwrap().end_scope(); + GLOBAL_PROFILER.get().inspect(|p| p.end_scope()); } pub fn profile_scope(scope_name: impl AsRef<str>) -> ScopeGuard<(), impl FnOnce(())> { |
