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

Function build_memory_table

src/upload/benchmark_display.rs:226–262  ·  view source on GitHub ↗
(results: &[&FetchLocalRunBenchmarkResult])

Source from the content-addressed store, hash-verified

224}
225
226fn build_memory_table(results: &[&FetchLocalRunBenchmarkResult]) -> String {
227 let rows: Vec<MemoryRow> = results
228 .iter()
229 .map(|result| {
230 let (peak_memory, total_allocated, alloc_calls) = if let Some(mem) = &result.memory {
231 (
232 format!(
233 "{}",
234 style(helpers::format_memory(mem.peak_memory as f64, Some(1))).cyan()
235 ),
236 helpers::format_memory(mem.total_allocated as f64, Some(1)),
237 format_with_thousands_sep(mem.alloc_calls as u64),
238 )
239 } else {
240 (
241 format!(
242 "{}",
243 style(helpers::format_memory(result.value, Some(1))).cyan()
244 ),
245 "-".to_string(),
246 "-".to_string(),
247 )
248 };
249 MemoryRow {
250 name: result.benchmark.name.clone(),
251 peak_memory,
252 total_allocated,
253 alloc_calls,
254 }
255 })
256 .collect();
257 build_table_with_style(
258 &rows,
259 ExecutorName::Memory.label(),
260 ExecutorName::Memory.icon(),
261 )
262}
263
264pub fn build_benchmark_table(results: &[FetchLocalRunBenchmarkResult]) -> String {
265 // Group results by executor

Callers 1

build_benchmark_tableFunction · 0.85

Calls 5

format_memoryFunction · 0.85
build_table_with_styleFunction · 0.85
iconMethod · 0.80
labelMethod · 0.45

Tested by

no test coverage detected