Skip to content

Commit 026702b

Browse files
authored
Merge pull request #314 from faster-cpython/simplifiy-logic
Simplify some logic in perf_to_csv
2 parents 3dc41c0 + 9c34a2a commit 026702b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

bench_runner/scripts/run_benchmarks.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,16 +182,16 @@ def perf_to_csv(lines: Iterable[str], output: PathLike):
182182
line = line.strip()
183183
if line.startswith(event_count_prefix):
184184
total = int(line[len(event_count_prefix) :].strip())
185-
continue
186-
if line.startswith("#") or line == "":
187-
continue
188-
if total is None:
185+
elif line.startswith("#") or line == "":
186+
pass
187+
elif total is None:
189188
raise ValueError("Could not find total sample count")
190-
_, period, command, _, symbol, shared, _ = line.split(maxsplit=6)
191-
pid, command = command.split(":")
192-
self_time = float(int(period)) / total
193-
if self_time > 0.0:
194-
rows.append([self_time, pid, command, shared, symbol])
189+
else:
190+
_, period, command, _, symbol, shared, _ = line.split(maxsplit=6)
191+
pid, command = command.split(":")
192+
self_time = float(int(period)) / total
193+
if self_time > 0.0:
194+
rows.append([self_time, pid, command, shared, symbol])
195195

196196
rows.sort(key=itemgetter(0), reverse=True)
197197

0 commit comments

Comments
 (0)