ext/pf2/src/timer_thread_scheduler.rs in pf2-0.5.2 vs ext/pf2/src/timer_thread_scheduler.rs in pf2-0.6.0

- old
+ new

@@ -10,10 +10,11 @@ use crate::profile::Profile; use crate::profile_serializer::ProfileSerializer; use crate::sample::Sample; use crate::scheduler::Scheduler; +use crate::serialization::serializer::ProfileSerializer2; use crate::session::configuration::{self, Configuration}; use crate::util::*; #[derive(Clone, Debug)] pub struct TimerThreadScheduler { @@ -59,20 +60,25 @@ // Finalize match self.profile.try_write() { Ok(mut profile) => { profile.flush_temporary_sample_buffer(); + profile.end_instant = Some(std::time::Instant::now()); } Err(_) => { println!("[pf2 ERROR] stop: Failed to acquire profile lock."); return Qfalse.into(); } } let profile = self.profile.try_read().unwrap(); log::debug!("Number of samples: {}", profile.samples.len()); - let serialized = ProfileSerializer::serialize(&profile); + let serialized = if self.configuration.use_experimental_serializer { + ProfileSerializer2::new().serialize(&profile) + } else { + ProfileSerializer::serialize(&profile) + }; let serialized = CString::new(serialized).unwrap(); unsafe { rb_str_new_cstr(serialized.as_ptr()) } } fn on_new_thread(&self, _thread: VALUE) {