MCPcopy
hub / github.com/determined-ai/determined / summarizeMetrics

Function summarizeMetrics

performance/k6/src/utils/k6-summary.js:262–413  ·  view source on GitHub ↗
(options, data, decorate)

Source from the content-addressed store, hash-verified

260}
261
262function summarizeMetrics(options, data, decorate) {
263 var indent = options.indent + " ";
264 var result = [];
265
266 var names = [];
267 var nameLenMax = 0;
268
269 var nonTrendValues = {};
270 var nonTrendValueMaxLen = 0;
271 var nonTrendExtras = {};
272 var nonTrendExtraMaxLens = [0, 0];
273
274 var trendCols = {};
275 var numTrendColumns = options.summaryTrendStats.length;
276 var trendColMaxLens = new Array(numTrendColumns).fill(0);
277 forEach(data.metrics, function (name, metric) {
278 names.push(name);
279 // When calculating widths for metrics, account for the indentation on submetrics.
280 var displayName = indentForMetric(name) + displayNameForMetric(name);
281 var displayNameWidth = strWidth(displayName);
282 if (displayNameWidth > nameLenMax) {
283 nameLenMax = displayNameWidth;
284 }
285
286 if (metric.type == "trend") {
287 var cols = [];
288 for (var i = 0; i < numTrendColumns; i++) {
289 var tc = options.summaryTrendStats[i];
290 var value = metric.values[tc];
291 if (tc === "count") {
292 value = value.toString();
293 } else {
294 value = humanizeValue(value, metric, options.summaryTimeUnit);
295 }
296 var valLen = strWidth(value);
297 if (valLen > trendColMaxLens[i]) {
298 trendColMaxLens[i] = valLen;
299 }
300 cols[i] = value;
301 }
302 trendCols[name] = cols;
303 return;
304 }
305 var values = nonTrendMetricValueForSum(metric, options.summaryTimeUnit);
306 nonTrendValues[name] = values[0];
307 var valueLen = strWidth(values[0]);
308 if (valueLen > nonTrendValueMaxLen) {
309 nonTrendValueMaxLen = valueLen;
310 }
311 nonTrendExtras[name] = values.slice(1);
312 for (var i = 1; i < values.length; i++) {
313 var extraLen = strWidth(values[i]);
314 if (extraLen > nonTrendExtraMaxLens[i - 1]) {
315 nonTrendExtraMaxLens[i - 1] = extraLen;
316 }
317 }
318 });
319

Callers 1

generateTextSummaryFunction · 0.85

Calls 12

indentForMetricFunction · 0.85
displayNameForMetricFunction · 0.85
strWidthFunction · 0.85
humanizeValueFunction · 0.85
decorateFunction · 0.85
markColorFunction · 0.85
getDataFunction · 0.85
splitMethod · 0.80
forEachFunction · 0.70
pushMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected