MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / entry

Method entry

src/monitor.rs:216–253  ·  view source on GitHub ↗

Read the entry at the given ring-buffer slot (0..255).

(&self, slot: usize)

Source from the content-addressed store, hash-verified

214
215 /// Read the entry at the given ring-buffer slot (0..255).
216 pub fn entry(&self, slot: usize) -> Option<MonitorEntry> {
217 if slot >= RING_CAPACITY {
218 return None;
219 }
220 let off = HEADER_SIZE + slot * ENTRY_SIZE;
221 if self.mmap.len() < off + ENTRY_SIZE {
222 return None;
223 }
224
225 let prefix = read_str(&self.mmap, off + EOFF_PREFIX);
226 let project = read_str(&self.mmap, off + EOFF_PROJECT);
227 let tool_name = read_str(&self.mmap, off + EOFF_TOOL);
228
229 let delta = u64::from_le_bytes(
230 self.mmap[off + EOFF_DELTA..off + EOFF_DELTA + 8]
231 .try_into()
232 .unwrap_or([0; 8]),
233 );
234 let before = u64::from_le_bytes(
235 self.mmap[off + EOFF_BEFORE..off + EOFF_BEFORE + 8]
236 .try_into()
237 .unwrap_or([0; 8]),
238 );
239 let timestamp = u64::from_le_bytes(
240 self.mmap[off + EOFF_TIMESTAMP..off + EOFF_TIMESTAMP + 8]
241 .try_into()
242 .unwrap_or([0; 8]),
243 );
244
245 Some(MonitorEntry {
246 prefix,
247 project,
248 tool_name,
249 delta,
250 before,
251 timestamp,
252 })
253 }
254
255 /// Re-read the mmap to pick up new writes.
256 pub fn refresh(&mut self) -> std::io::Result<()> {

Callers 15

insertMethod · 0.80
print_tool_listFunction · 0.80
runFunction · 0.80
monitor_loopFunction · 0.80
increment_family_usageFunction · 0.80
build_batchesFunction · 0.80
flush_codex_turn_usageFunction · 0.80
run_backfillFunction · 0.80
cleanup_candidatesFunction · 0.80

Calls 1

read_strFunction · 0.85

Tested by 15

add_direct_test_targetsFunction · 0.64
test_ring_buffer_wrapsFunction · 0.64
test_entry_label_formatFunction · 0.64
test_multiple_projectsFunction · 0.64
test_different_prefixesFunction · 0.64
handle_tool_callFunction · 0.64
callFunction · 0.64
callFunction · 0.64