Esempio n. 1
0
def _build_default_collectors():
    r = recorder.Recorder()
    return [
        stack.StackCollector(r),
        memory.MemoryCollector(r),
        exceptions.UncaughtExceptionCollector(r),
        threading.LockCollector(r),
    ]
Esempio n. 2
0
def _test_memory_ignore(ignore):
    r = recorder.Recorder()
    # Start a stack collector so it allocates memory
    with stack.StackCollector(r):
        r = recorder.Recorder()
        c = memory.MemoryCollector(r, ignore_profiler=ignore, capture_pct=100)
        while not r.events[memory.MemorySampleEvent]:
            c.collect()
            _ = _alloc()
    events = r.events[memory.MemorySampleEvent]
    files = {
        frame.filename
        for event in events for trace in event.snapshot.traces
        for frame in trace.traceback
    }
    return files
Esempio n. 3
0
def test_memory_alloc_speed_patched(benchmark, pct):
    r = recorder.Recorder()
    with memory.MemoryCollector(r, capture_pct=pct):
        benchmark(_alloc)
Esempio n. 4
0
def test_max_capture_over():
    r = recorder.Recorder()
    with pytest.raises(ValueError):
        memory.MemoryCollector(r, capture_pct=200)