MCPcopy Create free account
hub / github.com/CodSpeedHQ/codspeed / format_events

Function format_events

crates/memtrack/tests/stack_tests.rs:40–74  ·  view source on GitHub ↗
(events: &[MemtrackEvent])

Source from the content-addressed store, hash-verified

38}
39
40fn format_events(events: &[MemtrackEvent]) -> Vec<String> {
41 const MARKER: u64 = 0xC0D5_9EED;
42 let has_markers = events.iter().any(|e| {
43 matches!(
44 e.kind,
45 MemtrackEventKind::Malloc { size, .. } if size == MARKER
46 )
47 });
48
49 let filtered_events = if has_markers {
50 shared::between_markers(events)
51 } else {
52 events
53 .iter()
54 .filter(|e| {
55 matches!(
56 e.kind,
57 MemtrackEventKind::Malloc { .. }
58 | MemtrackEventKind::Free
59 | MemtrackEventKind::Calloc { .. }
60 | MemtrackEventKind::Realloc { .. }
61 | MemtrackEventKind::AlignedAlloc { .. }
62 )
63 })
64 .sorted_by_key(|e| e.timestamp)
65 .dedup_by(|a, b| a.addr == b.addr && discriminant(&a.kind) == discriminant(&b.kind))
66 .cloned()
67 .collect()
68 };
69
70 filtered_events
71 .iter()
72 .filter_map(|e| describe_allocator_event(&e.kind))
73 .collect()
74}
75
76const STACK_TEST_CASES: &[AllocationTestCase] = &[
77 AllocationTestCase {

Callers

nothing calls this directly

Calls 2

between_markersFunction · 0.85
describe_allocator_eventFunction · 0.85

Tested by

no test coverage detected