Esempio n. 1
0
    sys.exit(1)

allocmod = importlib.util.module_from_spec(allocspecs)
allocspecs.loader.exec_module(allocmod)

alloc = allocmod.Allocator(tslam=tslam, cliargs=args.remainder)

# XXX OLD
# if args.use_allocated_size :
#   szcb = lambda : alloc.size
# else :
#   szcb = lambda : parser.addr_space_size

unrun = Unrun(tslam, out=sys.stdout)

run.register_trace_listener(alloc)
run.register_addr_space_sample_listener(alloc)
alloc.register_subscriber(unrun)

if (args.render_freq is not None):
    if getattr(alloc, 'render', None) is None:
        print("Allocator lacks renderer.", file=sys.stderr)
        sys.exit(1)

    from PIL import Image

    class RenderTraceListener:
        __slots__ = ('count')

        def __init__(self):
            self.count = 0
Esempio n. 2
0

class LineMapper():
    def allocd(self, stk, tid, begin, end):
        unrun.allocd(None, qm(stk), tid, begin, end)

    def freed(self, stk, tid, begin):
        unrun.freed(None, qm(stk), tid, begin)

    def reallocd(self, stk, tid, bo, bn, en):
        unrun.reallocd(None, qm(stk), tid, bo, bn, en)

    def mapd(self, stk, tid, b, e, prot):
        unrun.mapd(None, qm(stk), tid, b, e, prot)

    def unmapd(self, stk, tid, b, e):
        unrun.unmapd(None, qm(stk), tid, b, e)

    def size_measured(self, sz):
        unrun.size_measured(None, sz)

    def sweep_size_measured(self, sz):
        unrun.sweep_size_measured(None, sz)


lm = LineMapper()
run.register_trace_listener(lm)
run.register_addr_space_sample_listener(lm)
run.replay()
con.close()