{"action":"created","issue":{"url":"https://api.github.com/repos/google/benchmark/issues/286","repository_url":"https://api.github.com/repos/google/benchmark","labels_url":"https://api.github.com/repos/google/benchmark/issues/286/labels{/name}","comments_url":"https://api.github.com/repos/google/benchmark/issues/286/comments","events_url":"https://api.github.com/repos/google/benchmark/issues/286/events","html_url":"https://github.com/google/benchmark/pull/286","id":174719121,"number":286,"title":"Make `PauseTiming()` and `ResumeTiming()` per thread.","user":{"login":"EricWF","id":1176427,"avatar_url":"https://avatars.githubusercontent.com/u/1176427?v=3","gravatar_id":"","url":"https://api.github.com/users/EricWF","html_url":"https://github.com/EricWF","followers_url":"https://api.github.com/users/EricWF/followers","following_url":"https://api.github.com/users/EricWF/following{/other_user}","gists_url":"https://api.github.com/users/EricWF/gists{/gist_id}","starred_url":"https://api.github.com/users/EricWF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EricWF/subscriptions","organizations_url":"https://api.github.com/users/EricWF/orgs","repos_url":"https://api.github.com/users/EricWF/repos","events_url":"https://api.github.com/users/EricWF/events{/privacy}","received_events_url":"https://api.github.com/users/EricWF/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/google/benchmark/labels/cla:%20yes","name":"cla: yes","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":21,"created_at":"2016-09-02T09:35:37Z","updated_at":"2016-09-02T22:40:16Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/google/benchmark/pulls/286","html_url":"https://github.com/google/benchmark/pull/286","diff_url":"https://github.com/google/benchmark/pull/286.diff","patch_url":"https://github.com/google/benchmark/pull/286.patch"},"body":"Currently we time benchmarks using a single global timer that tracks per-process CPU usage. Pausing and resuming this timer have to act as a barrier to all threads. This has crippling effects on multi-threaded benchmarks. If you pause every iterator you synchronize the entire benchmark. It's effectively no longer multi-threaded.\r\n\r\nThis patch changes to a per-thread timer. Instead of measuring process CPU time we sum thread CPU time and we pause on a per-thread basis. \r\n\r\nBelow are comparison of the new and old results from `basic_test.cc`. Note that the `BM_spin_pause_during` test get 95% faster.\r\n\r\n```\r\nBenchmark                                                    Time           CPU\r\n-------------------------------------------------------------------------------\r\nBM_empty_mean                                               +0.00         +0.00\r\nBM_empty/threads:4_mean                                     +0.00         +0.00\r\nBM_spin_empty/8_mean                                        +0.00         +0.00\r\nBM_spin_empty/512_mean                                      +0.01         +0.00\r\nBM_spin_empty/8k_mean                                       -0.00         -0.00\r\nBM_spin_empty/8/threads:4_mean                              +0.00         -0.17\r\nBM_spin_empty/512/threads:4_mean                            +0.01         +0.00\r\nBM_spin_empty/8k/threads:4_mean                             -0.01         +0.00\r\nBM_spin_pause_before/8_mean                                 +0.00         +0.00\r\nBM_spin_pause_before/512_mean                               +0.03         +0.02\r\nBM_spin_pause_before/8k_mean                                +0.01         +0.01\r\nBM_spin_pause_before/8/threads:4_mean                       +0.00         +0.00\r\nBM_spin_pause_before/512/threads:4_mean                     +0.04         +0.01\r\nBM_spin_pause_before/8k/threads:4_mean                      -0.03         -0.00\r\nBM_spin_pause_during/8_mean                                 -0.24         -0.25\r\nBM_spin_pause_during/512_mean                               -0.24         -0.24\r\nBM_spin_pause_during/8k_mean                                -0.13         -0.13\r\nBM_spin_pause_during/8/threads:4_mean                       -0.97         -0.90\r\nBM_spin_pause_during/512/threads:4_mean                     -0.96         -0.89\r\nBM_spin_pause_during/8k/threads:4_mean                      -0.95         -0.85\r\nBM_pause_during_mean                                        -0.23         -0.20\r\nBM_pause_during/threads:4_mean                              -0.97         -0.90\r\nBM_pause_during/real_time_mean                              -0.24         -0.26\r\nBM_pause_during/real_time/threads:4_mean                    -0.97         -0.90\r\nBM_spin_pause_after/8_mean                                  +0.00         +0.00\r\nBM_spin_pause_after/512_mean                                +0.00         +0.00\r\nBM_spin_pause_after/8k_mean                                 -0.00         -0.00\r\nBM_spin_pause_after/8/threads:4_mean                        +0.00         +0.00\r\nBM_spin_pause_after/512/threads:4_mean                      -0.01         -0.02\r\nBM_spin_pause_after/8k/threads:4_mean                       +0.01         +0.01\r\nBM_spin_pause_before_and_after/8_mean                       +0.00         +0.00\r\nBM_spin_pause_before_and_after/512_mean                     +0.00         +0.00\r\nBM_spin_pause_before_and_after/8k_mean                      +0.01         +0.01\r\nBM_spin_pause_before_and_after/8/threads:4_mean             +0.00         +0.00\r\nBM_spin_pause_before_and_after/512/threads:4_mean           +0.06         +0.04\r\nBM_spin_pause_before_and_after/8k/threads:4_mean            -0.00         +0.02\r\nBM_empty_stop_start_mean                                    +0.00         +0.00\r\nBM_empty_stop_start/threads:4_mean                          +0.00         +0.00\r\n```\r\n\r\nThere's still work to do on this, but I was hoping for initial feedback on the direction.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/google/benchmark/issues/comments/244503515","html_url":"https://github.com/google/benchmark/pull/286#issuecomment-244503515","issue_url":"https://api.github.com/repos/google/benchmark/issues/286","id":244503515,"user":{"login":"AppVeyorBot","id":17834419,"avatar_url":"https://avatars.githubusercontent.com/u/17834419?v=3","gravatar_id":"","url":"https://api.github.com/users/AppVeyorBot","html_url":"https://github.com/AppVeyorBot","followers_url":"https://api.github.com/users/AppVeyorBot/followers","following_url":"https://api.github.com/users/AppVeyorBot/following{/other_user}","gists_url":"https://api.github.com/users/AppVeyorBot/gists{/gist_id}","starred_url":"https://api.github.com/users/AppVeyorBot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AppVeyorBot/subscriptions","organizations_url":"https://api.github.com/users/AppVeyorBot/orgs","repos_url":"https://api.github.com/users/AppVeyorBot/repos","events_url":"https://api.github.com/users/AppVeyorBot/events{/privacy}","received_events_url":"https://api.github.com/users/AppVeyorBot/received_events","type":"User","site_admin":false},"created_at":"2016-09-02T22:40:16Z","updated_at":"2016-09-02T22:40:16Z","body":":x: [Build benchmark 420 failed](https://ci.appveyor.com/project/google/benchmark/build/420) (commit https://github.com/google/benchmark/commit/7d3644d3cf by @EricWF)"}}
{"actor":{"display_login":"AppVeyorBot"}}