提交 37de4e1d 编写于 作者: M Mark Callaghan 提交者: Facebook GitHub Bot

Correctly set ThreadState::tid (#9757)

Summary:
Fixes a bug introduced by me in https://github.com/facebook/rocksdb/pull/9733
That PR added a counter so that the per-thread seeds in ThreadState would
be unique even when --benchmarks had more than one test. But it incorrectly
used this counter as the value for ThreadState::tid as well.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/9757

Test Plan:
Confirm that unexpectedly good QPS results on the regression tests return
to normal with this fix. I have confirmed that the QPS increase starts with
the PR 9733 diff.

Reviewed By: jay-zhuang

Differential Revision: D35149303

Pulled By: mdcallag

fbshipit-source-id: dee5cc36b7faaba6c3be6d6a253d3c2eaad72864
上级 e2cb9aa2
......@@ -2427,7 +2427,8 @@ struct ThreadState {
Stats stats;
SharedState* shared;
explicit ThreadState(int index) : tid(index), rand(seed_base + index) {}
explicit ThreadState(int index, int my_seed)
: tid(index), rand(seed_base + my_seed) {}
};
class Duration {
......@@ -3663,7 +3664,7 @@ class Benchmark {
arg[i].method = method;
arg[i].shared = &shared;
total_thread_count_++;
arg[i].thread = new ThreadState(total_thread_count_);
arg[i].thread = new ThreadState(i, total_thread_count_);
arg[i].thread->stats.SetReporterAgent(reporter_agent.get());
arg[i].thread->shared = &shared;
FLAGS_env->StartThread(ThreadBody, &arg[i]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册