Fix Benchmark Results Parsing (#12248)
Properly account for number and units.
Correct parsing:
```
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time', time='1.28 ms', cpu_time='1.28 ms', iterations='1000', user_counters='items_per_second=780.537/s')
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time', time='1.27 ms', cpu_time='1.27 ms', iterations='1000', user_counters='items_per_second=786.848/s')
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time', time='1.27 ms', cpu_time='1.27 ms', iterations='1000', user_counters='items_per_second=786.571/s')
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time', time='1.27 ms', cpu_time='1.27 ms', iterations='1000', user_counters='items_per_second=786.171/s')
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time', time='1.27 ms', cpu_time='1.27 ms', iterations='1000', user_counters='items_per_second=785.908/s')
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time_mean', time='1.27 ms', cpu_time='1.27 ms', iterations='5', user_counters='items_per_second=785.207/s')
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time_median', time='1.27 ms', cpu_time='1.27 ms', iterations='5', user_counters='items_per_second=786.171/s')
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time_stddev', time='0.004 ms', cpu_time='0.004 ms', iterations='5', user_counters='items_per_second=2.63573/s')
BenchmarkResult(benchmark_name='BM_benchmark_first_matmul/process_time/real_time_cv', time='0.34 %', cpu_time='0.34 %', iterations='5', user_counters='items_per_second=0.34%')
```
diff --git a/runtime/bindings/python/iree/runtime/benchmark.py b/runtime/bindings/python/iree/runtime/benchmark.py
index 3f0b51c..c983b88 100644
--- a/runtime/bindings/python/iree/runtime/benchmark.py
+++ b/runtime/bindings/python/iree/runtime/benchmark.py
@@ -95,16 +95,16 @@
bench_lines = out.decode().split("\n")[3:]
benchmark_results = []
for line in bench_lines:
- spilt = line.split()
- if len(spilt) == 0:
+ split = line.split()
+ if len(split) == 0:
continue
- benchmark_name = spilt[0]
- time = spilt[1]
- cpu_time = spilt[2]
- iterations = spilt[3]
+ benchmark_name = split[0]
+ time = " ".join(split[1:3])
+ cpu_time = " ".join(split[3:5])
+ iterations = split[5]
user_counters = None
- if len(spilt) > 4:
- user_counters = spilt[4]
+ if len(split) > 5:
+ user_counters = split[6]
benchmark_results.append(
BenchmarkResult(benchmark_name=benchmark_name,
time=time,