{"action":"created","issue":{"url":"https://api.github.com/repos/paulbellamy/ratecounter/issues/9","repository_url":"https://api.github.com/repos/paulbellamy/ratecounter","labels_url":"https://api.github.com/repos/paulbellamy/ratecounter/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/paulbellamy/ratecounter/issues/9/comments","events_url":"https://api.github.com/repos/paulbellamy/ratecounter/issues/9/events","html_url":"https://github.com/paulbellamy/ratecounter/issues/9","id":243369062,"number":9,"title":"Intensive CPU usage.","user":{"login":"cheshir","id":1440703,"avatar_url":"https://avatars3.githubusercontent.com/u/1440703?v=4","gravatar_id":"","url":"https://api.github.com/users/cheshir","html_url":"https://github.com/cheshir","followers_url":"https://api.github.com/users/cheshir/followers","following_url":"https://api.github.com/users/cheshir/following{/other_user}","gists_url":"https://api.github.com/users/cheshir/gists{/gist_id}","starred_url":"https://api.github.com/users/cheshir/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cheshir/subscriptions","organizations_url":"https://api.github.com/users/cheshir/orgs","repos_url":"https://api.github.com/users/cheshir/repos","events_url":"https://api.github.com/users/cheshir/events{/privacy}","received_events_url":"https://api.github.com/users/cheshir/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-07-17T11:43:22Z","updated_at":"2017-07-18T12:52:16Z","closed_at":null,"body":"Hi guys.\r\n\r\nAfter upgrading library from #7 version I caught strange CPU behavior:\r\n\r\n![example](http://i.piccy.info/i9/32e88489429e5dd3e0f20059ec7a5062/1500292921/62200/1097549/CPU_usage.jpg)\r\nI couldn't reproduce this bug with small snippet. So keep in mind this issue when you will have the similar problem."},"comment":{"url":"https://api.github.com/repos/paulbellamy/ratecounter/issues/comments/316054137","html_url":"https://github.com/paulbellamy/ratecounter/issues/9#issuecomment-316054137","issue_url":"https://api.github.com/repos/paulbellamy/ratecounter/issues/9","id":316054137,"user":{"login":"t0mk","id":1223677,"avatar_url":"https://avatars1.githubusercontent.com/u/1223677?v=4","gravatar_id":"","url":"https://api.github.com/users/t0mk","html_url":"https://github.com/t0mk","followers_url":"https://api.github.com/users/t0mk/followers","following_url":"https://api.github.com/users/t0mk/following{/other_user}","gists_url":"https://api.github.com/users/t0mk/gists{/gist_id}","starred_url":"https://api.github.com/users/t0mk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/t0mk/subscriptions","organizations_url":"https://api.github.com/users/t0mk/orgs","repos_url":"https://api.github.com/users/t0mk/repos","events_url":"https://api.github.com/users/t0mk/events{/privacy}","received_events_url":"https://api.github.com/users/t0mk/received_events","type":"User","site_admin":false},"created_at":"2017-07-18T12:52:16Z","updated_at":"2017-07-18T12:52:16Z","body":"I might have the same problem. With ratecounter after f3fe9d300be8ba75181604e7da19096fbccfdb2b, after ~1 day of ~10/s Incr()s on ~100 histograms, the process cpu usage rises, and pprof shows that most of the time is spent in runtime.siftdownTimer. I suspect similar issue as in\r\nhttps://forum.golangbridge.org/t/runtime-siftdowntimer-consuming-60-of-the-cpu/3773\r\n\r\ncoming from https://github.com/paulbellamy/ratecounter/blob/master/ratecounter.go#L48 \r\n\r\nMaybe just rewrite the for loop as\r\n```\r\nticker := time.NewTicker(time.Duration(float64(r.interval) / float64(r.resolution)))\r\nselect { \r\ncase <- ticker.C: \r\n    [...]\r\n}\r\n```\r\n\r\nI will test this and maybe write later."}}
{"actor":{"display_login":"t0mk"}}