MCPcopy
hub / github.com/angular/angular / formatStats

Function formatStats

packages/benchpress/src/reporter/util.ts:20–28  ·  view source on GitHub ↗
(validSamples: MeasureValues[], metricName: string)

Source from the content-addressed store, hash-verified

18}
19
20export function formatStats(validSamples: MeasureValues[], metricName: string): string {
21 const samples = validSamples.map((measureValues) => measureValues.values[metricName]);
22 const mean = Statistic.calculateMean(samples);
23 const cv = Statistic.calculateCoefficientOfVariation(samples, mean);
24 const formattedMean = formatNum(mean);
25 // Note: Don't use the unicode character for +- as it might cause
26 // hickups for consoles...
27 return isNaN(cv) ? formattedMean : `${formattedMean}+-${Math.floor(cv)}%`;
28}

Callers 2

reportSampleMethod · 0.90
sampleStatsMethod · 0.90

Calls 4

formatNumFunction · 0.85
mapMethod · 0.80
calculateMeanMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…