<s> """<STR_LIT>""" <EOL> import matplotlib as mpl <EOL> from pylab import * <EOL> KB_ = <NUM_LIT> <EOL> MB_ = <NUM_LIT> * KB_ <EOL> GB_ = <NUM_LIT> * MB_ <EOL> NCHUNKS = <NUM_LIT> <EOL> linewidth = <NUM_LIT:2> <EOL> markers = [ '<STR_LIT:s>' , '<STR_LIT:o>' , '<STR_LIT:v>' , '<STR_LIT>' , '<STR_LIT:+>' , '<STR_LIT:x>' , '<STR_LIT:>>' , '<STR_LIT:<>' , '<STR_LIT:.>' , '<STR_LIT:U+002C>' ] <EOL> markersize = <NUM_LIT:8> <EOL> def get_values ( filename ) : <EOL> f = open ( filename ) <EOL> values = { "<STR_LIT>" : [ ] , "<STR_LIT>" : [ ] } <EOL> for line in f : <EOL> if line . startswith ( '<STR_LIT>' ) : <EOL> tmp = line . split ( '<STR_LIT>' ) [ <NUM_LIT:1> ] <EOL> nthreads , size , elsize , sbits , codec , shuffle = [ i for i in tmp . split ( '<STR_LIT:U+002CU+0020>' ) ] <EOL> nthreads , size , elsize , sbits = map ( int , ( nthreads , size , elsize , sbits ) ) <EOL> values [ "<STR_LIT:size>" ] = size * NCHUNKS / MB_ ; <EOL> values [ "<STR_LIT>" ] = elsize ; <EOL> values [ "<STR_LIT>" ] = sbits ; <EOL> values [ "<STR_LIT>" ] = codec <EOL> values [ "<STR_LIT>" ] = shuffle <EOL> ( ratios , speedsw , speedsr ) = ( [ ] , [ ] , [ ] ) <EOL> values [ nthreads ] = ( ratios , speedsw , speedsr ) <EOL> elif line . startswith ( '<STR_LIT>' ) : <EOL> tmp = line . split ( '<STR_LIT:U+002C>' ) [ <NUM_LIT:1> ] <EOL> memcpyw = float ( tmp . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:1> ] ) <EOL> values [ "<STR_LIT>" ] . append ( memcpyw ) <EOL> elif line . startswith ( '<STR_LIT>' ) : <EOL> tmp = line . split ( '<STR_LIT:U+002C>' ) [ <NUM_LIT:1> ] <EOL> memcpyr = float ( tmp . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:1> ] ) <EOL> values [ "<STR_LIT>" ] . append ( memcpyr ) <EOL> elif line . startswith ( '<STR_LIT>' ) : <EOL> tmp = line . split ( '<STR_LIT:U+002C>' ) [ <NUM_LIT:1> ] <EOL> speedw = float ( tmp . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:1> ] ) <EOL> ratio = float ( line . split ( '<STR_LIT::>' ) [ - <NUM_LIT:1> ] ) <EOL> speedsw . append ( speedw ) <EOL> ratios . append ( ratio ) <EOL> elif line . startswith ( '<STR_LIT>' ) : <EOL> tmp = line . split ( '<STR_LIT:U+002C>' ) [ <NUM_LIT:1> ] <EOL> speedr = float ( tmp . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:1> ] ) <EOL> speedsr . append ( speedr ) <EOL> if "<STR_LIT:OK>" not in line : <EOL> print "<STR_LIT>" <EOL> f . close ( ) <EOL> return nthreads , values <EOL> def show_plot ( plots , yaxis , legends , gtitle , xmax = None ) : <EOL> xlabel ( '<STR_LIT>' ) <EOL> ylabel ( '<STR_LIT>' ) <EOL> title ( gtitle ) <EOL> xlim ( <NUM_LIT:0> , xmax ) <EOL> ylim ( <NUM_LIT:0> , None ) <EOL> grid ( True ) <EOL> legend ( [ p [ <NUM_LIT:0> ] for p in plots <EOL> if not isinstance ( p , mpl . lines . Line2D ) ] , <EOL> legends , loc = "<STR_LIT>" ) <EOL> if outfile : <EOL> print "<STR_LIT>" , outfile <EOL> savefig ( outfile , dpi = <NUM_LIT:64> ) <EOL> else : <EOL> show ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> from optparse import OptionParser <EOL> usage = "<STR_LIT>" <EOL> compress_title = '<STR_LIT>' <EOL> decompress_title = '<STR_LIT>' <EOL> yaxis = '<STR_LIT>' <EOL> parser = OptionParser ( usage = usage ) <EOL> parser . add_option ( '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> dest = '<STR_LIT>' , <EOL> help = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) ) <EOL> parser . add_option ( '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> dest = '<STR_LIT:title>' , <EOL> help = '<STR_LIT>' , ) <EOL> parser . add_option ( '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , ) <EOL> parser . add_option ( '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = None ) <EOL> parser . add_option ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , <EOL> dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = False ) <EOL> parser . add_option ( '<STR_LIT>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , <EOL> dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = False ) <EOL> parser . add_option ( '<STR_LIT:-c>' , '<STR_LIT>' , action = '<STR_LIT:store_true>' , <EOL> dest = '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> default = False ) <EOL> ( options , args ) = parser . parse_args ( ) <EOL> if len ( args ) == <NUM_LIT:0> : <EOL> parser . error ( "<STR_LIT>" ) <EOL> elif len ( args ) > <NUM_LIT:1> : <EOL> parser . error ( "<STR_LIT>" ) <EOL> else : <EOL> pass <EOL> if options . report and options . outfile : <EOL> parser . error ( "<STR_LIT>" ) <EOL> if options . dspeed and options . cspeed : <EOL> parser . error ( "<STR_LIT>" ) <EOL> elif options . cspeed : <EOL> options . dspeed = False <EOL> plot_title = compress_title <EOL> else : <EOL> options . dspeed = True <EOL> plot_title = decompress_title <EOL> filename = args [ <NUM_LIT:0> ] <EOL> cspeed = options . cspeed <EOL> dspeed = options . dspeed <EOL> if options . outfile : <EOL> outfile = options . outfile <EOL> elif options . report : <EOL> if cspeed : <EOL> outfile = filename [ : filename . rindex ( '<STR_LIT:.>' ) ] + '<STR_LIT>' <EOL> else : <EOL> outfile = filename [ : filename . rindex ( '<STR_LIT:.>' ) ] + '<STR_LIT>' <EOL> else : <EOL> outfile = None <EOL> plots = [ ] <EOL> legends = [ ] <EOL> nthreads , values = get_values ( filename ) <EOL> if options . limit : <EOL> thread_range = eval ( options . limit ) <EOL> else : <EOL> thread_range = range ( <NUM_LIT:1> , nthreads + <NUM_LIT:1> ) <EOL> if options . title : <EOL> plot_title = options . title <EOL> else : <EOL> plot_title += "<STR_LIT>" % values <EOL> gtitle = plot_title <EOL> for nt in thread_range : <EOL> ( ratios , speedw , speedr ) = values [ nt ] <EOL> if cspeed : <EOL> speed = speedw <EOL> else : <EOL> speed = speedr <EOL> plot_ = plot ( ratios , speed , linewidth = <NUM_LIT:2> ) <EOL> plots . append ( plot_ ) <EOL> nmarker = nt <EOL> if nt >= len ( markers ) : <EOL> nmarker = nt % len ( markers ) <EOL> setp ( plot_ , marker = markers [ nmarker ] , markersize = markersize , <EOL> linewidth = linewidth ) <EOL> legends . append ( "<STR_LIT>" % nt ) <EOL> if cspeed : <EOL> mean = np . mean ( values [ "<STR_LIT>" ] ) <EOL> message = "<STR_LIT>" <EOL> else : <EOL> mean = np . mean ( values [ "<STR_LIT>" ] ) <EOL> message = "<STR_LIT>" <EOL> plot_ = axhline ( mean , linewidth = <NUM_LIT:3> , linestyle = '<STR_LIT>' , color = '<STR_LIT>' ) <EOL> text ( <NUM_LIT:1.0> , mean + <NUM_LIT:50> , message ) <EOL> plots . append ( plot_ ) <EOL> show_plot ( plots , yaxis , legends , gtitle , xmax = int ( options . xmax ) if <EOL> options . xmax else None ) </s>
