{"action":"created","issue":{"url":"https://api.github.com/repos/rmartinho/nonius/issues/10","repository_url":"https://api.github.com/repos/rmartinho/nonius","labels_url":"https://api.github.com/repos/rmartinho/nonius/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/rmartinho/nonius/issues/10/comments","events_url":"https://api.github.com/repos/rmartinho/nonius/issues/10/events","html_url":"https://github.com/rmartinho/nonius/issues/10","id":72597094,"number":10,"title":"Adjust macro interface for generating benchmarks","user":{"login":"acki-m","id":11368160,"avatar_url":"https://avatars.githubusercontent.com/u/11368160?v=3","gravatar_id":"","url":"https://api.github.com/users/acki-m","html_url":"https://github.com/acki-m","followers_url":"https://api.github.com/users/acki-m/followers","following_url":"https://api.github.com/users/acki-m/following{/other_user}","gists_url":"https://api.github.com/users/acki-m/gists{/gist_id}","starred_url":"https://api.github.com/users/acki-m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/acki-m/subscriptions","organizations_url":"https://api.github.com/users/acki-m/orgs","repos_url":"https://api.github.com/users/acki-m/repos","events_url":"https://api.github.com/users/acki-m/events{/privacy}","received_events_url":"https://api.github.com/users/acki-m/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rmartinho/nonius/labels/enhancement","name":"enhancement","color":"c7def8"},{"url":"https://api.github.com/repos/rmartinho/nonius/labels/interface","name":"interface","color":"006b75"}],"state":"open","locked":false,"assignee":{"login":"rmartinho","id":97083,"avatar_url":"https://avatars.githubusercontent.com/u/97083?v=3","gravatar_id":"","url":"https://api.github.com/users/rmartinho","html_url":"https://github.com/rmartinho","followers_url":"https://api.github.com/users/rmartinho/followers","following_url":"https://api.github.com/users/rmartinho/following{/other_user}","gists_url":"https://api.github.com/users/rmartinho/gists{/gist_id}","starred_url":"https://api.github.com/users/rmartinho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmartinho/subscriptions","organizations_url":"https://api.github.com/users/rmartinho/orgs","repos_url":"https://api.github.com/users/rmartinho/repos","events_url":"https://api.github.com/users/rmartinho/events{/privacy}","received_events_url":"https://api.github.com/users/rmartinho/received_events","type":"User","site_admin":false},"assignees":[{"login":"rmartinho","id":97083,"avatar_url":"https://avatars.githubusercontent.com/u/97083?v=3","gravatar_id":"","url":"https://api.github.com/users/rmartinho","html_url":"https://github.com/rmartinho","followers_url":"https://api.github.com/users/rmartinho/followers","following_url":"https://api.github.com/users/rmartinho/following{/other_user}","gists_url":"https://api.github.com/users/rmartinho/gists{/gist_id}","starred_url":"https://api.github.com/users/rmartinho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmartinho/subscriptions","organizations_url":"https://api.github.com/users/rmartinho/orgs","repos_url":"https://api.github.com/users/rmartinho/repos","events_url":"https://api.github.com/users/rmartinho/events{/privacy}","received_events_url":"https://api.github.com/users/rmartinho/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2015-05-02T06:28:58Z","updated_at":"2016-08-08T14:09:41Z","closed_at":null,"body":"The interface for automatically register benchmarks is the following:\r\n```\r\nNONIUS_BENCHMARK(\"My Benchmark\", [](nonius::chronometer meter)\r\n{\r\n//...\r\n}) \r\n```\r\n\r\nBecause of that it is not possible to use #ifdef inside the benchmark itself.\r\nit looks also not nice, see the end of the braces? `}) ` This makes it harder for the client writing benchmarks.\r\n\r\nI came up with following idea:\r\n\r\n```\r\nNONIUS_BENCHMARK(\"Group Sorting\", \"Sort 1\")\r\n{\r\n    meter.measure([&]() \r\n    {\r\n       // benchmark code\r\n    }\r\n}\r\n```\r\n\r\nYou can look in the testing framework catch, which you already use, how it is implemented there, but it's pretty easy. Basically the macro has to expand to a temporary function which gets as argument this `nonius::chronometer meter`\r\n\r\nAdditionally:\r\nLike you can see, I would like to group benchmarks together, but this is another big request, but you should keep this in mind when redesigning the interface.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/rmartinho/nonius/issues/comments/238249398","html_url":"https://github.com/rmartinho/nonius/issues/10#issuecomment-238249398","issue_url":"https://api.github.com/repos/rmartinho/nonius/issues/10","id":238249398,"user":{"login":"rmartinho","id":97083,"avatar_url":"https://avatars.githubusercontent.com/u/97083?v=3","gravatar_id":"","url":"https://api.github.com/users/rmartinho","html_url":"https://github.com/rmartinho","followers_url":"https://api.github.com/users/rmartinho/followers","following_url":"https://api.github.com/users/rmartinho/following{/other_user}","gists_url":"https://api.github.com/users/rmartinho/gists{/gist_id}","starred_url":"https://api.github.com/users/rmartinho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmartinho/subscriptions","organizations_url":"https://api.github.com/users/rmartinho/orgs","repos_url":"https://api.github.com/users/rmartinho/repos","events_url":"https://api.github.com/users/rmartinho/events{/privacy}","received_events_url":"https://api.github.com/users/rmartinho/received_events","type":"User","site_admin":false},"created_at":"2016-08-08T14:09:41Z","updated_at":"2016-08-08T14:09:41Z","body":"Actually, the two syntaxes can be disambiguated by the number of arguments used so it doesn't really need to be a breaking change."}}
{"actor":{"display_login":"rmartinho"}}