Skip to content

Commit

Permalink
fix(profiler): update profiler to match current measureme api (#840)
Browse files Browse the repository at this point in the history
moves all OS profiling to use SerializationSink as the previous types
have been deprecated

Closes #839
  • Loading branch information
neeldug committed Oct 11, 2020
1 parent 0c92d37 commit 8aef556
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions boa/src/profiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,11 @@ use std::{
thread::{current, ThreadId},
};

/// MmapSerializatioSink is faster on macOS and Linux
/// but FileSerializationSink is faster on Windows
#[cfg(not(windows))]
#[cfg(feature = "profiler")]
type SerializationSink = measureme::MmapSerializationSink;
#[cfg(windows)]
#[cfg(feature = "profiler")]
type SerializationSink = measureme::FileSerializationSink;
type SerializationSink = measureme::SerializationSink;
#[cfg(feature = "profiler")]
pub struct BoaProfiler {
profiler: Profiler<SerializationSink>,
profiler: Profiler,
}

/// This static instance should never be public, and its only access should be done through the `global()` and `drop()` methods
Expand All @@ -31,7 +25,7 @@ static mut INSTANCE: OnceCell<BoaProfiler> = OnceCell::new();

#[cfg(feature = "profiler")]
impl BoaProfiler {
pub fn start_event(&self, label: &str, category: &str) -> TimingGuard<'_, SerializationSink> {
pub fn start_event(&self, label: &str, category: &str) -> TimingGuard<'_> {
let kind = self.profiler.alloc_string(category);
let id = EventId::from_label(self.profiler.alloc_string(label));
let thread_id = Self::thread_id_to_u32(current().id());
Expand Down

0 comments on commit 8aef556

Please sign in to comment.