def current_gc_time(): from rpython.rlib import rgc if objectmodel.we_are_translated(): val = rgc.get_stats(rgc.TOTAL_GC_TIME) else: val = 0 return val
def main(argv): printtime = False i = 0 while i < len(argv): if argv[i] == "--jit": jitarg = argv[i + 1] del argv[i:i + 2] print jitarg, argv jit.set_user_param(None, jitarg) if argv[i] == "--time": printtime = True i += 1 patternfilename = argv[1] inputfilename = argv[2] patternfile = open(patternfilename, "r") inputfile = open(inputfilename, "r") pattern = patternfile.read() patternfile.close() inputstring = inputfile.read() inputfile.close() inputstring = inputstring.strip() flags = Flags(optimize_char=True, optimize_testchar=True) if not flags.optimize_choicepoints: jit.set_param( None, "enable_opts", "intbounds:rewrite:virtualize:string:pure:earlyforce:heap") if we_are_translated(): gct1 = rgc.get_stats(rgc.TOTAL_GC_TIME) else: gct1 = 0 t1 = time.time() captures = runbypattern(pattern, inputstring, flags=flags).captures output = processcaptures(captures, inputstring) t2 = time.time() if we_are_translated(): gct2 = rgc.get_stats(rgc.TOTAL_GC_TIME) else: gct2 = 0 print output if printtime: print "time:", t2 - t1 print "gc time:", (gct2 - gct1) / 1000. return 0
def __init__(self, memory_pressure): if memory_pressure: self.total_memory_pressure = rgc.get_stats( rgc.TOTAL_MEMORY_PRESSURE) else: self.total_memory_pressure = -1 self.total_gc_memory = rgc.get_stats(rgc.TOTAL_MEMORY) self.total_allocated_memory = rgc.get_stats(rgc.TOTAL_ALLOCATED_MEMORY) self.peak_memory = rgc.get_stats(rgc.PEAK_MEMORY) self.peak_allocated_memory = rgc.get_stats(rgc.PEAK_ALLOCATED_MEMORY) self.jit_backend_allocated = jit_hooks.stats_asmmemmgr_allocated(None) self.jit_backend_used = jit_hooks.stats_asmmemmgr_used(None) self.total_arena_memory = rgc.get_stats(rgc.TOTAL_ARENA_MEMORY) self.total_rawmalloced_memory = rgc.get_stats( rgc.TOTAL_RAWMALLOCED_MEMORY) self.peak_arena_memory = rgc.get_stats(rgc.PEAK_ARENA_MEMORY) self.peak_rawmalloced_memory = rgc.get_stats( rgc.PEAK_RAWMALLOCED_MEMORY) self.nursery_size = rgc.get_stats(rgc.NURSERY_SIZE)
def current_gc_old_mem(): return rgc.get_stats(rgc.TOTAL_MEMORY) - rgc.get_stats(rgc.NURSERY_SIZE)
def current_gc_young_mem(): return rgc.get_stats(rgc.NURSERY_SIZE)
def current_gc_total_mem(): return rgc.get_stats(rgc.TOTAL_MEMORY)
def current_gc_time(): return rgc.get_stats(rgc.TOTAL_GC_TIME)