def test_profile(self):
        def g():
            pass

        def f():
            g()

        def main():
            f()
            f()
            f()

        with tracebin.record() as recorder:
            main()

        assert recorder.calls is None

        start = time.time()
        with tracebin.record(profile=True) as recorder:
            main()

        assert len(recorder.calls) == 3
        # There are calls to high_res_time() before and after main, in order to
        # record the total execution time
        [call1, call2, call3] = recorder.calls

        assert call1.func_name == "high_res_time"
        assert len(call1.subcalls) == 1

        assert call2.func_name == "main"
        assert (call2.start_time - start) < 1
        assert (call2.end_time - call2.start_time) < 1
        assert len(call2.subcalls) == 3
        assert {c.func_name for c in call2.subcalls} == {"f"}
        assert call2.subcalls[1].subcalls[0].func_name == "g"
dataset/ETHPy150Open alex/tracebin/client/tests/test_hook.py/TestHook.test_profile/original