@@ -49,13 +49,15 @@ def tearDown(self):
4949 @mock .patch .object (bm , "GetSubBenchmarks" , autospec = True )
5050 @mock .patch .object (run .Run , "Execute" , autospec = True )
5151 @mock .patch .object (cpu , "Utilization" , autospec = True )
52+ @mock .patch .object (reporter , "GenerateBenchmarkReport" , autospec = True )
5253 @mock .patch .object (reporter , "SaveBenchmarkResults" , autospec = True )
5354 @flagsaver .flagsaver (
5455 benchmark_dir = absltest .get_default_test_tmpdir (),
5556 )
5657 def testRun (
5758 self ,
5859 mock_save_benchmark_results ,
60+ mock_generate_benchmark_report ,
5961 mock_utilization ,
6062 mock_execute ,
6163 mock_get_subbenchmarks ,
@@ -81,6 +83,7 @@ def fake_utilization(unused_cpus):
8183
8284 mock_utilization .side_effect = fake_utilization
8385
86+ mock_generate_benchmark_report .return_value = pd .DataFrame ()
8487 mock_save_benchmark_results .return_value = None
8588
8689 self .pb = parallel_bench_lib .ParallelBench (
@@ -126,23 +129,27 @@ def test_convert_to_dataframe(self):
126129 total_duration = 10 ,
127130 per_iteration_wall_time = 1 ,
128131 per_iteration_cpu_time = 1 ,
132+ per_bm_run_iteration = 2 ,
129133 ),
130134 parallel_bench_lib .BenchmarkMetrics (
131135 total_duration = 2 ,
132136 per_iteration_wall_time = 3.01 ,
133137 per_iteration_cpu_time = 3 ,
138+ per_bm_run_iteration = 4 ,
134139 ),
135140 ]
136141 self .pb .runtimes ["BM_Test2" ] = [
137142 parallel_bench_lib .BenchmarkMetrics (
138143 total_duration = 10 ,
139144 per_iteration_wall_time = 1 ,
140145 per_iteration_cpu_time = 1 ,
146+ per_bm_run_iteration = 10 ,
141147 ),
142148 parallel_bench_lib .BenchmarkMetrics (
143149 total_duration = 4 ,
144150 per_iteration_wall_time = 4 ,
145151 per_iteration_cpu_time = 5 ,
152+ per_bm_run_iteration = 8 ,
146153 ),
147154 ]
148155 self .pb .utilization_samples .append ((pd .Timestamp .now (), 0.5 ))
@@ -151,8 +158,18 @@ def test_convert_to_dataframe(self):
151158 self .assertEqual (
152159 df .to_dict ("records" ),
153160 [
154- {"Benchmark" : "BM_Test1" , "WallTimes" : 3.01 , "CPUTimes" : 3 },
155- {"Benchmark" : "BM_Test2" , "WallTimes" : 4 , "CPUTimes" : 5 },
161+ {
162+ "Benchmark" : "BM_Test1" ,
163+ "WallTimes" : 3.01 ,
164+ "CPUTimes" : 3 ,
165+ "Iterations" : 4 ,
166+ },
167+ {
168+ "Benchmark" : "BM_Test2" ,
169+ "WallTimes" : 4 ,
170+ "CPUTimes" : 5 ,
171+ "Iterations" : 8 ,
172+ },
156173 ],
157174 )
158175
0 commit comments