Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if show_filename and item.suite is not suite:
suite = item.suite
format_title(item.filename, 1, lines=lines)
if stats and len(suite) > 1:
empty_line(lines)
duration = suite.get_total_duration()
lines.append("Number of benchmarks: %s" % len(suite))
lines.append("Total duration: %s" % format_seconds(duration))
dates = suite.get_dates()
if dates:
start, end = dates
lines.append("Start date: %s" % format_datetime(start, microsecond=False))
lines.append("End date: %s" % format_datetime(end, microsecond=False))
if show_name:
format_title(item.name, 2, lines=lines)
empty_line(lines)
lines.extend(bench_lines)
if lines:
empty_line(output)
output.extend(lines)
for line in output:
print(line)
if not output and only_checks:
if len(data) == 1:
nrun = bench.get_nrun()
nvalue = len(values)
empty_line(lines)
# Total duration
duration = bench.get_total_duration()
if duration:
lines.append("Total duration: %s" % format_seconds(duration))
# Start/End dates
dates = bench.get_dates()
if dates:
start, end = dates
lines.append("Start date: %s" % format_datetime(start, microsecond=False))
lines.append("End date: %s" % format_datetime(end, microsecond=False))
# Raw value minimize/maximum
raw_values = bench._get_raw_values()
lines.append("Raw value minimum: %s" % bench.format_value(min(raw_values)))
lines.append("Raw value maximum: %s" % bench.format_value(max(raw_values)))
lines.append('')
# Number of values
ncalibration_runs = sum(run._is_calibration() for run in bench._runs)
lines.append("Number of calibration run: %s"
% format_number(ncalibration_runs))
lines.append("Number of run with values: %s"
% (format_number(nrun - ncalibration_runs)))
lines.append("Total number of run: %s" % format_number(nrun))
lines.append('')
metadata['hostname'] = hostname
# Boot time
boot_time = None
for line in read_proc("stat"):
if not line.startswith("btime "):
continue
boot_time = int(line[6:])
break
if boot_time is None and psutil:
boot_time = psutil.boot_time()
if boot_time is not None:
btime = datetime.datetime.fromtimestamp(boot_time)
metadata['boot_time'] = format_datetime(btime)
metadata['uptime'] = time.time() - boot_time
nrun = bench.get_nrun()
nvalue = len(values)
empty_line(lines)
# Total duration
duration = bench.get_total_duration()
if duration:
lines.append("Total duration: %s" % format_seconds(duration))
# Start/End dates
dates = bench.get_dates()
if dates:
start, end = dates
lines.append("Start date: %s" % format_datetime(start, microsecond=False))
lines.append("End date: %s" % format_datetime(end, microsecond=False))
# Raw value minimize/maximum
raw_values = bench._get_raw_values()
lines.append("Raw value minimum: %s" % bench.format_value(min(raw_values)))
lines.append("Raw value maximum: %s" % bench.format_value(max(raw_values)))
lines.append('')
# Number of values
ncalibration_runs = sum(run._is_calibration() for run in bench._runs)
lines.append("Number of calibration run: %s"
% format_number(ncalibration_runs))
lines.append("Number of run with values: %s"
% (format_number(nrun - ncalibration_runs)))
lines.append("Total number of run: %s" % format_number(nrun))
lines.append('')
lines = []
if show_filename and item.suite is not suite:
suite = item.suite
format_title(item.filename, 1, lines=lines)
if stats and len(suite) > 1:
empty_line(lines)
duration = suite.get_total_duration()
lines.append("Number of benchmarks: %s" % len(suite))
lines.append("Total duration: %s" % format_seconds(duration))
dates = suite.get_dates()
if dates:
start, end = dates
lines.append("Start date: %s" % format_datetime(start, microsecond=False))
lines.append("End date: %s" % format_datetime(end, microsecond=False))
if show_name:
format_title(item.name, 2, lines=lines)
empty_line(lines)
lines.extend(bench_lines)
if lines:
empty_line(output)
output.extend(lines)
for line in output:
print(line)
if not output and only_checks: