MCPcopy Create free account
hub / github.com/erans/pgsqlite / get_stats

Method get_stats

src/protocol/memory_monitor.rs:336–355  ·  view source on GitHub ↗

Get current memory statistics

(&self)

Source from the content-addressed store, hash-verified

334
335 /// Get current memory statistics
336 pub fn get_stats(&self) -> MemoryStats {
337 let mut stats = self.stats.lock();
338
339 // Update stats from atomic counters
340 stats.buffer_pool_bytes = self.buffer_pool_bytes.load(Ordering::Relaxed);
341 stats.message_bytes = self.message_bytes.load(Ordering::Relaxed);
342 stats.query_bytes = self.query_bytes.load(Ordering::Relaxed);
343 stats.cleanup_events = self.cleanup_events.load(Ordering::Relaxed);
344
345 // Update peak memory
346 let current_total = stats.total_bytes();
347 if current_total > stats.peak_memory_bytes {
348 stats.peak_memory_bytes = current_total;
349 }
350
351 // Update pressure level based on current memory usage
352 stats.pressure_level = self.calculate_pressure_level(current_total);
353
354 stats.clone()
355 }
356
357 /// Force a memory cleanup
358 pub fn force_cleanup(&self) {

Callers 5

test_memory_deallocationFunction · 0.45
test_stats_resetFunction · 0.45

Calls 4

loadMethod · 0.80
total_bytesMethod · 0.80
cloneMethod · 0.45

Tested by 5

test_memory_deallocationFunction · 0.36
test_stats_resetFunction · 0.36