async def test_profiler_dump():
    profiler = None
    fl = NamedTemporaryFile(delete=False)
    path = NamedTemporaryFile(delete=False).name
    fl.close()
    try:
        profiler = Profiler(interval=0.1, top_results=10, path=path)
        (await profiler.start())
        (await asyncio.sleep(0.01))
        stats1 = Stats(path)
        (await asyncio.sleep(0.01))
        stats2 = Stats(path)
        assert (stats1.stats == stats2.stats)
        (await asyncio.sleep(0.2))
        stats3 = Stats(path)
        assert (stats2.stats != stats3.stats)
    finally:
        if profiler:
            (await profiler.stop())
        os.remove(path)
async def test_profiler_dump():
    profiler = None
    fl = NamedTemporaryFile(delete=False)
    path = NamedTemporaryFile(delete=False).name
    fl.close()
    try:
        profiler = Profiler(interval=0.1, top_results=10, path=path)
        (await profiler.start())
        (await asyncio.sleep(0.01))
        stats1 = Stats(path)
        (await asyncio.sleep(0.01))
        stats2 = Stats(path)
        assert (stats1.stats == stats2.stats)
        (await asyncio.sleep(0.2))
        stats3 = Stats(path)
        assert (stats2.stats != stats3.stats)
    finally:
        if profiler:
            (await profiler.stop())
        os.remove(path)