From ab712f8f0ea58f1a36aced42332ed8d8ffab83d7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 3 Apr 2023 09:00:36 -0400 Subject: Fix flake8 warnings and add test --- scripts/serd_bench.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/serd_bench.py b/scripts/serd_bench.py index 89d34e1f..f3c3e148 100755 --- a/scripts/serd_bench.py +++ b/scripts/serd_bench.py @@ -69,10 +69,11 @@ def parse_time(report): "Return user time and max RSS from a /usr/bin/time -v report" time = memory = None for line in report.split("\n"): + after_colon = line.find(":") + 1 if line.startswith("\tUser time"): - time = float(line[line.find(":") + 1 :]) + time = float(line[after_colon:]) elif line.startswith("\tMaximum resident set"): - memory = float(line[line.find(":") + 1 :]) * 1024 + memory = float(line[after_colon:]) * 1024 return (time, memory) -- cgit v1.2.1