{"action":"created","comment":{"url":"https://api.github.com/repos/influxdb/telegraf/pulls/comments/36983736","id":36983736,"diff_hunk":"@@ -38,13 +54,53 @@ func (s *CPUStats) Gather(acc plugins.Accumulator) error {\n \t\tadd(acc, \"guest\", cts.Guest, tags)\n \t\tadd(acc, \"guestNice\", cts.GuestNice, tags)\n \t\tadd(acc, \"stolen\", cts.Stolen, tags)\n+\t\tadd(acc, \"busy\", busy, tags)\n+\n+\t\t// Add in percentage\n+\t\tlastCts := s.lastStats[i]\n+\t\tlastBusy, lastTotal := busyAndTotalCpuTime(lastCts)\n+\t\tbusyDelta := busy - lastBusy\n+\t\ttotalDelta := total - lastTotal\n+\n+\t\tif totalDelta < 0 {\n+\t\t\treturn fmt.Errorf(\"Error: current total CPU time is less than previous total CPU time\")\n+\t\t}\n+\n+\t\tif totalDelta == 0 {\n+\t\t\treturn nil\n+\t\t}\n+\n+\t\tadd(acc, \"percentageUser\", 100*(cts.User-lastCts.User)/totalDelta, tags)\n+\t\tadd(acc, \"percentageSystem\", 100*(cts.System-lastCts.System)/totalDelta, tags)\n+\t\tadd(acc, \"percentageIdle\", 100*(cts.Idle-lastCts.Idle)/totalDelta, tags)\n+\t\tadd(acc, \"percentageNice\", 100*(cts.Nice-lastCts.Nice)/totalDelta, tags)\n+\t\tadd(acc, \"percentageIowait\", 100*(cts.Iowait-lastCts.Iowait)/totalDelta, tags)\n+\t\tadd(acc, \"percentageIrq\", 100*(cts.Irq-lastCts.Irq)/totalDelta, tags)\n+\t\tadd(acc, \"percentageSoftirq\", 100*(cts.Softirq-lastCts.Softirq)/totalDelta, tags)\n+\t\tadd(acc, \"percentageSteal\", 100*(cts.Steal-lastCts.Steal)/totalDelta, tags)\n+\t\tadd(acc, \"percentageGuest\", 100*(cts.Guest-lastCts.Guest)/totalDelta, tags)\n+\t\tadd(acc, \"percentageGuestNice\", 100*(cts.GuestNice-lastCts.GuestNice)/totalDelta, tags)\n+\t\tadd(acc, \"percentageStolen\", 100*(cts.Stolen-lastCts.Stolen)/totalDelta, tags)\n+\n+\t\tadd(acc, \"percentageBusy\", 100*busyDelta/totalDelta, tags)\n+\n \t}\n \n+\ts.lastStats = times\n+\n \treturn nil\n }\n \n+func busyAndTotalCpuTime(t cpu.CPUTimesStat) (float64, float64) {","path":"plugins/system/cpu.go","position":86,"original_position":86,"commit_id":"d3dd383e215251efbd7a674543356a53b682249d","original_commit_id":"d3dd383e215251efbd7a674543356a53b682249d","user":{"login":"sparrc","id":7155926,"avatar_url":"https://avatars.githubusercontent.com/u/7155926?v=3","gravatar_id":"","url":"https://api.github.com/users/sparrc","html_url":"https://github.com/sparrc","followers_url":"https://api.github.com/users/sparrc/followers","following_url":"https://api.github.com/users/sparrc/following{/other_user}","gists_url":"https://api.github.com/users/sparrc/gists{/gist_id}","starred_url":"https://api.github.com/users/sparrc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sparrc/subscriptions","organizations_url":"https://api.github.com/users/sparrc/orgs","repos_url":"https://api.github.com/users/sparrc/repos","events_url":"https://api.github.com/users/sparrc/events{/privacy}","received_events_url":"https://api.github.com/users/sparrc/received_events","type":"User","site_admin":false},"body":"please document this function with a comment stating what the two float64 values are","created_at":"2015-08-13T14:56:16Z","updated_at":"2015-08-13T14:56:16Z","html_url":"https://github.com/influxdb/telegraf/pull/111#discussion_r36983736","pull_request_url":"https://api.github.com/repos/influxdb/telegraf/pulls/111","_links":{"self":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/comments/36983736"},"html":{"href":"https://github.com/influxdb/telegraf/pull/111#discussion_r36983736"},"pull_request":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/111"}}},"pull_request":{"url":"https://api.github.com/repos/influxdb/telegraf/pulls/111","id":42307123,"html_url":"https://github.com/influxdb/telegraf/pull/111","diff_url":"https://github.com/influxdb/telegraf/pull/111.diff","patch_url":"https://github.com/influxdb/telegraf/pull/111.patch","issue_url":"https://api.github.com/repos/influxdb/telegraf/issues/111","number":111,"state":"open","locked":false,"title":"Adds CPU busy time and percentages","user":{"login":"jpalay","id":1417361,"avatar_url":"https://avatars.githubusercontent.com/u/1417361?v=3","gravatar_id":"","url":"https://api.github.com/users/jpalay","html_url":"https://github.com/jpalay","followers_url":"https://api.github.com/users/jpalay/followers","following_url":"https://api.github.com/users/jpalay/following{/other_user}","gists_url":"https://api.github.com/users/jpalay/gists{/gist_id}","starred_url":"https://api.github.com/users/jpalay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpalay/subscriptions","organizations_url":"https://api.github.com/users/jpalay/orgs","repos_url":"https://api.github.com/users/jpalay/repos","events_url":"https://api.github.com/users/jpalay/events{/privacy}","received_events_url":"https://api.github.com/users/jpalay/received_events","type":"User","site_admin":false},"body":"The CPU plugin now collects the percentage of time the processor spends in various areas. It does this by remembering the CPU metrics it gathered the last time telegraf ran the plugin. It then looks at the difference between the current CPU metrics and the CPU metrics gathered last in order to determine how the CPU has spent its time.\r\n\r\nAlso, because InfluxDB 0.9 does not support adding together values from different series, I updated the CPU plugin to also collect one calculated metric, busy time, which is just the sum of all the CPU metrics besides the idle time.\r\n\r\n","created_at":"2015-08-13T01:24:45Z","updated_at":"2015-08-13T14:56:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4a2d27c6a38c236e04bbccf3dd587360f80f173b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/influxdb/telegraf/pulls/111/commits","review_comments_url":"https://api.github.com/repos/influxdb/telegraf/pulls/111/comments","review_comment_url":"https://api.github.com/repos/influxdb/telegraf/pulls/comments{/number}","comments_url":"https://api.github.com/repos/influxdb/telegraf/issues/111/comments","statuses_url":"https://api.github.com/repos/influxdb/telegraf/statuses/d3dd383e215251efbd7a674543356a53b682249d","head":{"label":"Asana:cpu_percentages_with_busy","ref":"cpu_percentages_with_busy","sha":"d3dd383e215251efbd7a674543356a53b682249d","user":{"login":"Asana","id":1472111,"avatar_url":"https://avatars.githubusercontent.com/u/1472111?v=3","gravatar_id":"","url":"https://api.github.com/users/Asana","html_url":"https://github.com/Asana","followers_url":"https://api.github.com/users/Asana/followers","following_url":"https://api.github.com/users/Asana/following{/other_user}","gists_url":"https://api.github.com/users/Asana/gists{/gist_id}","starred_url":"https://api.github.com/users/Asana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Asana/subscriptions","organizations_url":"https://api.github.com/users/Asana/orgs","repos_url":"https://api.github.com/users/Asana/repos","events_url":"https://api.github.com/users/Asana/events{/privacy}","received_events_url":"https://api.github.com/users/Asana/received_events","type":"Organization","site_admin":false},"repo":{"id":39460858,"name":"telegraf","full_name":"Asana/telegraf","owner":{"login":"Asana","id":1472111,"avatar_url":"https://avatars.githubusercontent.com/u/1472111?v=3","gravatar_id":"","url":"https://api.github.com/users/Asana","html_url":"https://github.com/Asana","followers_url":"https://api.github.com/users/Asana/followers","following_url":"https://api.github.com/users/Asana/following{/other_user}","gists_url":"https://api.github.com/users/Asana/gists{/gist_id}","starred_url":"https://api.github.com/users/Asana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Asana/subscriptions","organizations_url":"https://api.github.com/users/Asana/orgs","repos_url":"https://api.github.com/users/Asana/repos","events_url":"https://api.github.com/users/Asana/events{/privacy}","received_events_url":"https://api.github.com/users/Asana/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Asana/telegraf","description":"The plugin-driven server agent for reporting metrics into InfluxDB.","fork":true,"url":"https://api.github.com/repos/Asana/telegraf","forks_url":"https://api.github.com/repos/Asana/telegraf/forks","keys_url":"https://api.github.com/repos/Asana/telegraf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Asana/telegraf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Asana/telegraf/teams","hooks_url":"https://api.github.com/repos/Asana/telegraf/hooks","issue_events_url":"https://api.github.com/repos/Asana/telegraf/issues/events{/number}","events_url":"https://api.github.com/repos/Asana/telegraf/events","assignees_url":"https://api.github.com/repos/Asana/telegraf/assignees{/user}","branches_url":"https://api.github.com/repos/Asana/telegraf/branches{/branch}","tags_url":"https://api.github.com/repos/Asana/telegraf/tags","blobs_url":"https://api.github.com/repos/Asana/telegraf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Asana/telegraf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Asana/telegraf/git/refs{/sha}","trees_url":"https://api.github.com/repos/Asana/telegraf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Asana/telegraf/statuses/{sha}","languages_url":"https://api.github.com/repos/Asana/telegraf/languages","stargazers_url":"https://api.github.com/repos/Asana/telegraf/stargazers","contributors_url":"https://api.github.com/repos/Asana/telegraf/contributors","subscribers_url":"https://api.github.com/repos/Asana/telegraf/subscribers","subscription_url":"https://api.github.com/repos/Asana/telegraf/subscription","commits_url":"https://api.github.com/repos/Asana/telegraf/commits{/sha}","git_commits_url":"https://api.github.com/repos/Asana/telegraf/git/commits{/sha}","comments_url":"https://api.github.com/repos/Asana/telegraf/comments{/number}","issue_comment_url":"https://api.github.com/repos/Asana/telegraf/issues/comments{/number}","contents_url":"https://api.github.com/repos/Asana/telegraf/contents/{+path}","compare_url":"https://api.github.com/repos/Asana/telegraf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Asana/telegraf/merges","archive_url":"https://api.github.com/repos/Asana/telegraf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Asana/telegraf/downloads","issues_url":"https://api.github.com/repos/Asana/telegraf/issues{/number}","pulls_url":"https://api.github.com/repos/Asana/telegraf/pulls{/number}","milestones_url":"https://api.github.com/repos/Asana/telegraf/milestones{/number}","notifications_url":"https://api.github.com/repos/Asana/telegraf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Asana/telegraf/labels{/name}","releases_url":"https://api.github.com/repos/Asana/telegraf/releases{/id}","created_at":"2015-07-21T17:49:05Z","updated_at":"2015-07-21T17:49:06Z","pushed_at":"2015-08-13T01:23:49Z","git_url":"git://github.com/Asana/telegraf.git","ssh_url":"git@github.com:Asana/telegraf.git","clone_url":"https://github.com/Asana/telegraf.git","svn_url":"https://github.com/Asana/telegraf","homepage":"","size":4101,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"influxdb:master","ref":"master","sha":"5d4b6c41a82123a648f70f0e6466425ce4afd5bc","user":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"repo":{"id":33258973,"name":"telegraf","full_name":"influxdb/telegraf","owner":{"login":"influxdb","id":5713248,"avatar_url":"https://avatars.githubusercontent.com/u/5713248?v=3","gravatar_id":"","url":"https://api.github.com/users/influxdb","html_url":"https://github.com/influxdb","followers_url":"https://api.github.com/users/influxdb/followers","following_url":"https://api.github.com/users/influxdb/following{/other_user}","gists_url":"https://api.github.com/users/influxdb/gists{/gist_id}","starred_url":"https://api.github.com/users/influxdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/influxdb/subscriptions","organizations_url":"https://api.github.com/users/influxdb/orgs","repos_url":"https://api.github.com/users/influxdb/repos","events_url":"https://api.github.com/users/influxdb/events{/privacy}","received_events_url":"https://api.github.com/users/influxdb/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/influxdb/telegraf","description":"The plugin-driven server agent for reporting metrics into InfluxDB.","fork":false,"url":"https://api.github.com/repos/influxdb/telegraf","forks_url":"https://api.github.com/repos/influxdb/telegraf/forks","keys_url":"https://api.github.com/repos/influxdb/telegraf/keys{/key_id}","collaborators_url":"https://api.github.com/repos/influxdb/telegraf/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/influxdb/telegraf/teams","hooks_url":"https://api.github.com/repos/influxdb/telegraf/hooks","issue_events_url":"https://api.github.com/repos/influxdb/telegraf/issues/events{/number}","events_url":"https://api.github.com/repos/influxdb/telegraf/events","assignees_url":"https://api.github.com/repos/influxdb/telegraf/assignees{/user}","branches_url":"https://api.github.com/repos/influxdb/telegraf/branches{/branch}","tags_url":"https://api.github.com/repos/influxdb/telegraf/tags","blobs_url":"https://api.github.com/repos/influxdb/telegraf/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/influxdb/telegraf/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/influxdb/telegraf/git/refs{/sha}","trees_url":"https://api.github.com/repos/influxdb/telegraf/git/trees{/sha}","statuses_url":"https://api.github.com/repos/influxdb/telegraf/statuses/{sha}","languages_url":"https://api.github.com/repos/influxdb/telegraf/languages","stargazers_url":"https://api.github.com/repos/influxdb/telegraf/stargazers","contributors_url":"https://api.github.com/repos/influxdb/telegraf/contributors","subscribers_url":"https://api.github.com/repos/influxdb/telegraf/subscribers","subscription_url":"https://api.github.com/repos/influxdb/telegraf/subscription","commits_url":"https://api.github.com/repos/influxdb/telegraf/commits{/sha}","git_commits_url":"https://api.github.com/repos/influxdb/telegraf/git/commits{/sha}","comments_url":"https://api.github.com/repos/influxdb/telegraf/comments{/number}","issue_comment_url":"https://api.github.com/repos/influxdb/telegraf/issues/comments{/number}","contents_url":"https://api.github.com/repos/influxdb/telegraf/contents/{+path}","compare_url":"https://api.github.com/repos/influxdb/telegraf/compare/{base}...{head}","merges_url":"https://api.github.com/repos/influxdb/telegraf/merges","archive_url":"https://api.github.com/repos/influxdb/telegraf/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/influxdb/telegraf/downloads","issues_url":"https://api.github.com/repos/influxdb/telegraf/issues{/number}","pulls_url":"https://api.github.com/repos/influxdb/telegraf/pulls{/number}","milestones_url":"https://api.github.com/repos/influxdb/telegraf/milestones{/number}","notifications_url":"https://api.github.com/repos/influxdb/telegraf/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/influxdb/telegraf/labels{/name}","releases_url":"https://api.github.com/repos/influxdb/telegraf/releases{/id}","created_at":"2015-04-01T16:28:44Z","updated_at":"2015-08-13T10:33:26Z","pushed_at":"2015-08-13T01:24:45Z","git_url":"git://github.com/influxdb/telegraf.git","ssh_url":"git@github.com:influxdb/telegraf.git","clone_url":"https://github.com/influxdb/telegraf.git","svn_url":"https://github.com/influxdb/telegraf","homepage":"","size":5076,"stargazers_count":383,"watchers_count":383,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":55,"mirror_url":null,"open_issues_count":18,"forks":55,"open_issues":18,"watchers":383,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/111"},"html":{"href":"https://github.com/influxdb/telegraf/pull/111"},"issue":{"href":"https://api.github.com/repos/influxdb/telegraf/issues/111"},"comments":{"href":"https://api.github.com/repos/influxdb/telegraf/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/influxdb/telegraf/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/influxdb/telegraf/statuses/d3dd383e215251efbd7a674543356a53b682249d"}}}}