MCPcopy Index your code
hub / github.com/nodejs/node / Row

Class Row

deps/v8/tools/generate-runtime-call-stats.py:262–312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

260
261
262class Row:
263
264 def __init__(self, name, run_count):
265 self.name = name
266 self.durations = [0] * run_count
267 self.counts = [0] * run_count
268 self.mean_duration = None
269 self.mean_count = None
270 self.stdev_duration = None
271 self.stdev_count = None
272
273 def __repr__(self):
274 data_str = ", ".join(
275 str((c, d)) for (c, d) in zip(self.counts, self.durations))
276 return (f"{self.name}: {data_str}, mean_count: {self.mean_count}, " +
277 f"mean_duration: {self.mean_duration}")
278
279 def add_data(self, counts, durations):
280 self.counts = counts
281 self.durations = durations
282
283 def add_data_point(self, run, count, duration):
284 self.counts[run] = count
285 self.durations[run] = duration
286
287 def prepare(self, stdev=False):
288 if len(self.durations) > 1:
289 self.mean_duration = statistics.mean(self.durations)
290 self.mean_count = statistics.mean(self.counts)
291 if stdev:
292 self.stdev_duration = statistics.stdev(self.durations)
293 self.stdev_count = statistics.stdev(self.counts)
294
295 def as_list(self):
296 l = [self.name]
297 for (c, d) in zip(self.counts, self.durations):
298 l += [c, d]
299 if self.mean_duration is not None:
300 l += [self.mean_count]
301 if self.stdev_count is not None:
302 l += [self.stdev_count]
303 l += [self.mean_duration]
304 if self.stdev_duration is not None:
305 l += [self.stdev_duration]
306 return l
307
308 def key(self):
309 if self.mean_duration is not None:
310 return self.mean_duration
311 else:
312 return self.durations[0]
313
314
315class Bucket:

Callers 2

add_data_pointMethod · 0.85
prepareMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected