{"action":"created","issue":{"url":"https://api.github.com/repos/nickbruun/hayai/issues/26","labels_url":"https://api.github.com/repos/nickbruun/hayai/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/nickbruun/hayai/issues/26/comments","events_url":"https://api.github.com/repos/nickbruun/hayai/issues/26/events","html_url":"https://github.com/nickbruun/hayai/issues/26","id":92338862,"number":26,"title":"Overflow","user":{"login":"Lectem","id":6024225,"avatar_url":"https://avatars.githubusercontent.com/u/6024225?v=3","gravatar_id":"","url":"https://api.github.com/users/Lectem","html_url":"https://github.com/Lectem","followers_url":"https://api.github.com/users/Lectem/followers","following_url":"https://api.github.com/users/Lectem/following{/other_user}","gists_url":"https://api.github.com/users/Lectem/gists{/gist_id}","starred_url":"https://api.github.com/users/Lectem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lectem/subscriptions","organizations_url":"https://api.github.com/users/Lectem/orgs","repos_url":"https://api.github.com/users/Lectem/repos","events_url":"https://api.github.com/users/Lectem/events{/privacy}","received_events_url":"https://api.github.com/users/Lectem/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-01T10:15:44Z","updated_at":"2015-07-21T12:01:28Z","closed_at":null,"body":"It would be nice if you could detect overflows and you are doing your calculations, I ended up having negative value and even very small ones in cases where the test lasts for a while (on low performance hardware).\r\nI suggest starting by using uint64_t instead of signed values, and detect overflows when computing the average times.\r\nI also think you should keep us and s seperated."},"comment":{"url":"https://api.github.com/repos/nickbruun/hayai/issues/comments/123283729","html_url":"https://github.com/nickbruun/hayai/issues/26#issuecomment-123283729","issue_url":"https://api.github.com/repos/nickbruun/hayai/issues/26","id":123283729,"user":{"login":"Lectem","id":6024225,"avatar_url":"https://avatars.githubusercontent.com/u/6024225?v=3","gravatar_id":"","url":"https://api.github.com/users/Lectem","html_url":"https://github.com/Lectem","followers_url":"https://api.github.com/users/Lectem/followers","following_url":"https://api.github.com/users/Lectem/following{/other_user}","gists_url":"https://api.github.com/users/Lectem/gists{/gist_id}","starred_url":"https://api.github.com/users/Lectem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lectem/subscriptions","organizations_url":"https://api.github.com/users/Lectem/orgs","repos_url":"https://api.github.com/users/Lectem/repos","events_url":"https://api.github.com/users/Lectem/events{/privacy}","received_events_url":"https://api.github.com/users/Lectem/received_events","type":"User","site_admin":false},"created_at":"2015-07-21T12:01:28Z","updated_at":"2015-07-21T12:01:28Z","body":"The test overflows on 32bit arch (tested on 32bit arm) but not on my 64-bit (x86 CPU).\r\n\r\nI found the issue and fixed it with https://github.com/nickbruun/hayai/pull/29 .\r\n\r\nA test that could show this behaviour is\r\n\r\n\r\n    #include <hayai.hpp>\r\n    BENCHMARK(overflow,bug,100,50)\r\n    {\r\n        usleep(150541);\r\n    }\r\n\r\nIt could probably be made shorter though. The results used to be :\r\n\r\n    [==========] Running 1 benchmark..\r\n    [ RUN      ] overflow.bug (100 runs, 50 iterations per run)\r\n    [     DONE ] overflow.bug (-58970.656200 ms)\r\n    [   RUNS   ]        Average time: -589706.562 us\r\n                         Fastest: -595866.592 us (-6160.030 us / 1.045 %)\r\n                         Slowest: -582545.592 us (+7160.970 us / +-1.214 %)\r\n                                  \r\n             Average performance: -1.69576 runs/s\r\n                Best performance: -1.67823 runs/s (+0.01753 runs/s / +-1.03379 %)\r\n               Worst performance: -1.71660 runs/s (-0.02085 runs/s / 1.22925 %)\r\n    [ITERATIONS]        Average time: -11794.131 us\r\n                         Fastest: -11917.332 us (-123.201 us / 1.045 %)\r\n                         Slowest: -11650.912 us (+143.219 us / +-1.214 %)\r\n                                  \r\n             Average performance: -84.78793 iterations/s\r\n                Best performance: -83.91140 iterations/s (+0.87653 iterations/s / +-1.03379 %)\r\n               Worst performance: -85.83019 iterations/s (-1.04226 iterations/s / 1.22925 %)\r\n    [==========] Ran 1 benchmark..\r\n"}}