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

- old
+ new

@@ -36,37 +36,41 @@ // Parse arguments let kwargs: VALUE = Qnil.into(); unsafe { rb_scan_args(argc, argv, cstr!(":"), &kwargs); }; - let mut kwargs_values: [VALUE; 4] = [Qnil.into(); 4]; + let mut kwargs_values: [VALUE; 5] = [Qnil.into(); 5]; unsafe { rb_get_kwargs( kwargs, [ rb_intern(cstr!("interval_ms")), rb_intern(cstr!("threads")), rb_intern(cstr!("time_mode")), rb_intern(cstr!("scheduler")), + rb_intern(cstr!("use_experimental_serializer")), ] .as_mut_ptr(), 0, - 4, + 5, kwargs_values.as_mut_ptr(), ); }; let interval = Self::parse_option_interval_ms(kwargs_values[0]); let threads = Self::parse_option_threads(kwargs_values[1]); let time_mode = Self::parse_option_time_mode(kwargs_values[2]); let scheduler = Self::parse_option_scheduler(kwargs_values[3]); + let use_experimental_serializer = + Self::parse_option_use_experimental_serializer(kwargs_values[4]); let configuration = Configuration { scheduler, interval, target_ruby_threads: threads.clone(), time_mode, + use_experimental_serializer, }; match configuration.validate() { Ok(_) => {} Err(msg) => unsafe { @@ -125,14 +129,14 @@ } let interval_ms = unsafe { rb_num2long(value) }; Duration::from_millis(interval_ms.try_into().unwrap_or_else(|_| { eprintln!( - "[Pf2] Warning: Specified interval ({}) is not valid. Using default value (49ms).", + "[Pf2] Warning: Specified interval ({}) is not valid. Using default value (9ms).", interval_ms ); - 49 + 9 })) } fn parse_option_threads(value: VALUE) -> configuration::Threads { if (value == Qundef as VALUE) @@ -203,9 +207,16 @@ cstr!("Signal scheduler is not supported on this platform."), ) } } scheduler + } + + fn parse_option_use_experimental_serializer(value: VALUE) -> bool { + if value == Qundef as VALUE { + return false; + } + RTEST(value) } pub fn start(&mut self) -> VALUE { self.running.store(true, Ordering::Relaxed); self.start_profile_buffer_flusher_thread();