<s> from __future__ import print_function <EOL> import tables <EOL> from pylab import * <EOL> def get_values ( filename , complib = '<STR_LIT>' ) : <EOL> f = tables . open_file ( filename ) <EOL> nrows = f . root . small . create_best . cols . nrows [ : ] <EOL> corrected_sizes = nrows / <NUM_LIT> ** <NUM_LIT:6> <EOL> if mb_units : <EOL> corrected_sizes = <NUM_LIT:16> * nrows / <NUM_LIT> ** <NUM_LIT:6> <EOL> if insert : <EOL> values = corrected_sizes / f . root . small . create_best . cols . tfill [ : ] <EOL> if table_size : <EOL> values = f . root . small . create_best . cols . fsize [ : ] / nrows <EOL> if query : <EOL> values = corrected_sizes / f . root . small . search_best . inkernel . int . cols . time1 [ : ] <EOL> if query_cache : <EOL> values = corrected_sizes / f . root . small . search_best . inkernel . int . cols . time2 [ : ] <EOL> f . close ( ) <EOL> return nrows , values <EOL> def show_plot ( plots , yaxis , legends , gtitle ) : <EOL> xlabel ( '<STR_LIT>' ) <EOL> ylabel ( yaxis ) <EOL> xlim ( <NUM_LIT:10> ** <NUM_LIT:3> , <NUM_LIT:10> ** <NUM_LIT:8> ) <EOL> title ( gtitle ) <EOL> grid ( True ) <EOL> if table_size : <EOL> legend ( [ p [ <NUM_LIT:0> ] for p in plots ] , legends , loc = "<STR_LIT>" ) <EOL> else : <EOL> legend ( [ p [ <NUM_LIT:0> ] for p in plots ] , legends , loc = "<STR_LIT>" ) <EOL> if outfile : <EOL> savefig ( outfile ) <EOL> else : <EOL> show ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> import sys <EOL> import getopt <EOL> usage = """<STR_LIT>""" % sys . argv [ <NUM_LIT:0> ] <EOL> try : <EOL> opts , pargs = getopt . getopt ( sys . argv [ <NUM_LIT:1> : ] , '<STR_LIT>' , <EOL> [ '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> ] ) <EOL> except : <EOL> sys . stderr . write ( usage ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> progname = sys . argv [ <NUM_LIT:0> ] <EOL> args = sys . argv [ <NUM_LIT:1> : ] <EOL> if len ( pargs ) < <NUM_LIT:1> : <EOL> sys . stderr . write ( usage ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> outfile = None <EOL> insert = <NUM_LIT:0> <EOL> table_size = <NUM_LIT:0> <EOL> query = <NUM_LIT:0> <EOL> query_cache = <NUM_LIT:0> <EOL> mb_units = <NUM_LIT:0> <EOL> yaxis = "<STR_LIT>" <EOL> tit = None <EOL> gtitle = "<STR_LIT>" <EOL> for option in opts : <EOL> if option [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> outfile = option [ <NUM_LIT:1> ] <EOL> elif option [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> tit = option [ <NUM_LIT:1> ] <EOL> elif option [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> insert = <NUM_LIT:1> <EOL> yaxis = "<STR_LIT>" <EOL> gtitle = "<STR_LIT>" <EOL> elif option [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> table_size = <NUM_LIT:1> <EOL> yaxis = "<STR_LIT>" <EOL> gtitle = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> elif option [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> query = <NUM_LIT:1> <EOL> yaxis = "<STR_LIT>" <EOL> gtitle = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> elif option [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> query_cache = <NUM_LIT:1> <EOL> yaxis = "<STR_LIT>" <EOL> gtitle = ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> elif option [ <NUM_LIT:0> ] == '<STR_LIT>' : <EOL> mb_units = <NUM_LIT:1> <EOL> filenames = pargs <EOL> if mb_units and yaxis == "<STR_LIT>" : <EOL> yaxis = "<STR_LIT>" <EOL> if tit : <EOL> gtitle = tit <EOL> plots = [ ] <EOL> legends = [ ] <EOL> for filename in filenames : <EOL> plegend = filename [ filename . find ( '<STR_LIT>' ) + <NUM_LIT:3> : filename . index ( '<STR_LIT>' ) ] <EOL> plegend = plegend . replace ( '<STR_LIT:->' , '<STR_LIT:U+0020>' ) <EOL> xval , yval = get_values ( filename , '<STR_LIT>' ) <EOL> print ( "<STR_LIT>" % ( filename , xval , yval ) ) <EOL> plots . append ( semilogx ( xval , yval , linewidth = <NUM_LIT:4> ) ) <EOL> legends . append ( plegend ) <EOL> if <NUM_LIT:0> : <EOL> xval = [ <NUM_LIT:1000> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <EOL> <NUM_LIT> , <NUM_LIT> ] <EOL> yval = [ <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <NUM_LIT> , <EOL> <NUM_LIT> , <NUM_LIT> ] <EOL> plots . append ( loglog ( xval , yval , linewidth = <NUM_LIT:5> ) ) <EOL> legends . append ( "<STR_LIT>" ) <EOL> show_plot ( plots , yaxis , legends , gtitle ) </s>
