google_benchmark_plot icon indicating copy to clipboard operation
google_benchmark_plot copied to clipboard

plot.py does not support output generated with --benchmark_repetitions=X

Open vlovich opened this issue 4 years ago • 4 comments

py.exe google_benchmark_plot/plot.py -f test.csv -r 'BM_MyTest<uint8_t>'

results in

Traceback (most recent call last):
  File "google_benchmark_plot/plot.py", line 123, in <module>
    main()
  File "google_benchmark_plot/plot.py", line 118, in main
    label_groups[label][args.metric] /= baseline
  File "C:\Python38\lib\site-packages\pandas\core\ops\methods.py", line 101, in f
    result.reindex_like(self, copy=False), verify_is_copy=False
  File "C:\Python38\lib\site-packages\pandas\core\generic.py", line 3856, in reindex_like
    return self.reindex(**d)
  File "C:\Python38\lib\site-packages\pandas\core\series.py", line 4399, in reindex
    return super().reindex(index=index, **kwargs)
  File "C:\Python38\lib\site-packages\pandas\core\generic.py", line 4461, in reindex
    return self._reindex_axes(
  File "C:\Python38\lib\site-packages\pandas\core\generic.py", line 4481, in _reindex_axes
    obj = obj._reindex_with_indexers(
  File "C:\Python38\lib\site-packages\pandas\core\generic.py", line 4524, in _reindex_with_indexers
    new_data = new_data.reindex_indexer(
  File "C:\Python38\lib\site-packages\pandas\core\internals\managers.py", line 1276, in reindex_indexer
    self.axes[axis]._can_reindex(indexer)
  File "C:\Python38\lib\site-packages\pandas\core\indexes\base.py", line 3289, in _can_reindex
    raise ValueError("cannot reindex from a duplicate axis")
ValueError: cannot reindex from a duplicate axis

test.csv contains:

name,iterations,real_time,cpu_time,time_unit,bytes_per_second,items_per_second,label,error_occurred,error_message
"BM_MyTest<uint8_t>/1/0",23578947,39.6876,31.808,ns,,0,,,
"BM_MyTest<uint8_t>/1/0",23578947,32.0808,31.808,ns,,0,,,
"BM_MyTest<uint8_t>/1/0",23578947,30.3521,29.1574,ns,,0,,,
"BM_MyTest<uint8_t>/1/0_mean",3,34.0402,30.9245,ns,,0,,,
"BM_MyTest<uint8_t>/1/0_median",3,32.0808,31.808,ns,,0,,,
"BM_MyTest<uint8_t>/1/0_stddev",3,4.96659,1.53036,ns,,0,,,
"BM_MyTest<uint8_t>/1/0_",3,4.96659,1.53036,ns,,0,,,
"BM_MyTest<uint8_t>_BigO",,3.06507,3.02076,N,,,,,

vlovich avatar Oct 30 '20 05:10 vlovich

Thanks for reporting, I'll take a look

lakshayg avatar Oct 30 '20 09:10 lakshayg

The error is due to the first three lines in the output

"BM_MyTest<uint8_t>/1/0",23578947,39.6876,31.808,ns,,0,,,
"BM_MyTest<uint8_t>/1/0",23578947,32.0808,31.808,ns,,0,,,
"BM_MyTest<uint8_t>/1/0",23578947,30.3521,29.1574,ns,,0,,,

All of these have the same test name. I wonder why is that the case

lakshayg avatar Nov 09 '20 03:11 lakshayg

Hi,

This is the case when a test is run with --benchmark_repetitions=X in which case I suppose the value to use would be the mean or median

chouquette avatar Sep 20 '21 12:09 chouquette

@chouquette That makes sense. I think it might make sense to have some sort of a reduce flag which describes the behaviour when there are multiple lines with the same name. The reduce flag can take any of {min, max, median, mean}. Feel free to make a PR or post other ideas.

lakshayg avatar Sep 26 '21 03:09 lakshayg