{"action":"created","issue":{"url":"https://api.github.com/repos/iovisor/bcc/issues/585","repository_url":"https://api.github.com/repos/iovisor/bcc","labels_url":"https://api.github.com/repos/iovisor/bcc/issues/585/labels{/name}","comments_url":"https://api.github.com/repos/iovisor/bcc/issues/585/comments","events_url":"https://api.github.com/repos/iovisor/bcc/issues/585/events","html_url":"https://github.com/iovisor/bcc/pull/585","id":162660331,"number":585,"title":"cpudist: Summarize task on-CPU time as histograms","user":{"login":"goldshtn","id":1685437,"avatar_url":"https://avatars.githubusercontent.com/u/1685437?v=3","gravatar_id":"","url":"https://api.github.com/users/goldshtn","html_url":"https://github.com/goldshtn","followers_url":"https://api.github.com/users/goldshtn/followers","following_url":"https://api.github.com/users/goldshtn/following{/other_user}","gists_url":"https://api.github.com/users/goldshtn/gists{/gist_id}","starred_url":"https://api.github.com/users/goldshtn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goldshtn/subscriptions","organizations_url":"https://api.github.com/users/goldshtn/orgs","repos_url":"https://api.github.com/users/goldshtn/repos","events_url":"https://api.github.com/users/goldshtn/events{/privacy}","received_events_url":"https://api.github.com/users/goldshtn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-06-28T11:10:26Z","updated_at":"2016-06-28T18:47:06Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/iovisor/bcc/pulls/585","html_url":"https://github.com/iovisor/bcc/pull/585","diff_url":"https://github.com/iovisor/bcc/pull/585.diff","patch_url":"https://github.com/iovisor/bcc/pull/585.patch"},"body":"This summarizes task on-CPU time as histograms and displays it with a variety of switches, modeled on `runqlat`. Basic example:\r\n\r\n```\r\n# ./cpudist.py\r\nTracing on-CPU time... Hit Ctrl-C to end.\r\n^C\r\n     usecs               : count     distribution\r\n         0 -> 1          : 0        |                                        |\r\n         2 -> 3          : 1        |                                        |\r\n         4 -> 7          : 1        |                                        |\r\n         8 -> 15         : 13       |**                                      |\r\n        16 -> 31         : 187      |****************************************|\r\n        32 -> 63         : 89       |*******************                     |\r\n        64 -> 127        : 26       |*****                                   |\r\n       128 -> 255        : 0        |                                        |\r\n       256 -> 511        : 1        |                                        |\r\n```\r\n\r\nWith this, we can close #499.\r\n\r\nI don't know about what the relationship between #500 and #499 should be. @brendangregg I think you wanted these as separate tools for discoverability -- but the implementation can be 99% shared. Basically we'd have to reverse the histogram update location: update the histogram when the task gets *on* the CPU, instead of when it's getting *off*. Do you think it's worth the effort of duplicating the tool itself, its man page, and its examples file? Or can we maybe turn it into a switch, e.g. `-O`, which would reverse the meaning to off-CPU time instead of on-?"},"comment":{"url":"https://api.github.com/repos/iovisor/bcc/issues/comments/229144879","html_url":"https://github.com/iovisor/bcc/pull/585#issuecomment-229144879","issue_url":"https://api.github.com/repos/iovisor/bcc/issues/585","id":229144879,"user":{"login":"brendangregg","id":1101211,"avatar_url":"https://avatars.githubusercontent.com/u/1101211?v=3","gravatar_id":"","url":"https://api.github.com/users/brendangregg","html_url":"https://github.com/brendangregg","followers_url":"https://api.github.com/users/brendangregg/followers","following_url":"https://api.github.com/users/brendangregg/following{/other_user}","gists_url":"https://api.github.com/users/brendangregg/gists{/gist_id}","starred_url":"https://api.github.com/users/brendangregg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendangregg/subscriptions","organizations_url":"https://api.github.com/users/brendangregg/orgs","repos_url":"https://api.github.com/users/brendangregg/repos","events_url":"https://api.github.com/users/brendangregg/events{/privacy}","received_events_url":"https://api.github.com/users/brendangregg/received_events","type":"User","site_admin":false},"created_at":"2016-06-28T18:47:06Z","updated_at":"2016-06-28T18:47:06Z","body":"We can go with -O. I guess at some point we might have a tool that uses -o. (eg, imagine a tool that traced network packets and wrote a tcpdump file!).\r\n\r\nI think -O, and proper tracepoints, can be added later. This works and is useful on older kernels.\r\n\r\nAnother later addition could be to add execnames to the -P output, which could be read from /proc during output (man page can say these are best effort, and may be inaccurate)."}}
{"actor":{"display_login":"brendangregg"}}