|
10 | 10 | use alloc::{boxed::Box, string::String, vec::Vec};
|
11 | 11 | use core::{marker::PhantomData, num::NonZeroUsize, time::Duration};
|
12 | 12 |
|
13 |
| -#[cfg(feature = "adaptive_serialization")] |
14 |
| -use libafl_bolts::current_time; |
15 | 13 | #[cfg(feature = "llmp_compression")]
|
16 | 14 | use libafl_bolts::{
|
17 | 15 | compress::GzipCompressor,
|
@@ -332,55 +330,13 @@ where
|
332 | 330 | self.inner.log(state, severity_level, message)
|
333 | 331 | }
|
334 | 332 |
|
335 |
| - #[cfg(not(feature = "adaptive_serialization"))] |
336 | 333 | fn serialize_observers<OT>(&mut self, observers: &OT) -> Result<Option<Vec<u8>>, Error>
|
337 | 334 | where
|
338 | 335 | OT: ObserversTuple<Self::State> + Serialize,
|
339 | 336 | {
|
340 | 337 | self.inner.serialize_observers(observers)
|
341 | 338 | }
|
342 | 339 |
|
343 |
| - #[cfg(feature = "adaptive_serialization")] |
344 |
| - fn serialize_observers<OT>(&mut self, observers: &OT) -> Result<Option<Vec<u8>>, Error> |
345 |
| - where |
346 |
| - OT: ObserversTuple<Self::State> + Serialize, |
347 |
| - { |
348 |
| - const SERIALIZE_TIME_FACTOR: u32 = 4; |
349 |
| - const SERIALIZE_PERCENTAGE_TRESHOLD: usize = 80; |
350 |
| - |
351 |
| - let exec_time = observers |
352 |
| - .match_name::<crate::observers::TimeObserver>("time") |
353 |
| - .map(|o| o.last_runtime().unwrap_or(Duration::ZERO)) |
354 |
| - .unwrap(); |
355 |
| - |
356 |
| - let mut must_ser = (self.serialization_time() + self.deserialization_time()) |
357 |
| - * SERIALIZE_TIME_FACTOR |
358 |
| - < exec_time; |
359 |
| - if must_ser { |
360 |
| - *self.should_serialize_cnt_mut() += 1; |
361 |
| - } |
362 |
| - |
363 |
| - if self.serializations_cnt() > 32 { |
364 |
| - must_ser = (self.should_serialize_cnt() * 100 / self.serializations_cnt()) |
365 |
| - > SERIALIZE_PERCENTAGE_TRESHOLD; |
366 |
| - } |
367 |
| - |
368 |
| - if self.inner.serialization_time() == Duration::ZERO |
369 |
| - || must_ser |
370 |
| - || self.serializations_cnt().trailing_zeros() >= 8 |
371 |
| - { |
372 |
| - let start = current_time(); |
373 |
| - let ser = postcard::to_allocvec(observers)?; |
374 |
| - *self.inner.serialization_time_mut() = current_time() - start; |
375 |
| - |
376 |
| - *self.serializations_cnt_mut() += 1; |
377 |
| - Ok(Some(ser)) |
378 |
| - } else { |
379 |
| - *self.serializations_cnt_mut() += 1; |
380 |
| - Ok(None) |
381 |
| - } |
382 |
| - } |
383 |
| - |
384 | 340 | fn configuration(&self) -> EventConfig {
|
385 | 341 | self.inner.configuration()
|
386 | 342 | }
|
|
0 commit comments