sumerc / yappi

Yet Another Python Profiler, but this time multithreading, asyncio and gevent aware.
MIT License
1.45k stars 73 forks source link

time.sleep doesn't show up in wall time #74

Closed aantn closed 3 years ago

aantn commented 3 years ago

Is there a way to show time.sleep() in wall time? In the following example, sleep doesn't show up:

import yappi
import time

def foo():
    time.sleep(1)

yappi.set_clock_type("wall")
yappi.start()
foo()
yappi.stop()

yappi.get_func_stats().debug_print()
yappi.get_func_stats().print_all()
aantn commented 3 years ago

Whoops, my bad. I didn't realize I needed yappi.start(builtins=True) Is there a good reason not to pass builtins=True all the time?

sumerc commented 3 years ago

Well my initial thinking was: performance. In yappi, the more measurements you make the more overhead you will get. My thinking was: builtins(C functions) might not be the first thing people look to profile, at least initially? Right?

aantn commented 3 years ago

In my case, I don't want to profile the internals of built-in functions, rather when looking at user written functions I want to see which line in that function took the most time and sometimes that line is a built-in in.

This is especially true when optimizing for wall time.

On Sat, Jan 2, 2021, 18:34 Sümer Cip notifications@github.com wrote:

Well my initial thinking was: performance. In yappi, the more measurements you make the more overhead you will get. My thinking was: builtins(C functions) might not be the first thing people look to profile, at least initially? Right?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/sumerc/yappi/issues/74#issuecomment-753494920, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYUB324ACUDQ6IUBUHUJTSX5DKBANCNFSM4VPW3F4Q .