rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
def p_specification(t): 'specification : opt_defs_and_declares name_decl opt_defs_and_declares decode_block' global_decls1 = t[1] isa_name = t[2] namespace = isa_name + "Inst" global_decls2 = t[3] (inst_decls, code) = t[4] code = indent(code) # grab the last three path components of isa_desc_filename filename = '/'.join(isa_desc_filename.split('/')[-3:]) # if the isa_desc file defines a 'rcs_id' string, # echo that into the output too try: local_rcs_id = rcs_id # strip $s out of ID so it doesn't get re-substituted local_rcs_id = re.sub(r'\$', '', local_rcs_id) except NameError: local_rcs_id = 'Id: no RCS id found' output = open(decoder_filename, 'w') # split string to keep rcs from substituting this file's RCS id in print >> output, '/* $Id' + '''$ */
1348e57ac1db70515e007e13dc9d9c6dc5cab547 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/1348e57ac1db70515e007e13dc9d9c6dc5cab547/isa_parser.py
if system is None and hasattr('system', job):
if system is None and hasattr(job, 'system'):
def get(self, job, stat, system=None): run = self.allRunNames.get(str(job), None) if run is None: return None
2c3e8d148cd349e5cb73c0d018271d171da0571c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/2c3e8d148cd349e5cb73c0d018271d171da0571c/db.py
(obj.path, child.path)
(found_obj.path, child.path)
def find_any(self, ptype): if isinstance(self, ptype): return self, True
1e2c16c9124ed3f51229daa715a6c00c2b97f73d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/1e2c16c9124ed3f51229daa715a6c00c2b97f73d/config.py
self.children.sort(lambda x,y: cmp(x.name, y.name))
def display(self): print '[' + self.path + ']' # .ini section header
4b69debac6ce72fe46a8d8b5284c740e338f06f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/4b69debac6ce72fe46a8d8b5284c740e338f06f6/m5config.py
def parse_isa_desc(isa_desc_file, output_dir, include_path):
def parse_isa_desc(isa_desc_file, output_dir):
def parse_isa_desc(isa_desc_file, output_dir, include_path): # set a global var for the input filename... used in error messages global input_filename input_filename = isa_desc_file global fileNameStack fileNameStack = [(input_filename, 1)] # Suck the ISA description file in. input = open(isa_desc_file) isa_desc = input.read() input.close() # Perform Preprocessing isa_desc = preprocess_isa_desc(isa_desc) # Parse it. (isa_name, namespace, global_code, namespace_code) = yacc.parse(isa_desc) # grab the last three path components of isa_desc_file to put in # the output filename = '/'.join(isa_desc_file.split('/')[-3:]) # generate decoder.hh includes = '#include "base/bitfield.hh" // for bitfield support' global_output = global_code.header_output namespace_output = namespace_code.header_output decode_function = '' update_if_needed(output_dir + '/decoder.hh', file_template % vars()) # generate decoder.cc includes = '#include "%s/decoder.hh"' % include_path global_output = global_code.decoder_output namespace_output = namespace_code.decoder_output # namespace_output += namespace_code.decode_block decode_function = namespace_code.decode_block update_if_needed(output_dir + '/decoder.cc', file_template % vars()) # generate per-cpu exec files for cpu in CpuModel.list: includes = '#include "%s/decoder.hh"\n' % include_path includes += cpu.includes global_output = global_code.exec_output[cpu.name] namespace_output = namespace_code.exec_output[cpu.name] decode_function = '' update_if_needed(output_dir + '/' + cpu.filename, file_template % vars())
99484cfae81f3f01ccdfcd273ddc2bdb41e6456b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/99484cfae81f3f01ccdfcd273ddc2bdb41e6456b/isa_parser.py
includes = '
includes = '
def parse_isa_desc(isa_desc_file, output_dir, include_path): # set a global var for the input filename... used in error messages global input_filename input_filename = isa_desc_file global fileNameStack fileNameStack = [(input_filename, 1)] # Suck the ISA description file in. input = open(isa_desc_file) isa_desc = input.read() input.close() # Perform Preprocessing isa_desc = preprocess_isa_desc(isa_desc) # Parse it. (isa_name, namespace, global_code, namespace_code) = yacc.parse(isa_desc) # grab the last three path components of isa_desc_file to put in # the output filename = '/'.join(isa_desc_file.split('/')[-3:]) # generate decoder.hh includes = '#include "base/bitfield.hh" // for bitfield support' global_output = global_code.header_output namespace_output = namespace_code.header_output decode_function = '' update_if_needed(output_dir + '/decoder.hh', file_template % vars()) # generate decoder.cc includes = '#include "%s/decoder.hh"' % include_path global_output = global_code.decoder_output namespace_output = namespace_code.decoder_output # namespace_output += namespace_code.decode_block decode_function = namespace_code.decode_block update_if_needed(output_dir + '/decoder.cc', file_template % vars()) # generate per-cpu exec files for cpu in CpuModel.list: includes = '#include "%s/decoder.hh"\n' % include_path includes += cpu.includes global_output = global_code.exec_output[cpu.name] namespace_output = namespace_code.exec_output[cpu.name] decode_function = '' update_if_needed(output_dir + '/' + cpu.filename, file_template % vars())
99484cfae81f3f01ccdfcd273ddc2bdb41e6456b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/99484cfae81f3f01ccdfcd273ddc2bdb41e6456b/isa_parser.py
includes = '
includes = '
def parse_isa_desc(isa_desc_file, output_dir, include_path): # set a global var for the input filename... used in error messages global input_filename input_filename = isa_desc_file global fileNameStack fileNameStack = [(input_filename, 1)] # Suck the ISA description file in. input = open(isa_desc_file) isa_desc = input.read() input.close() # Perform Preprocessing isa_desc = preprocess_isa_desc(isa_desc) # Parse it. (isa_name, namespace, global_code, namespace_code) = yacc.parse(isa_desc) # grab the last three path components of isa_desc_file to put in # the output filename = '/'.join(isa_desc_file.split('/')[-3:]) # generate decoder.hh includes = '#include "base/bitfield.hh" // for bitfield support' global_output = global_code.header_output namespace_output = namespace_code.header_output decode_function = '' update_if_needed(output_dir + '/decoder.hh', file_template % vars()) # generate decoder.cc includes = '#include "%s/decoder.hh"' % include_path global_output = global_code.decoder_output namespace_output = namespace_code.decoder_output # namespace_output += namespace_code.decode_block decode_function = namespace_code.decode_block update_if_needed(output_dir + '/decoder.cc', file_template % vars()) # generate per-cpu exec files for cpu in CpuModel.list: includes = '#include "%s/decoder.hh"\n' % include_path includes += cpu.includes global_output = global_code.exec_output[cpu.name] namespace_output = namespace_code.exec_output[cpu.name] decode_function = '' update_if_needed(output_dir + '/' + cpu.filename, file_template % vars())
99484cfae81f3f01ccdfcd273ddc2bdb41e6456b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/99484cfae81f3f01ccdfcd273ddc2bdb41e6456b/isa_parser.py
parse_isa_desc(sys.argv[1], sys.argv[2], sys.argv[3])
parse_isa_desc(sys.argv[1], sys.argv[2])
def parse_isa_desc(isa_desc_file, output_dir, include_path): # set a global var for the input filename... used in error messages global input_filename input_filename = isa_desc_file global fileNameStack fileNameStack = [(input_filename, 1)] # Suck the ISA description file in. input = open(isa_desc_file) isa_desc = input.read() input.close() # Perform Preprocessing isa_desc = preprocess_isa_desc(isa_desc) # Parse it. (isa_name, namespace, global_code, namespace_code) = yacc.parse(isa_desc) # grab the last three path components of isa_desc_file to put in # the output filename = '/'.join(isa_desc_file.split('/')[-3:]) # generate decoder.hh includes = '#include "base/bitfield.hh" // for bitfield support' global_output = global_code.header_output namespace_output = namespace_code.header_output decode_function = '' update_if_needed(output_dir + '/decoder.hh', file_template % vars()) # generate decoder.cc includes = '#include "%s/decoder.hh"' % include_path global_output = global_code.decoder_output namespace_output = namespace_code.decoder_output # namespace_output += namespace_code.decode_block decode_function = namespace_code.decode_block update_if_needed(output_dir + '/decoder.cc', file_template % vars()) # generate per-cpu exec files for cpu in CpuModel.list: includes = '#include "%s/decoder.hh"\n' % include_path includes += cpu.includes global_output = global_code.exec_output[cpu.name] namespace_output = namespace_code.exec_output[cpu.name] decode_function = '' update_if_needed(output_dir + '/' + cpu.filename, file_template % vars())
99484cfae81f3f01ccdfcd273ddc2bdb41e6456b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/99484cfae81f3f01ccdfcd273ddc2bdb41e6456b/isa_parser.py
def clearPCSymbol(option, opt_str, value, parser): objects.ExecutionTrace.pc_symbol = False def clearPrintCycle(option, opt_str, value, parser): objects.ExecutionTrace.print_cycle = False
def setTraceFile(option, opt_str, value, parser): objects.Trace.file = value def usePCSymbol(option, opt_str, value, parser): objects.ExecutionTrace.pc_symbol = value def printCycle(option, opt_str, value, parser): objects.ExecutionTrace.print_cycle = value def printOp(option, opt_str, value, parser): objects.ExecutionTrace.print_opclass = value def printThread(option, opt_str, value, parser): objects.ExecutionTrace.print_thread = value def printEA(option, opt_str, value, parser): objects.ExecutionTrace.print_effaddr = value def printData(option, opt_str, value, parser): objects.ExecutionTrace.print_data = value def printFetchseq(option, opt_str, value, parser): objects.ExecutionTrace.print_fetchseq = value def printCpseq(option, opt_str, value, parser): objects.ExecutionTrace.print_cpseq = value def dumpOnExit(option, opt_str, value, parser): objects.Trace.dump_on_exit = value def debugBreak(option, opt_str, value, parser): objects.Debug.break_cycles = value
def clearPCSymbol(option, opt_str, value, parser): objects.ExecutionTrace.pc_symbol = False
e889b8242301b1123ffd4c05862f84826dd77806 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/e889b8242301b1123ffd4c05862f84826dd77806/__init__.py
optparse.make_option("--nopcsymbol", action="callback", callback=clearPCSymbol, help="Turn off printing PC symbols in trace output"), optparse.make_option("--noprintcycle", action="callback", callback=clearPrintCycle, help="Turn off printing cycles in trace output"),
optparse.make_option("--tracefile", type="string", action="callback", callback=setTraceFile), optparse.make_option("--pcsymbol", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=usePCSymbol, help="Use PC symbols in trace output"), optparse.make_option("--printcycle", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=printCycle, help="Print cycle numbers in trace output"), optparse.make_option("--printopclass", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=printOp, help="Print cycle numbers in trace output"), optparse.make_option("--printthread", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=printThread, help="Print thread number in trace output"), optparse.make_option("--printeffaddr", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=printEA, help="Print effective address in trace output"), optparse.make_option("--printdata", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=printData, help="Print result data in trace output"), optparse.make_option("--printfetchseq", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=printFetchseq, help="Print fetch sequence numbers in trace output"), optparse.make_option("--printcpseq", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=printCpseq, help="Print correct path sequence numbers in trace output"), optparse.make_option("--dumponexit", type="choice", choices=TrueOrFalse, default="True", metavar=TorF, action="callback", callback=dumpOnExit, help="Dump trace buffer on exit"), optparse.make_option("--debugbreak", type="int", metavar="CYCLE", action="callback", callback=debugBreak, help="Cycle to create a breakpoint"),
def statsTextFile(option, opt_str, value, parser): objects.Statistics.text_file = value
e889b8242301b1123ffd4c05862f84826dd77806 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/e889b8242301b1123ffd4c05862f84826dd77806/__init__.py
if isinstance(self, System):
if isinstance(self, m5.objects.System):
def changeTiming(self, mode): if isinstance(self, System): self._ccObject.setMemoryMode(mode) for child in self._children.itervalues(): child.changeTiming(mode)
8acecfef9b0e9a1c34b338a6862a3cc38b2f490b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/8acecfef9b0e9a1c34b338a6862a3cc38b2f490b/SimObject.py
def m5execfile(f, global_dict): oldpath = sys.path[:] sys.path.insert(0, os.path.abspath(os.path.dirname(f))) execfile(f, global_dict) sys.path = oldpath
def panic(string): print >>sys.stderr, 'panic:', string sys.exit(1)
845bdb0d8edf3c8e5f8871eba984933bfca6a743 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/845bdb0d8edf3c8e5f8871eba984933bfca6a743/__init__.py
if os.path.isdir(path) and path not in sys.path: sys.path.append(path)
sys.path.insert(1, path)
def AddToPath(path): path = os.path.realpath(path) if os.path.isdir(path) and path not in sys.path: sys.path.append(path)
845bdb0d8edf3c8e5f8871eba984933bfca6a743 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/845bdb0d8edf3c8e5f8871eba984933bfca6a743/__init__.py
eval("%s = %s" % (var, repr(val)))
exec "%s = %s" % (var, repr(val))
def AddToPath(path): # if it's a relative path and we know what directory the current # python script is in, make the path relative to that directory. if not os.path.isabs(path) and sys.path[0]: path = os.path.join(sys.path[0], path) path = os.path.realpath(path) # sys.path[0] should always refer to the current script's directory, # so place the new dir right after that. sys.path.insert(1, path)
6fa114640604e31433be5821be80effb3ea927ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6fa114640604e31433be5821be80effb3ea927ea/__init__.py
fname = '/n/ziff/z/binkertn/graph/data.ibm/%s.%s.dat' % (tag, base)
fname = '/n/ziff/z/binkertn/graph/test0/data/%s.%s.dat' % (tag, base)
def graphdata(runs, tag, label, value): import info configs = ['std', 'csa', 'ht1', 'ht4', 'htx', 'ocm', 'occ', 'ocp' ] benchmarks = [ 'm', 's' ] dmas = [ 'x', 'd', 'b' ] caches = [ '1', '2', '3', '4', '5' ] systems = [ 'M' ] checkpoints = [ '1' ] names = [] for bench in benchmarks: for dma in dmas: for cache in caches: for sys in systems: for cpt in checkpoints: names.append([bench, dma, cache, sys, cpt]) for bench,dma,cache,sys,cpt in names: base = '%s.%s.%s.%s.%s' % (bench, dma, cache, sys, cpt) fname = '/n/ziff/z/binkertn/graph/data.ibm/%s.%s.dat' % (tag, base) f = open(fname, 'w') print >>f, '#set TITLE = %s' % base print >>f, '#set xlbl = Configuration' print >>f, '#set ylbl = %s' % label print >>f, '#set sublabels = %s' % ' '.join(configs) for speed,freq in zip(['s', 'q'],['4GHz','10GHz']): print >>f, '"%s"' % freq, for conf in configs: name = '%s.%s.%s.%s.%s.%s.%s' % (conf, bench, dma, speed, cache, sys, cpt) run = info.source.allRunNames[name] info.display_run = run.run; val = float(value) if val == 1e300*1e300: print >>f, 0.0, else: print >>f, "%f" % val, print >>f f.close()
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if binned:
if options.binned:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if binned:
if options.binned:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if binned:
if options.binned:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if binned:
if options.binned:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
if graph:
if options.graph:
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
graph = False binned = False
def commands(options, command, args): if command == 'database': if len(args) == 0: raise CommandException import dbinit mydb = dbinit.MyDB(options) if args[0] == 'drop': if len(args) > 2: raise CommandException mydb.admin() mydb.drop() if len(args) == 2 and args[1] == 'init': mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'init': if len(args) > 1: raise CommandException mydb.admin() mydb.create() mydb.connect() mydb.populate() mydb.close() return if args[0] == 'clean': if len(args) > 1: raise CommandException mydb.connect() mydb.clean() return raise CommandException import db, info info.source = db.Database() info.source.host = options.host info.source.db = options.db info.source.passwd = options.passwd info.source.user = options.user info.source.connect() info.source.update_dict(globals()) system = info.source.__dict__[options.system] if type(options.get) is str: info.source.get = options.get if options.runs is None: runs = info.source.allRuns else: rx = re.compile(options.runs) runs = [] for run in info.source.allRuns: if rx.match(run.name): runs.append(run) info.display_run = runs[0].run if command == 'runs': user = None opts, args = getopts(args, '-u') if len(args): raise CommandException for o,a in opts: if o == '-u': user = a info.source.listRuns(user) return if command == 'stats': if len(args) == 0: info.source.listStats() elif len(args) == 1: info.source.listStats(args[0]) else: raise CommandException return if command == 'stat': if len(args) != 1: raise CommandException stats = info.source.getStat(args[0]) for stat in stats: if graph: graphdata(runs, stat.name, stat.name, stat) else: print stat.name printdata(runs, stat) return if command == 'bins': if len(args) == 0: info.source.listBins() elif len(args) == 1: info.source.listBins(args[0]) else: raise CommandException return if command == 'formulas': if len(args) == 0: info.source.listFormulas() elif len(args) == 1: info.source.listFormulas(args[0]) else: raise CommandException return if command == 'samples': if len(args): raise CommandException info.source.listTicks(runs) return if len(args): raise CommandException if command == 'usertime': import copy kernel = copy.copy(system.full_cpu.numCycles) kernel.bins = 'kernel' user = copy.copy(system.full_cpu.numCycles) user.bins = 'user' if graph: graphdata(runs, 'usertime', 'User Fraction', user / system.full_cpu.numCycles) else: printdata(runs, user / system.full_cpu.numCycles) return if command == 'ticks': if binned: print 'kernel ticks' system.full_cpu.numCycles.bins = 'kernel' printdata(runs, system.full_cpu.numCycles) print 'idle ticks' system.full_cpu.numCycles.bins = 'idle' printdata(runs, system.full_cpu.numCycles) print 'user ticks' system.full_cpu.numCycles.bins = 'user' printdata(runs, system.full_cpu.numCycles) print 'total ticks' system.full_cpu.numCycles.bins = None printdata(runs, system.full_cpu.numCycles) return if command == 'packets': packets = system.tsunami.nsgige.rxPackets if graph: graphdata(runs, 'packets', 'Packets', packets) else: printdata(runs, packets) return if command == 'ppt' or command == 'tpp': ppt = system.tsunami.nsgige.rxPackets / sim_ticks printdata(runs, ppt, command == 'tpp') return if command == 'pps': pps = system.tsunami.nsgige.rxPackets / sim_seconds if graph: graphdata(runs, 'pps', 'Packets/s', pps) else: printdata(runs, pps) return if command == 'bpt' or command == 'tpb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes bpt = bytes / sim_ticks * 8 if graph: graphdata(runs, 'bpt', 'bps / Hz', bpt) else: printdata(runs, bpt, command == 'tpb') return if command == 'bptb' or command == 'tpbb': bytes = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes print 'kernel stats' bytes.bins = 'kernel' printdata(runs, bytes / ticks) print 'idle stats' bytes.bins = 'idle' printdata(runs, bytes / ticks) print 'user stats' bytes.bins = 'user' printdata(runs, bytes / ticks) return if command == 'bytes': stat = system.tsunami.nsgige.rxBytes + system.tsunami.nsgige.txBytes if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None printdata(runs, stat) return if command == 'rxbps': gbps = system.tsunami.nsgige.rxBandwidth / 1e9 if graph: graphdata(runs, 'rxbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'txbps': gbps = system.tsunami.nsgige.txBandwidth / 1e9 if graph: graphdata(runs, 'txbps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'bps': rxbps = system.tsunami.nsgige.rxBandwidth txbps = system.tsunami.nsgige.txBandwidth gbps = (rxbps + txbps) / 1e9 if graph: graphdata(runs, 'bps', 'Bandwidth (Gbps)', gbps) else: printdata(runs, gbps) return if command == 'misses': stat = system.L3.overall_mshr_misses if binned: print '%s kernel stats' % stat.name stat.bins = 'kernel' printdata(runs, stat) print '%s idle stats' % stat.name stat.bins = 'idle' printdata(runs, stat) print '%s user stats' % stat.name stat.bins = 'user' printdata(runs, stat) print '%s total stats' % stat.name stat.bins = None if graph: graphdata(runs, 'misses', 'Overall MSHR Misses', stat) else: printdata(runs, stat) return if command == 'mpkb': misses = system.L3.overall_mshr_misses rxbytes = system.tsunami.nsgige.rxBytes txbytes = system.tsunami.nsgige.txBytes if binned: print 'mpkb kernel stats' misses.bins = 'kernel' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb idle stats' misses.bins = 'idle' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb user stats' misses.bins = 'user' mpkb = misses / ((rxbytes + txbytes) / 1024) printdata(runs, mpkb) print 'mpkb total stats' mpkb = misses / ((rxbytes + txbytes) / 1024) misses.bins = None if graph: graphdata(runs, 'mpkb', 'Misses / KB', mpkb) else: printdata(runs, mpkb) return if command == 'execute': printdata(runs, system.full_cpu.ISSUE__count) return if command == 'commit': printdata(runs, system.full_cpu.COM__count) return if command == 'fetch': printdata(runs, system.full_cpu.FETCH__count) return if command == 'rxbpp': bpp = system.tsunami.nsgige.rxBytes / system.tsunami.nsgige.rxPackets printdata(run, 8 * bpp) return if command == 'txbpp': bpp = system.tsunami.nsgige.txBytes / system.tsunami.nsgige.txPackets printdata(run, 8 * bpp) return raise CommandException
a40715c98d9a53362cc6c6f7ffdedff4e862ba3b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/a40715c98d9a53362cc6c6f7ffdedff4e862ba3b/stats.py
sys.exit(*args, **kwargs)
print >>sys.stderr, 'panic:', string sys.exit(1)
def panic(*args, **kwargs): sys.exit(*args, **kwargs)
89ba024b9843719bf06a9c3efaaf1b137dee2a12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/89ba024b9843719bf06a9c3efaaf1b137dee2a12/m5config.py
if os.path.isdir(path):
if os.path.isdir(path) and path not in sys.path:
def AddToPath(path): path = os.path.realpath(path) if os.path.isdir(path): sys.path.append(path)
89ba024b9843719bf06a9c3efaaf1b137dee2a12 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/89ba024b9843719bf06a9c3efaaf1b137dee2a12/m5config.py
maxtick = -1
from m5 import MaxTick maxtick = MaxTick
def binpath(app, file=None): # executable has same name as app unless specified otherwise if not file: file = app return os.path.join(test_progs, app, 'bin', isa, opsys, file)
32f676fed2fd8855f7c485e9ac4fc9db43e65dd3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/32f676fed2fd8855f7c485e9ac4fc9db43e65dd3/run.py
exportContextSymbols = ('InstObjParams', 'CodeBlock', 'makeList', 're', 'string')
exportContextSymbols = ('InstObjParams', 'makeList', 're', 'string')
def wrap_decode_block(self, pre, post = ''): self.decode_block = pre + indent(self.decode_block) + post
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
myDict = templateMap.copy() if isinstance(d, dict): myDict.update(d) elif hasattr(d, '__dict__'): myDict.update(d.__dict__) else: raise TypeError, "Template.subst() arg must be or have dictionary"
myDict = None
def subst(self, d): # Start with the template namespace. Make a copy since we're # going to modify it. myDict = templateMap.copy() # if the argument is a dictionary, we just use it. if isinstance(d, dict): myDict.update(d) # if the argument is an object, we use its attribute map. elif hasattr(d, '__dict__'): myDict.update(d.__dict__) else: raise TypeError, "Template.subst() arg must be or have dictionary" # Protect non-Python-dict substitutions (e.g. if there's a printf # in the templated C++ code) template = protect_non_subst_percents(self.template) # CPU-model-specific substitutions are handled later (in GenCode). template = protect_cpu_symbols(template) return template % myDict
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
c += '\n\t_srcRegIdx[%d] = %s;' % \
c += '\n\t_srcRegIdx[%d] = %s + Ctrl_Base_DepTag;' % \
def makeConstructor(self): c = '' if self.is_src: c += '\n\t_srcRegIdx[%d] = %s;' % \ (self.src_reg_idx, self.reg_spec) if self.is_dest: c += '\n\t_destRegIdx[%d] = %s;' % \ (self.dest_reg_idx, self.reg_spec) return c
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
c += '\n\t_destRegIdx[%d] = %s;' % \
c += '\n\t_destRegIdx[%d] = %s + Ctrl_Base_DepTag;' % \
def makeConstructor(self): c = '' if self.is_src: c += '\n\t_srcRegIdx[%d] = %s;' % \ (self.src_reg_idx, self.reg_spec) if self.is_dest: c += '\n\t_destRegIdx[%d] = %s;' % \ (self.dest_reg_idx, self.reg_spec) return c
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
base = 'xc->readMiscReg(%s)' % self.reg_spec
base = 'xc->readMiscRegOperand(this, %s)' % self.src_reg_idx
def makeRead(self): bit_select = 0 if (self.ctype == 'float' or self.ctype == 'double'): error(0, 'Attempt to read control register as FP') base = 'xc->readMiscReg(%s)' % self.reg_spec if self.size == self.dflt_size: return '%s = %s;\n' % (self.base_name, base) else: return '%s = bits(%s, %d, 0);\n' % \ (self.base_name, base, self.size-1)
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
wb = 'xc->setMiscRegWithEffect(%s, %s);\n' % (self.reg_spec, self.base_name)
wb = 'xc->setMiscRegOperandWithEffect(this, %s, %s);\n' % \ (self.dest_reg_idx, self.base_name)
def makeWrite(self): if (self.ctype == 'float' or self.ctype == 'double'): error(0, 'Attempt to write control register as FP') wb = 'xc->setMiscRegWithEffect(%s, %s);\n' % (self.reg_spec, self.base_name) wb += 'if (traceData) { traceData->setData(%s); }' % \ self.base_name return wb
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
class CodeBlock: def __init__(self, code): self.orig_code = code self.operands = OperandList(code) self.code = substMungedOpNames(substBitOps(code))
instFlagRE = re.compile(r'Is.*') opClassRE = re.compile(r'.*Op|No_OpClass') class InstObjParams: def __init__(self, mnem, class_name, base_class = '', snippets = None, opt_args = []): self.mnemonic = mnem self.class_name = class_name self.base_class = base_class compositeCode = '' if snippets: if not isinstance(snippets, dict): snippets = {'code' : snippets} for snippet in snippets.values(): if isinstance(snippet, str): compositeCode += (" " + snippet) self.snippets = snippets self.operands = OperandList(compositeCode)
def makeFlagConstructor(flag_list): if len(flag_list) == 0: return '' # filter out repeated flags flag_list.sort() i = 1 while i < len(flag_list): if flag_list[i] == flag_list[i-1]: del flag_list[i] else: i += 1 pre = '\n\tflags[' post = '] = true;' code = pre + string.join(flag_list, post + pre) + post return code
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
self.op_decl = self.operands.concatAttrStrings('op_decl') is_src = lambda op: op.is_src is_dest = lambda op: op.is_dest self.op_src_decl = \ self.operands.concatSomeAttrStrings(is_src, 'op_src_decl') self.op_dest_decl = \ self.operands.concatSomeAttrStrings(is_dest, 'op_dest_decl') self.op_rd = self.operands.concatAttrStrings('op_rd') self.op_wb = self.operands.concatAttrStrings('op_wb')
def __init__(self, code): self.orig_code = code self.operands = OperandList(code) self.code = substMungedOpNames(substBitOps(code)) self.constructor = self.operands.concatAttrStrings('constructor') self.constructor += \ '\n\t_numSrcRegs = %d;' % self.operands.numSrcRegs self.constructor += \ '\n\t_numDestRegs = %d;' % self.operands.numDestRegs self.constructor += \ '\n\t_numFPDestRegs = %d;' % self.operands.numFPDestRegs self.constructor += \ '\n\t_numIntDestRegs = %d;' % self.operands.numIntDestRegs
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
if self.operands.memOperand: self.mem_acc_size = self.operands.memOperand.mem_acc_size self.mem_acc_type = self.operands.memOperand.mem_acc_type
def __init__(self, code): self.orig_code = code self.operands = OperandList(code) self.code = substMungedOpNames(substBitOps(code)) self.constructor = self.operands.concatAttrStrings('constructor') self.constructor += \ '\n\t_numSrcRegs = %d;' % self.operands.numSrcRegs self.constructor += \ '\n\t_numDestRegs = %d;' % self.operands.numDestRegs self.constructor += \ '\n\t_numFPDestRegs = %d;' % self.operands.numFPDestRegs self.constructor += \ '\n\t_numIntDestRegs = %d;' % self.operands.numIntDestRegs
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
def __init__(self, code): self.orig_code = code self.operands = OperandList(code) self.code = substMungedOpNames(substBitOps(code)) self.constructor = self.operands.concatAttrStrings('constructor') self.constructor += \ '\n\t_numSrcRegs = %d;' % self.operands.numSrcRegs self.constructor += \ '\n\t_numDestRegs = %d;' % self.operands.numDestRegs self.constructor += \ '\n\t_numFPDestRegs = %d;' % self.operands.numFPDestRegs self.constructor += \ '\n\t_numIntDestRegs = %d;' % self.operands.numIntDestRegs
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
instFlagRE = re.compile(r'Is.*') opClassRE = re.compile(r'.*Op|No_OpClass') class InstObjParams: def __init__(self, mnem, class_name, base_class = '', code = None, opt_args = [], extras = {}): self.mnemonic = mnem self.class_name = class_name self.base_class = base_class if code: if isinstance(code, CodeBlock): origCode = code.orig_code codeBlock = code else: origCode = code codeBlock = CodeBlock(code) stringExtras = {} otherExtras = {} for (k, v) in extras.items(): if type(v) == str: stringExtras[k] = v else: otherExtras[k] = v compositeCode = "\n".join([origCode] + stringExtras.values()) compositeBlock = CodeBlock(compositeCode) for code_attr in compositeBlock.__dict__.keys(): setattr(self, code_attr, getattr(compositeBlock, code_attr)) for (key, snippet) in stringExtras.items(): setattr(self, key, CodeBlock(snippet).code) for (key, item) in otherExtras.items(): setattr(self, key, item) self.code = codeBlock.code self.orig_code = origCode else: self.constructor = '' self.flags = []
def __init__(self, code): self.orig_code = code self.operands = OperandList(code) self.code = substMungedOpNames(substBitOps(code)) self.constructor = self.operands.concatAttrStrings('constructor') self.constructor += \ '\n\t_numSrcRegs = %d;' % self.operands.numSrcRegs self.constructor += \ '\n\t_numDestRegs = %d;' % self.operands.numDestRegs self.constructor += \ '\n\t_numFPDestRegs = %d;' % self.operands.numFPDestRegs self.constructor += \ '\n\t_numIntDestRegs = %d;' % self.operands.numIntDestRegs
6aa06a26b7e0c1e44427aa5360cba5662f2907c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/6aa06a26b7e0c1e44427aa5360cba5662f2907c9/isa_parser.py
print parser.help
parser.print_help()
def usage(exitcode=None): print parser.help if exitcode is not None: sys.exit(exitcode)
e1b8e71500b7b66b115345eeaef7216617487456 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/e1b8e71500b7b66b115345eeaef7216617487456/main.py
global fileNameStack fileNameStack.append((t.value[11:-1], t.lineno))
fileNameStack.push((t.value[11:-1], t.lineno))
def t_NEWFILE(t): r'^\#\#newfile\s+"[\w/.-]*"' global fileNameStack fileNameStack.append((t.value[11:-1], t.lineno)) t.lineno = 0
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
(filename, t.lineno) = fileNameStack.pop()
(old_filename, t.lineno) = fileNameStack.pop()
def t_ENDFILE(t): r'^\#\#endfile' (filename, t.lineno) = fileNameStack.pop()
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
error_bt(0, "unknown syntax error")
error(0, "unknown syntax error", True)
def p_error(t): if t: error(t.lineno, "syntax error at '%s'" % t.value) else: error_bt(0, "unknown syntax error")
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
def error(lineno, string):
def error(lineno, string, print_traceback = False):
def fixPythonIndentation(s): # get rid of blank lines first s = re.sub(r'(?m)^\s*\n', '', s); if (s != '' and re.match(r'[ \t]', s[0])): s = 'if 1:\n' + s return s
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
print spaces + "In file included from " + filename
print spaces + "In file included from " + filename + ":"
def error(lineno, string): spaces = "" for (filename, line) in fileNameStack[0:-1]: print spaces + "In file included from " + filename spaces += " " # Uncomment the following line to get a Python stack backtrace for # these errors too. Can be handy when trying to debug the parser. # traceback.print_exc() sys.exit(spaces + "%s:%d: %s" % (fileNameStack[-1][0], lineno, string))
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
sys.exit(spaces + "%s:%d: %s" % (fileNameStack[-1][0], lineno, string)) def error_bt(lineno, string): traceback.print_exc() print >> sys.stderr, "%s:%d: %s" % (input_filename, lineno, string) sys.exit(1)
if (print_traceback): traceback.print_exc() if lineno != 0: line_str = "%d:" % lineno else: line_str = "" sys.exit(spaces + "%s:%s %s" % (fileNameStack[-1][0], line_str, string))
def error(lineno, string): spaces = "" for (filename, line) in fileNameStack[0:-1]: print spaces + "In file included from " + filename spaces += " " # Uncomment the following line to get a Python stack backtrace for # these errors too. Can be handy when trying to debug the parser. # traceback.print_exc() sys.exit(spaces + "%s:%d: %s" % (fileNameStack[-1][0], lineno, string))
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
error(0, 'Unrecognized type description "%s" in userDict')
error(lineno, 'Unrecognized type description "%s" in userDict')
def buildOperandTypeMap(userDict, lineno): global operandTypeMap operandTypeMap = {} for (ext, (desc, size)) in userDict.iteritems(): if desc == 'signed int': ctype = 'int%d_t' % size is_signed = 1 elif desc == 'unsigned int': ctype = 'uint%d_t' % size is_signed = 0 elif desc == 'float': is_signed = 1 # shouldn't really matter if size == 32: ctype = 'float' elif size == 64: ctype = 'double' if ctype == '': error(0, 'Unrecognized type description "%s" in userDict') operandTypeMap[ext] = (size, ctype, is_signed)
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
def update_if_needed(file, contents): update = False if os.access(file, os.R_OK): f = open(file, 'r') old_contents = f.read() f.close() if contents != old_contents: print 'Updating', file os.remove(file) # in case it's write-protected update = True else: print 'File', file, 'is unchanged' else: print 'Generating', file update = True if update: f = open(file, 'w') f.write(contents) f.close()
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
def preprocess_isa_desc(isa_desc):
def replace_include(matchobj, dirname): fname = matchobj.group('filename') full_fname = os.path.normpath(os.path.join(dirname, fname)) contents = ' (full_fname, read_and_flatten(full_fname)) return contents def read_and_flatten(filename): current_dir = os.path.dirname(filename) try: contents = open(filename).read() except IOError: error(0, 'Error including file "%s"' % filename) fileNameStack.push((filename, 0))
def preprocess_isa_desc(isa_desc): # Find any includes and include them pos = 0 while 1: m = includeRE.search(isa_desc, pos) if not m: break filename = m.group('filename') print 'Including file "%s"' % filename try: isa_desc = isa_desc[:m.start()] + \ '##newfile "' + filename + '"\n' + \ open(filename).read() + \ '##endfile\n' + \ isa_desc[m.end():] except IOError: error(0, 'Error including file "%s"' % (filename)) pos = m.start() return isa_desc
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
pos = 0 while 1: m = includeRE.search(isa_desc, pos) if not m: break filename = m.group('filename') print 'Including file "%s"' % filename try: isa_desc = isa_desc[:m.start()] + \ ' open(filename).read() + \ ' isa_desc[m.end():] except IOError: error(0, 'Error including file "%s"' % (filename)) pos = m.start() return isa_desc
contents = includeRE.sub(lambda m: replace_include(m, current_dir), contents) fileNameStack.pop() return contents
def preprocess_isa_desc(isa_desc): # Find any includes and include them pos = 0 while 1: m = includeRE.search(isa_desc, pos) if not m: break filename = m.group('filename') print 'Including file "%s"' % filename try: isa_desc = isa_desc[:m.start()] + \ '##newfile "' + filename + '"\n' + \ open(filename).read() + \ '##endfile\n' + \ isa_desc[m.end():] except IOError: error(0, 'Error including file "%s"' % (filename)) pos = m.start() return isa_desc
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
global input_filename input_filename = isa_desc_file global fileNameStack fileNameStack = [(input_filename, 1)] input = open(isa_desc_file) isa_desc = input.read() input.close() isa_desc = preprocess_isa_desc(isa_desc)
isa_desc = read_and_flatten(isa_desc_file) fileNameStack.push((isa_desc_file, 0))
def parse_isa_desc(isa_desc_file, output_dir): # set a global var for the input filename... used in error messages global input_filename input_filename = isa_desc_file global fileNameStack fileNameStack = [(input_filename, 1)] # Suck the ISA description file in. input = open(isa_desc_file) isa_desc = input.read() input.close() # Perform Preprocessing isa_desc = preprocess_isa_desc(isa_desc) # Parse it. (isa_name, namespace, global_code, namespace_code) = yacc.parse(isa_desc) # grab the last three path components of isa_desc_file to put in # the output filename = '/'.join(isa_desc_file.split('/')[-3:]) # generate decoder.hh includes = '#include "base/bitfield.hh" // for bitfield support' global_output = global_code.header_output namespace_output = namespace_code.header_output decode_function = '' update_if_needed(output_dir + '/decoder.hh', file_template % vars()) # generate decoder.cc includes = '#include "decoder.hh"' global_output = global_code.decoder_output namespace_output = namespace_code.decoder_output # namespace_output += namespace_code.decode_block decode_function = namespace_code.decode_block update_if_needed(output_dir + '/decoder.cc', file_template % vars()) # generate per-cpu exec files for cpu in cpu_models: includes = '#include "decoder.hh"\n' includes += cpu.includes global_output = global_code.exec_output[cpu.name] namespace_output = namespace_code.exec_output[cpu.name] decode_function = '' update_if_needed(output_dir + '/' + cpu.filename, file_template % vars())
5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5d3a1e8f65a741ff8f76e5cf45fa6da894c14d99/isa_parser.py
s = re.sub(r'%(?!\()', '%%', s)
s = protect_non_subst_percents(s)
def process_output(s): # protect any non-substitution '%'s (not followed by '(') s = re.sub(r'%(?!\()', '%%', s) # protects cpu-specific symbols too s = protect_cpu_symbols(s) return substBitOps(s % templateMap)
11cb904ad7c617e6653ce1ca52a92f10efe53025 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/11cb904ad7c617e6653ce1ca52a92f10efe53025/isa_parser.py
return protect_cpu_symbols(self.template) % myDict
template = protect_cpu_symbols(template) return template % myDict
def subst(self, d): # Start with the template namespace. Make a copy since we're # going to modify it. myDict = templateMap.copy() # if the argument is a dictionary, we just use it. if isinstance(d, dict): myDict.update(d) # if the argument is an object, we use its attribute map. elif hasattr(d, '__dict__'): myDict.update(d.__dict__) else: raise TypeError, "Template.subst() arg must be or have dictionary" # CPU-model-specific substitutions are handled later (in GenCode). return protect_cpu_symbols(self.template) % myDict
11cb904ad7c617e6653ce1ca52a92f10efe53025 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/11cb904ad7c617e6653ce1ca52a92f10efe53025/isa_parser.py
def panic(*args, **kwargs):
def panic(string):
def panic(*args, **kwargs): print >>sys.stderr, 'panic:', string sys.exit(1)
b78b6341078624cf476e84475b088798609b4cef /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/b78b6341078624cf476e84475b088798609b4cef/m5config.py
path = [ '/dist/m5/system' ]
path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ]
def load_defaults(): global systemdir, bindir, diskdir, scriptdir if not systemdir: try: path = env['M5_PATH'].split(':') except KeyError: path = [ '/dist/m5/system' ] for systemdir in path: if os.path.isdir(systemdir): break else: raise ImportError, "Can't find a path to system files." if not bindir: bindir = joinpath(systemdir, 'binaries') if not diskdir: diskdir = joinpath(systemdir, 'disks') if not scriptdir: scriptdir = joinpath(systemdir, 'boot')
69c34554e5d621d45ce68cbd643baf9b0d049240 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/69c34554e5d621d45ce68cbd643baf9b0d049240/SysPaths.py
jl.append(jobname)
jl.append(jobname)
def nfspath(dir): if dir.startswith('/.automount/'): dir = '/n/%s' % dir[12:] elif not dir.startswith('/n/'): dir = '/n/%s%s' % (socket.gethostname().split('.')[0], dir) return dir
5e9bc06457923893d5acf049ab5d1dd621a865cc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/5e9bc06457923893d5acf049ab5d1dd621a865cc/send.py
__all__ = ['env', 'issequence',
__all__ = ['env', 'issequence', 'panic',
def instantiate(root): instance = root.instantiate('root') instance.fixup() instance.display() if not noDot: dot = pydot.Dot() instance.outputDot(dot) dot.orientation = "portrait" dot.size = "8.5,11" dot.ranksep="equally" dot.rank="samerank" dot.write("config.dot") dot.write_ps("config.ps")
82964b2705b892f5d36522f7b7c5472975a5d873 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/82964b2705b892f5d36522f7b7c5472975a5d873/config.py
eval(args_left.pop(0))
exec args_left.pop(0)
def AddToPath(path): # if it's a relative path and we know what directory the current # python script is in, make the path relative to that directory. if not os.path.isabs(path) and sys.path[0]: path = os.path.join(sys.path[0], path) path = os.path.realpath(path) # sys.path[0] should always refer to the current script's directory, # so place the new dir right after that. sys.path.insert(1, path)
295c7a908cfeecc7276f559ff53282a177f4eb66 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/295c7a908cfeecc7276f559ff53282a177f4eb66/__init__.py
return float(value[:-3]) * tera
return float(value[:-4]) * tera
def toNetworkBandwidth(value): if not isinstance(value, str): raise TypeError, "wrong type '%s' should be str" % type(value) if value.endswith('Tbps'): return float(value[:-3]) * tera elif value.endswith('Gbps'): return float(value[:-3]) * giga elif value.endswith('Mbps'): return float(value[:-3]) * mega elif value.endswith('kbps'): return float(value[:-3]) * kilo elif value.endswith('bps'): return float(value[:-2]) else: return float(value) raise ValueError, "cannot convert '%s' to network bandwidth" % value
f3544a13f3559e1e51b1f039e6613d5c47e41fa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/f3544a13f3559e1e51b1f039e6613d5c47e41fa8/convert.py
return float(value[:-3]) * giga
return float(value[:-4]) * giga
def toNetworkBandwidth(value): if not isinstance(value, str): raise TypeError, "wrong type '%s' should be str" % type(value) if value.endswith('Tbps'): return float(value[:-3]) * tera elif value.endswith('Gbps'): return float(value[:-3]) * giga elif value.endswith('Mbps'): return float(value[:-3]) * mega elif value.endswith('kbps'): return float(value[:-3]) * kilo elif value.endswith('bps'): return float(value[:-2]) else: return float(value) raise ValueError, "cannot convert '%s' to network bandwidth" % value
f3544a13f3559e1e51b1f039e6613d5c47e41fa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/f3544a13f3559e1e51b1f039e6613d5c47e41fa8/convert.py
return float(value[:-3]) * mega
return float(value[:-4]) * mega
def toNetworkBandwidth(value): if not isinstance(value, str): raise TypeError, "wrong type '%s' should be str" % type(value) if value.endswith('Tbps'): return float(value[:-3]) * tera elif value.endswith('Gbps'): return float(value[:-3]) * giga elif value.endswith('Mbps'): return float(value[:-3]) * mega elif value.endswith('kbps'): return float(value[:-3]) * kilo elif value.endswith('bps'): return float(value[:-2]) else: return float(value) raise ValueError, "cannot convert '%s' to network bandwidth" % value
f3544a13f3559e1e51b1f039e6613d5c47e41fa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/f3544a13f3559e1e51b1f039e6613d5c47e41fa8/convert.py
return float(value[:-3]) * kilo
return float(value[:-4]) * kilo
def toNetworkBandwidth(value): if not isinstance(value, str): raise TypeError, "wrong type '%s' should be str" % type(value) if value.endswith('Tbps'): return float(value[:-3]) * tera elif value.endswith('Gbps'): return float(value[:-3]) * giga elif value.endswith('Mbps'): return float(value[:-3]) * mega elif value.endswith('kbps'): return float(value[:-3]) * kilo elif value.endswith('bps'): return float(value[:-2]) else: return float(value) raise ValueError, "cannot convert '%s' to network bandwidth" % value
f3544a13f3559e1e51b1f039e6613d5c47e41fa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/f3544a13f3559e1e51b1f039e6613d5c47e41fa8/convert.py
return float(value[:-2])
return float(value[:-3])
def toNetworkBandwidth(value): if not isinstance(value, str): raise TypeError, "wrong type '%s' should be str" % type(value) if value.endswith('Tbps'): return float(value[:-3]) * tera elif value.endswith('Gbps'): return float(value[:-3]) * giga elif value.endswith('Mbps'): return float(value[:-3]) * mega elif value.endswith('kbps'): return float(value[:-3]) * kilo elif value.endswith('bps'): return float(value[:-2]) else: return float(value) raise ValueError, "cannot convert '%s' to network bandwidth" % value
f3544a13f3559e1e51b1f039e6613d5c47e41fa8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/f3544a13f3559e1e51b1f039e6613d5c47e41fa8/convert.py
print 'type =', self.type
print 'type=%s' % self.type
def print_ini(self): print '[' + self.path() + ']' # .ini section header
cad549d7aaefece708495842f2be5e6532a27bb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/cad549d7aaefece708495842f2be5e6532a27bb7/config.py
print 'children =', ' '.join(np_child_names)
print 'children=%s' % ' '.join(np_child_names)
def print_ini(self): print '[' + self.path() + ']' # .ini section header
cad549d7aaefece708495842f2be5e6532a27bb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/cad549d7aaefece708495842f2be5e6532a27bb7/config.py
print param, '=', self._values[param].ini_str()
print '%s=%s' % (param, self._values[param].ini_str())
def print_ini(self): print '[' + self.path() + ']' # .ini section header
cad549d7aaefece708495842f2be5e6532a27bb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/cad549d7aaefece708495842f2be5e6532a27bb7/config.py
'Enum', 'Bool', 'String',
'Enum', 'Bool', 'String', 'Float',
def instantiate(root): global ticks_per_sec ticks_per_sec = float(root.clock.frequency) root.print_ini() noDot = True # temporary until we fix dot if not noDot: dot = pydot.Dot() instance.outputDot(dot) dot.orientation = "portrait" dot.size = "8.5,11" dot.ranksep="equally" dot.rank="samerank" dot.write("config.dot") dot.write_ps("config.ps")
cad549d7aaefece708495842f2be5e6532a27bb7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/cad549d7aaefece708495842f2be5e6532a27bb7/config.py
self.cmd.append('-Wdepend=afterok:%s' % self.after)
self.cmd.append('-Wdepend=afterok:%s' % self.afterok)
def build(self, script, args = []): self.cmd = [ self.qsub ]
8ab674582e88582f06d729237d9cb1c00562451e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/8ab674582e88582f06d729237d9cb1c00562451e/pbs.py
raise TypeError, "%s is not of type BaseCPU", cpu
raise TypeError, "%s is not of type BaseCPU" % cpu
def switchCpus(cpuList): print "switching cpus" if not isinstance(cpuList, list): raise RuntimeError, "Must pass a list to this function" for i in cpuList: if not isinstance(i, tuple): raise RuntimeError, "List must have tuples of (oldCPU,newCPU)" [old_cpus, new_cpus] = zip(*cpuList) for cpu in old_cpus: if not isinstance(cpu, objects.BaseCPU): raise TypeError, "%s is not of type BaseCPU", cpu for cpu in new_cpus: if not isinstance(cpu, objects.BaseCPU): raise TypeError, "%s is not of type BaseCPU", cpu # Drain all of the individual CPUs drain_event = cc_main.createCountedDrain() unready_cpus = 0 for old_cpu in old_cpus: unready_cpus += old_cpu.startDrain(drain_event, False) # If we've got some objects that can't drain immediately, then simulate if unready_cpus > 0: drain_event.setCount(unready_cpus) simulate() cc_main.cleanupCountedDrain(drain_event) # Now all of the CPUs are ready to be switched out for old_cpu in old_cpus: old_cpu._ccObject.switchOut() index = 0 for new_cpu in new_cpus: new_cpu.takeOverFrom(old_cpus[index]) new_cpu._ccObject.resume() index += 1
ea5df468820c1c152ecd6932ac6a2a67b3f1725d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/ea5df468820c1c152ecd6932ac6a2a67b3f1725d/__init__.py
raise TypeError, "%s is not of type BaseCPU", cpu
raise TypeError, "%s is not of type BaseCPU" % cpu
def switchCpus(cpuList): print "switching cpus" if not isinstance(cpuList, list): raise RuntimeError, "Must pass a list to this function" for i in cpuList: if not isinstance(i, tuple): raise RuntimeError, "List must have tuples of (oldCPU,newCPU)" [old_cpus, new_cpus] = zip(*cpuList) for cpu in old_cpus: if not isinstance(cpu, objects.BaseCPU): raise TypeError, "%s is not of type BaseCPU", cpu for cpu in new_cpus: if not isinstance(cpu, objects.BaseCPU): raise TypeError, "%s is not of type BaseCPU", cpu # Drain all of the individual CPUs drain_event = cc_main.createCountedDrain() unready_cpus = 0 for old_cpu in old_cpus: unready_cpus += old_cpu.startDrain(drain_event, False) # If we've got some objects that can't drain immediately, then simulate if unready_cpus > 0: drain_event.setCount(unready_cpus) simulate() cc_main.cleanupCountedDrain(drain_event) # Now all of the CPUs are ready to be switched out for old_cpu in old_cpus: old_cpu._ccObject.switchOut() index = 0 for new_cpu in new_cpus: new_cpu.takeOverFrom(old_cpus[index]) new_cpu._ccObject.resume() index += 1
ea5df468820c1c152ecd6932ac6a2a67b3f1725d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6787/ea5df468820c1c152ecd6932ac6a2a67b3f1725d/__init__.py
xfn = os.normcase(os.normpath(x)) if fn[-len(xfn):]==xfn: return 1
xfn = os.path.normcase(os.path.normpath(x)) if makeabs(fn)[-len(xfn):]==xfn: return 1
def is_exceptional(fn,exceptions): for x in exceptions: xfn = os.normcase(os.normpath(x)) if fn[-len(xfn):]==xfn: return 1 return 0
ccb714ef13f0e376dd4920873df1b7a008c8732e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/ccb714ef13f0e376dd4920873df1b7a008c8732e/runtests.py
dir = os.path.normcase(os.path.normpath(dir)) if not os.path.isabs(dir): dir = os.path.join(os.getcwd(),dir)
dir = makeabs(dir)
def usage(code=0, msg=''): f = code and sys.stderr or sys.stdout if msg is not None: f.write(msg+'\n') f.write(\
ccb714ef13f0e376dd4920873df1b7a008c8732e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/ccb714ef13f0e376dd4920873df1b7a008c8732e/runtests.py
"""Convenience function to make a drawing from a group"""
"""Convenience function to make a drawing from a group"""
def asDrawing(self, width, height):
88eee69b9bd2148d4e8d4e8bfb24ceba9d5d1ba9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/88eee69b9bd2148d4e8d4e8bfb24ceba9d5d1ba9/shapes.py
outdir = outputfile('')
outDir = outputfile('')
def test0(self): "Test if pythonpoint.pdf can be created from pythonpoint.xml."
884a06ea0bd2021bfc298a93495433a28a717a3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/884a06ea0bd2021bfc298a93495433a28a717a3e/test_tools_pythonpoint.py
outDir = join(rlDir, 'test')
def test0(self): "Test if pythonpoint.pdf can be created from pythonpoint.xml."
884a06ea0bd2021bfc298a93495433a28a717a3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/884a06ea0bd2021bfc298a93495433a28a717a3e/test_tools_pythonpoint.py
os.remove(pdf)
def test0(self): "Test if pythonpoint.pdf can be created from pythonpoint.xml."
884a06ea0bd2021bfc298a93495433a28a717a3e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/884a06ea0bd2021bfc298a93495433a28a717a3e/test_tools_pythonpoint.py
formName = getFormName(pdfFileName, pageNo)
formName = self.getFormName(pdfFileName, pageNo)
def processPDF(self, pdfFileName, pageNo): formName = getFormName(pdfFileName, pageNo) storeForms(pdfFileName, formName + '.frm', prefix= formName + '_', pagenumbers=[pageNo]) print 'stored %s.frm' % formName return formName + '.frm'
b1c6aeaa2ebbff8ad4283b523b6cb5f587168a41 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/b1c6aeaa2ebbff8ad4283b523b6cb5f587168a41/figures.py
A[j[0]] = (func is None) and val or apply(func,(v,))
A[j[0]] = (func is None) and v or apply(func,(v,))
def getAttributes(self,attr,attrMap): A = {} for k, v in attr.items(): k = string.lower(k) if k in attrMap.keys(): j = attrMap[k] func = j[1] try: A[j[0]] = (func is None) and val or apply(func,(v,)) except: self.syntax_error('%s: invalid value %s'%(k,v)) else: self.syntax_error('invalid attribute name %s'%k) return A
6eee5e1b7c83974ece8f308e50b4435e229ff2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6eee5e1b7c83974ece8f308e50b4435e229ff2b4/paraparser.py
rv = _parser.parse(text,style)
l,rv = _parser.parse(text,style)
def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """
6eee5e1b7c83974ece8f308e50b4435e229ff2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6eee5e1b7c83974ece8f308e50b4435e229ff2b4/paraparser.py
for (None,l) in _parser.errors:
for l in _parser.errors:
def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """
6eee5e1b7c83974ece8f308e50b4435e229ff2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6eee5e1b7c83974ece8f308e50b4435e229ff2b4/paraparser.py
for l in rv: print l.fontName,l.fontSize,l.textColor,l.bold, l.rise, l.text[:25]
print l.fontName,l.fontSize,l.textColor,l.bold, l.rise, l.text[:25]
def parse(self, text, style): """Given a formatted string will return a list of ParaFrag objects with their calculated widths. If errors occur None will be returned and the self.errors holds a list of the error messages. """
6eee5e1b7c83974ece8f308e50b4435e229ff2b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/6eee5e1b7c83974ece8f308e50b4435e229ff2b4/paraparser.py
style = self.style
def breakLinesCJK(self, width): """Initially, the dumbest possible wrapping algorithm. Cannot handle font variations."""
70c774e661a757a6edc1fb0ed6074a825d9a2fd1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/70c774e661a757a6edc1fb0ed6074a825d9a2fd1/paragraph.py
if version == 0x4F54544F: raise TTFError, 'OpenType fonts with PostScript outlines are not supported' if version != 0x00010000 and version != 0x74727565: raise TTFError, 'Not a TrueType font'
def __init__(self, file, validate=0): """Loads and parses a TrueType font file. file can be a filename or a file object. If validate is set to a false values, skips checksum validation. This can save time, especially if the font is large. """
59077d27ebd48aa73fb5f623d12e1991aef4a60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/59077d27ebd48aa73fb5f623d12e1991aef4a60d/ttfonts.py
raise TTFError, 'Not a TrueType font'
raise TTFError("Not a TrueType font: can't read version") if version == 0x4F54544F: raise TTFError, 'OpenType fonts with PostScript outlines are not supported' if version != 0x00010000 and version != 0x74727565 and version!=0x74746366: raise TTFError('Not a TrueType font: version=0x%8.8X' % version)
def __init__(self, file, validate=0): """Loads and parses a TrueType font file. file can be a filename or a file object. If validate is set to a false values, skips checksum validation. This can save time, especially if the font is large. """
59077d27ebd48aa73fb5f623d12e1991aef4a60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/59077d27ebd48aa73fb5f623d12e1991aef4a60d/ttfonts.py
self.seek(string_data_offset + offset) if length % 2 != 0: raise TTFError, "PostScript name is UTF-16BE string of odd length" length /= 2 N = [] A = N.append while length > 0: char = self.read_ushort() A(chr(char)) length -= 1 N = ''.join(N)
opos = self._pos try: self.seek(string_data_offset + offset) if length % 2 != 0: raise TTFError, "PostScript name is UTF-16BE string of odd length" length /= 2 N = [] A = N.append while length > 0: char = self.read_ushort() A(chr(char)) length -= 1 N = ''.join(N) finally: self._pos = opos
def extractInfo(self, charInfo=1): """Extract typographic information from the loaded font file.
59077d27ebd48aa73fb5f623d12e1991aef4a60d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/59077d27ebd48aa73fb5f623d12e1991aef4a60d/ttfonts.py
os.path.walk('.',find_cleanable_files,test_files)
os.path.walk('.',find_cleanable_files,None)
def find_cleanable_files(L,d,N): n = os.path.basename(d) for n in filter(lambda n: n[-3:]=='.PYC' or n[-4:]=='.PDF' or n[-4:]=='.A85',map(string.upper,N)): fn = os.path.normcase(os.path.normpath(os.path.join(d,n))) if os.path.isfile(fn): os.remove(fn)
668c375e85b5e116d60661a547adc3b4e8c382aa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/668c375e85b5e116d60661a547adc3b4e8c382aa/runtests.py
bt = None if self._curPara.style == 'Bullet' and bt == '': bt = '\267'
if self._curPara.style == 'Bullet': bt = '\267' else: bt = None
def start_para(self, args): self._curPara = pythonpoint.PPPara() self._curPara.style = self._arg('para',args,'style')
278896ef2ea3ecb12ac4c4971a105404961426a3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/278896ef2ea3ecb12ac4c4971a105404961426a3/stdparser.py
if valign != 'TOP' or just != 'LEFT':
if valign != 'BOTTOM' or just != 'LEFT':
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle
5b9fc40184557392afc2cd5ab22797a813d9e900 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5b9fc40184557392afc2cd5ab22797a813d9e900/tables.py
y = rowpos + rowheight - cellstyle.topPadding
y = rowpos + rowheight - cellstyle.topPadding+h
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle
5b9fc40184557392afc2cd5ab22797a813d9e900 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5b9fc40184557392afc2cd5ab22797a813d9e900/tables.py
y = rowpos+cellstyle.bottomPadding+h
y = rowpos+cellstyle.bottomPadding
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle
5b9fc40184557392afc2cd5ab22797a813d9e900 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5b9fc40184557392afc2cd5ab22797a813d9e900/tables.py
y = rowpos+(rowheight+cellstyle.bottomPadding-cellstyle.topPadding+h)/2.0
y = rowpos+(rowheight+cellstyle.bottomPadding-cellstyle.topPadding-h)/2.0
def _drawCell(self, cellval, cellstyle, (colpos, rowpos), (colwidth, rowheight)): if self._curcellstyle is not cellstyle: cur = self._curcellstyle if cur is None or cellstyle.color != cur.color: self.canv.setFillColor(cellstyle.color) if cur is None or cellstyle.leading != cur.leading or cellstyle.fontname != cur.fontname or cellstyle.fontsize != cur.fontsize: self.canv.setFont(cellstyle.fontname, cellstyle.fontsize, cellstyle.leading) self._curcellstyle = cellstyle
5b9fc40184557392afc2cd5ab22797a813d9e900 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/5b9fc40184557392afc2cd5ab22797a813d9e900/tables.py
apply(im.save,(fn,fmt),self.configPIL or {})
configPIL = self.configPIL or {} if fmt=='TIFF': for a,d in ('resolution',self._dpi),('resolution unit','inch'): configPIL[a] = configPIL.get(a,d) apply(im.save,(fn,fmt),configPIL)
def saveToFile(self,fn,fmt=None): im = self.toPIL() if fmt is None: if type(fn) is not StringType: raise ValueError, "Invalid type '%s' for fn when fmt is None" % type(fn) else: fmt = string.upper(fmt) if fmt in ['GIF']: im = _convert2pilp(im) elif fmt in ['PCT','PICT']: return _saveAsPICT(im,fn,fmt) elif fmt in ['PNG','TIFF','BMP', 'PPM', 'TIF']: if fmt=='TIF': fmt = 'TIFF' if fmt=='PNG': try: from PIL import PngImagePlugin except ImportError: import PngImagePlugin elif fmt in ('JPG','JPEG'): fmt = 'JPEG' else: raise RenderPMError,"Unknown image kind %s" % fmt apply(im.save,(fn,fmt),self.configPIL or {}) if not hasattr(fn,'write'): from reportlab.lib.utils import markfilename markfilename(fn,creatorcode='ogle',filetype='PICT')
bf7809e30e47f0acc63ca362d61ec2c5a8cc5cda /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/bf7809e30e47f0acc63ca362d61ec2c5a8cc5cda/renderPM.py
assert format in ['pdf','ps','eps','gif','png','jpg','jpeg','tiff','tif','py'], 'Unknown file format "%s"' % format
assert format in ['pdf','ps','eps','gif','png','jpg','jpeg','bmp','ppm','tiff','tif','py','pict','pct'], 'Unknown file format "%s"' % format
def asString(self, format, verbose=None): """Converts to an 8 bit string in given format.""" assert format in ['pdf','ps','eps','gif','png','jpg','jpeg','tiff','tif','py'], 'Unknown file format "%s"' % format from reportlab import rl_config #verbose = verbose is not None and (verbose,) or (getattr(self,'verbose',verbose),)[0] if format == 'pdf': from reportlab.graphics import renderPDF return renderPDF.drawToString(self) elif format in ['gif','png','tif','jpg']: from reportlab.graphics import renderPM return renderPM.drawToString(self, fmt=format) elif format == 'eps': from rlextra.graphics import renderPS_SEP return renderPS_SEP.drawToString(self, preview = getattr(self,'preview',1), showBoundary=getattr(self,'showBorder',rl_config.showBoundary)) elif format == 'ps': from reportlab.graphics import renderPS return renderPS.drawToString(self, showBoundary=getattr(self,'showBorder',rl_config.showBoundary)) elif format == 'py': return self._renderPy()
1a989ac8e00a98b069a47456c10953539cd417f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1a989ac8e00a98b069a47456c10953539cd417f8/shapes.py
elif format in ['gif','png','tif','jpg']:
elif format in ['gif','png','tif','jpg','pct','pict','bmp','ppm']:
def asString(self, format, verbose=None): """Converts to an 8 bit string in given format.""" assert format in ['pdf','ps','eps','gif','png','jpg','jpeg','tiff','tif','py'], 'Unknown file format "%s"' % format from reportlab import rl_config #verbose = verbose is not None and (verbose,) or (getattr(self,'verbose',verbose),)[0] if format == 'pdf': from reportlab.graphics import renderPDF return renderPDF.drawToString(self) elif format in ['gif','png','tif','jpg']: from reportlab.graphics import renderPM return renderPM.drawToString(self, fmt=format) elif format == 'eps': from rlextra.graphics import renderPS_SEP return renderPS_SEP.drawToString(self, preview = getattr(self,'preview',1), showBoundary=getattr(self,'showBorder',rl_config.showBoundary)) elif format == 'ps': from reportlab.graphics import renderPS return renderPS.drawToString(self, showBoundary=getattr(self,'showBorder',rl_config.showBoundary)) elif format == 'py': return self._renderPy()
1a989ac8e00a98b069a47456c10953539cd417f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1a989ac8e00a98b069a47456c10953539cd417f8/shapes.py
def asString(self, format, verbose=None): """Converts to an 8 bit string in given format.""" assert format in ['pdf','ps','eps','gif','png','jpg','jpeg','tiff','tif','py'], 'Unknown file format "%s"' % format from reportlab import rl_config #verbose = verbose is not None and (verbose,) or (getattr(self,'verbose',verbose),)[0] if format == 'pdf': from reportlab.graphics import renderPDF return renderPDF.drawToString(self) elif format in ['gif','png','tif','jpg']: from reportlab.graphics import renderPM return renderPM.drawToString(self, fmt=format) elif format == 'eps': from rlextra.graphics import renderPS_SEP return renderPS_SEP.drawToString(self, preview = getattr(self,'preview',1), showBoundary=getattr(self,'showBorder',rl_config.showBoundary)) elif format == 'ps': from reportlab.graphics import renderPS return renderPS.drawToString(self, showBoundary=getattr(self,'showBorder',rl_config.showBoundary)) elif format == 'py': return self._renderPy()
1a989ac8e00a98b069a47456c10953539cd417f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/7053/1a989ac8e00a98b069a47456c10953539cd417f8/shapes.py