1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
"""Script to visualize google-benchmark output"""
3
3
from __future__ import print_function
4
4
import argparse
@@ -62,6 +62,13 @@ def parse_args():
62
62
return args
63
63
64
64
65
+ def parse_input_size (name ):
66
+ splits = name .split ('/' )
67
+ if len (splits ) == 1 :
68
+ return 1
69
+ return int (splits [1 ])
70
+
71
+
65
72
def read_data (args ):
66
73
"""Read and process dataframe using commandline args"""
67
74
try :
@@ -71,15 +78,15 @@ def read_data(args):
71
78
logging .error (msg )
72
79
exit (1 )
73
80
data ['label' ] = data ['name' ].apply (lambda x : x .split ('/' )[0 ])
74
- data ['input' ] = data ['name' ].apply (lambda x : int ( x . split ( '/' )[ 1 ]) )
81
+ data ['input' ] = data ['name' ].apply (parse_input_size )
75
82
data [args .metric ] = data [args .metric ].apply (TRANSFORMS [args .transform ])
76
83
return data
77
84
78
85
79
86
def plot_groups (label_groups , args ):
80
87
"""Display the processed data"""
81
88
for label , group in label_groups .items ():
82
- plt .plot (group ['input' ], group [args .metric ], label = label )
89
+ plt .plot (group ['input' ], group [args .metric ], label = label , marker = '.' )
83
90
if args .logx :
84
91
plt .xscale ('log' )
85
92
if args .logy :
@@ -101,7 +108,7 @@ def main():
101
108
if args .relative_to is not None :
102
109
try :
103
110
baseline = label_groups [args .relative_to ][args .metric ].copy ()
104
- except KeyError , key :
111
+ except KeyError as key :
105
112
msg = 'Key %s is not present in the benchmark output'
106
113
logging .error (msg , str (key ))
107
114
exit (1 )
0 commit comments