MCPcopy Create free account
hub / github.com/nodejs/node / stats

Function stats

deps/v8/tools/gc-nvp-trace-processor.py:297–313  ·  view source on GitHub ↗
(out, prefix, trace, field)

Source from the content-addressed store, hash-verified

295 charts = plot_all(plots, trace, filename)
296
297 def stats(out, prefix, trace, field):
298 n = len(trace)
299 total = calc_total(trace, field)
300 max = calc_max(trace, field)
301 if n > 0:
302 avg = total / n
303 else:
304 avg = 0
305 if n > 1:
306 dev = math.sqrt(freduce(lambda t,r: t + (r - avg) ** 2, field, trace, 0) /
307 (n - 1))
308 else:
309 dev = 0
310
311 out.write('<tr><td>%s</td><td>%d</td><td>%d</td>'
312 '<td>%d</td><td>%d [dev %f]</td></tr>' %
313 (prefix, n, total, max, avg, dev))
314
315 def HumanReadable(size):
316 suffixes = ['bytes', 'kB', 'MB', 'GB']

Callers 1

process_traceFunction · 0.70

Calls 4

calc_totalFunction · 0.85
calc_maxFunction · 0.85
freduceFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected