{"action":"opened","issue":{"url":"https://api.github.com/repos/uber/pyflame/issues/46","repository_url":"https://api.github.com/repos/uber/pyflame","labels_url":"https://api.github.com/repos/uber/pyflame/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/uber/pyflame/issues/46/comments","events_url":"https://api.github.com/repos/uber/pyflame/issues/46/events","html_url":"https://github.com/uber/pyflame/issues/46","id":196514485,"number":46,"title":"Empty flame graphs when there's a lot of idle time","user":{"login":"mbenbernard","id":24657857,"avatar_url":"https://avatars.githubusercontent.com/u/24657857?v=3","gravatar_id":"","url":"https://api.github.com/users/mbenbernard","html_url":"https://github.com/mbenbernard","followers_url":"https://api.github.com/users/mbenbernard/followers","following_url":"https://api.github.com/users/mbenbernard/following{/other_user}","gists_url":"https://api.github.com/users/mbenbernard/gists{/gist_id}","starred_url":"https://api.github.com/users/mbenbernard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbenbernard/subscriptions","organizations_url":"https://api.github.com/users/mbenbernard/orgs","repos_url":"https://api.github.com/users/mbenbernard/repos","events_url":"https://api.github.com/users/mbenbernard/events{/privacy}","received_events_url":"https://api.github.com/users/mbenbernard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-19T20:35:45Z","updated_at":"2016-12-19T20:35:45Z","closed_at":null,"body":"I ran this very simple Python program:\r\n\r\n    import time\r\n\r\n    def compute(x):\r\n        res = x**2*7/9+31\r\n        return res\r\n\r\n    index = 0\r\n    while True:\r\n        index += 1\r\n        compute(index)\r\n        time.sleep(1)\r\n\r\nAnd I profiled it using the following command line:\r\n\r\npyflame -s 20 -r 0.00000000000001 {pid} | ./flamegraph.pl > flames.svg\r\n\r\nI understand that compute() completes and returns very rapidly. And I also understand that time.sleep() takes the majority of my program's time. However, given that the sampling interval is very small, I would have expected the flame graph to contain at least a few samples for the compute() function. But this isn't the case; the flame graph shows 100% idle time.\r\n\r\nNow, if I considerably reduce the value passed to time.sleep() (e.g. 0.0000001), then the flame graph contains samples for the compute() method, as we could expect.\r\n\r\nIs this the normal behaviour of pyflame? Or is it a technical limitation?\r\n\r\nThanks!"}}
{"actor":{"display_login":"mbenbernard"}}