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

Function build_memory_table

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

Source from the content-addressed store, hash-verified

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

Callers 1

build_benchmark_tableFunction · 0.85

Calls 5

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

Tested by

no test coverage detected