{"action":"created","issue":{"url":"https://api.github.com/repos/google/benchmark/issues/330","repository_url":"https://api.github.com/repos/google/benchmark","labels_url":"https://api.github.com/repos/google/benchmark/issues/330/labels{/name}","comments_url":"https://api.github.com/repos/google/benchmark/issues/330/comments","events_url":"https://api.github.com/repos/google/benchmark/issues/330/events","html_url":"https://github.com/google/benchmark/issues/330","id":198056653,"number":330,"title":"Multiple threads spawned regardless of ->Threads(1)","user":{"login":"sztomi","id":240594,"avatar_url":"https://avatars.githubusercontent.com/u/240594?v=3","gravatar_id":"","url":"https://api.github.com/users/sztomi","html_url":"https://github.com/sztomi","followers_url":"https://api.github.com/users/sztomi/followers","following_url":"https://api.github.com/users/sztomi/following{/other_user}","gists_url":"https://api.github.com/users/sztomi/gists{/gist_id}","starred_url":"https://api.github.com/users/sztomi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sztomi/subscriptions","organizations_url":"https://api.github.com/users/sztomi/orgs","repos_url":"https://api.github.com/users/sztomi/repos","events_url":"https://api.github.com/users/sztomi/events{/privacy}","received_events_url":"https://api.github.com/users/sztomi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-29T19:28:26Z","updated_at":"2016-12-29T19:39:38Z","closed_at":null,"body":"I have a benchmark that I want to run on exactly one thread. I can't run it on many threads because the benchmark uses a unique system resource (a TCP port) that it would wait for. I tried the following:\r\n\r\n```cpp\r\nstatic void rpclib_get_answer(benchmark::State& state) {\r\n  printf(\"start\\n\");\r\n  rpclib_bench fixture;\r\n  while (state.KeepRunning())\r\n      fixture.get_answer();\r\n}\r\nBENCHMARK(rpclib_get_answer)->Threads(1);\r\n```\r\n\r\nalso `ThreadRange(1,1)`, and also using a real fixture with BENCHMARK_F. The output is always the same:\r\n\r\n```\r\nRun on (4 X 2700 MHz CPU s)\r\n2016-12-29 20:29:44\r\n***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.\r\nBenchmark                            Time           CPU Iterations\r\n------------------------------------------------------------------\r\nstart\r\nstart\r\nstart\r\nstart\r\nstart\r\n```\r\n\r\nAnd the benchmark gets stuck.\r\nIs this a bug or am I misunderstanding something?"},"comment":{"url":"https://api.github.com/repos/google/benchmark/issues/comments/269682015","html_url":"https://github.com/google/benchmark/issues/330#issuecomment-269682015","issue_url":"https://api.github.com/repos/google/benchmark/issues/330","id":269682015,"user":{"login":"sztomi","id":240594,"avatar_url":"https://avatars.githubusercontent.com/u/240594?v=3","gravatar_id":"","url":"https://api.github.com/users/sztomi","html_url":"https://github.com/sztomi","followers_url":"https://api.github.com/users/sztomi/followers","following_url":"https://api.github.com/users/sztomi/following{/other_user}","gists_url":"https://api.github.com/users/sztomi/gists{/gist_id}","starred_url":"https://api.github.com/users/sztomi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sztomi/subscriptions","organizations_url":"https://api.github.com/users/sztomi/orgs","repos_url":"https://api.github.com/users/sztomi/repos","events_url":"https://api.github.com/users/sztomi/events{/privacy}","received_events_url":"https://api.github.com/users/sztomi/received_events","type":"User","site_admin":false},"created_at":"2016-12-29T19:39:38Z","updated_at":"2016-12-29T19:39:38Z","body":"I see. It seems though that it is running the benchmark for a rather long time (I've been running it for around 5 minutes now, which takes a lot longer than the 100 repetitions times 5000 iterations that I used with another benchmarking framework). Is there a way to specify a maximum time for a benchmark?"}}
{"actor":{"display_login":"sztomi"}}