Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Figure out what to do about multiple invocations of the same function on one line #15

Open
Norbo11 opened this issue Apr 13, 2019 · 0 comments
Labels
enhancement Small feature or request

Comments

@Norbo11
Copy link
Owner

Norbo11 commented Apr 13, 2019

def sleep(i):
    time.sleep(i)
    return i

def f():
    x = [sleep(1), sleep(1), sleep(1)]

PyFlame reports one unique stack trace here:

f:1 (3000 ms) -> sleep:1 (3000 ms)

On the other hand:

def sleep(i):
    time.sleep(i)
    return i

def f():
    sleep(1)
    sleep(1)
    sleep(1)

PyFlame reports three unique stack traces:

f:1 (1000 ms) -> sleep:1 (1000ms)
f:2 (1000 ms) -> sleep:1 (1000ms)
f:3 (1000 ms) -> sleep:1 (1000ms)

The second case is correct as the first line of sleep executes for an average of 1 second.

The first case is incorrect as the first line of sleep is assumed to execute for an average of 3 seconds.

Ideas:

Use static analysis to somehow detect these cases and distinguish between them
Figure out how pyspy would behave, once intermediate output is available. Maybe it solves this issue for us.

@Norbo11 Norbo11 added the enhancement Small feature or request label May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Small feature or request
Projects
None yet
Development

No branches or pull requests

1 participant