{"action":"opened","issue":{"url":"https://api.github.com/repos/giampaolo/psutil/issues/671","labels_url":"https://api.github.com/repos/giampaolo/psutil/issues/671/labels{/name}","comments_url":"https://api.github.com/repos/giampaolo/psutil/issues/671/comments","events_url":"https://api.github.com/repos/giampaolo/psutil/issues/671/events","html_url":"https://github.com/giampaolo/psutil/issues/671","id":101718346,"number":671,"title":"CPU usage for short lived processes","user":{"login":"johnmudd","id":755393,"avatar_url":"https://avatars.githubusercontent.com/u/755393?v=3","gravatar_id":"","url":"https://api.github.com/users/johnmudd","html_url":"https://github.com/johnmudd","followers_url":"https://api.github.com/users/johnmudd/followers","following_url":"https://api.github.com/users/johnmudd/following{/other_user}","gists_url":"https://api.github.com/users/johnmudd/gists{/gist_id}","starred_url":"https://api.github.com/users/johnmudd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnmudd/subscriptions","organizations_url":"https://api.github.com/users/johnmudd/orgs","repos_url":"https://api.github.com/users/johnmudd/repos","events_url":"https://api.github.com/users/johnmudd/events{/privacy}","received_events_url":"https://api.github.com/users/johnmudd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-08-18T18:18:23Z","updated_at":"2015-08-18T18:18:23Z","closed_at":null,"body":"I recently had to diagnose a problem with high CPU usage. Running top, htop and glances was not helpful because the problem processes were too short lived to appear in the output.\r\n\r\nA sys admin found the problem by running ````ps aux | sort -rk 3,3 | head -n 30````. This showed a number of ````ls```` commands running. Each was taking up about 8% of a CPU. Our application was spawning 400 ````ls```` commands per second. It was an ````ls```` on an empty directory so each process didn't run long.\r\n\r\nI was able to find some of these commands with psutil but I only got 0% when calling the cpu_percent() method. How could the ````ps```` command get the CPU percentage for these processes but psutil can't?"}}