<s> import sys <EOL> import os <EOL> import subprocess <EOL> def main ( argv ) : <EOL> log_dir = argv [ <NUM_LIT:1> ] <EOL> min_n = argv [ <NUM_LIT:2> ] <EOL> max_n = argv [ <NUM_LIT:3> ] <EOL> unqualified_log_files = os . listdir ( log_dir ) <EOL> log_files = [ os . path . join ( log_dir , filename ) for filename in unqualified_log_files ] <EOL> log_files = filter ( lambda x : "<STR_LIT>" in x , log_files ) <EOL> out_files = [ ] <EOL> for fname in log_files : <EOL> f = open ( fname ) <EOL> ip = fname . split ( "<STR_LIT:/>" ) [ - <NUM_LIT:1> : ] [ <NUM_LIT:0> ] . split ( "<STR_LIT:_>" ) [ <NUM_LIT:2> ] . replace ( "<STR_LIT>" , "<STR_LIT>" ) <EOL> lines = filter ( lambda k : "<STR_LIT>" in k , f . readlines ( ) ) <EOL> lines = lines [ int ( min_n ) : int ( max_n ) ] <EOL> times = map ( lambda x : int ( x . strip ( ) . split ( "<STR_LIT:\t>" ) [ <NUM_LIT:1> ] ) , lines ) <EOL> out_file = ip + "<STR_LIT>" <EOL> out = open ( out_file , '<STR_LIT:w>' ) <EOL> for ( i , time ) in enumerate ( sorted ( times ) ) : <EOL> out . write ( "<STR_LIT>" % ( float ( i ) / len ( times ) , time ) ) <EOL> out . close ( ) <EOL> out_files . append ( ( out_file , ip ) ) <EOL> plot_fname = "<STR_LIT>" <EOL> f = open ( plot_fname , '<STR_LIT:w>' ) <EOL> plot_file = open ( plot_fname , '<STR_LIT:w>' ) <EOL> plot_file . write ( "<STR_LIT>" ) <EOL> plot_file . write ( "<STR_LIT>" ) <EOL> parts = map ( lambda x : "<STR_LIT>" <EOL> % ( x [ <NUM_LIT:0> ] , x [ <NUM_LIT:1> ] ) , out_files ) <EOL> plot = "<STR_LIT>" + "<STR_LIT>" . join ( parts ) <EOL> plot_file . write ( plot + "<STR_LIT:\n>" ) <EOL> plot_file . close ( ) <EOL> subprocess . check_call ( "<STR_LIT>" % plot_fname , shell = True ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( sys . argv ) </s>
