Fix Statistics in db_stress (#9260)
Summary: The `Statistics` objects are meant to be shared across translation units, but this was prevented by declaring them static. We need to ensure they are defined once in the program. The effect is now `StressTest::PrintStatistics()` can actually print statistics since it now sees non-null values when `--statistics=1`. Pull Request resolved: https://github.com/facebook/rocksdb/pull/9260 Reviewed By: zhichao-cao Differential Revision: D32910162 Pulled By: ajkr fbshipit-source-id: c926d6f556177987bee5fa3cbc87597803b230ee
This commit is contained in:
parent
a6a6aad74e
commit
ce42ae6ffd
1
TARGETS
1
TARGETS
@ -871,6 +871,7 @@ cpp_library(
|
|||||||
"db_stress_tool/db_stress_gflags.cc",
|
"db_stress_tool/db_stress_gflags.cc",
|
||||||
"db_stress_tool/db_stress_listener.cc",
|
"db_stress_tool/db_stress_listener.cc",
|
||||||
"db_stress_tool/db_stress_shared_state.cc",
|
"db_stress_tool/db_stress_shared_state.cc",
|
||||||
|
"db_stress_tool/db_stress_stat.cc",
|
||||||
"db_stress_tool/db_stress_test_base.cc",
|
"db_stress_tool/db_stress_test_base.cc",
|
||||||
"db_stress_tool/db_stress_tool.cc",
|
"db_stress_tool/db_stress_tool.cc",
|
||||||
"db_stress_tool/expected_state.cc",
|
"db_stress_tool/expected_state.cc",
|
||||||
|
@ -7,6 +7,7 @@ add_executable(db_stress${ARTIFACT_SUFFIX}
|
|||||||
db_stress_gflags.cc
|
db_stress_gflags.cc
|
||||||
db_stress_listener.cc
|
db_stress_listener.cc
|
||||||
db_stress_shared_state.cc
|
db_stress_shared_state.cc
|
||||||
|
db_stress_stat.cc
|
||||||
db_stress_test_base.cc
|
db_stress_test_base.cc
|
||||||
db_stress_tool.cc
|
db_stress_tool.cc
|
||||||
expected_state.cc
|
expected_state.cc
|
||||||
|
17
db_stress_tool/db_stress_stat.cc
Normal file
17
db_stress_tool/db_stress_stat.cc
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
||||||
|
// This source code is licensed under both the GPLv2 (found in the
|
||||||
|
// COPYING file in the root directory) and Apache 2.0 License
|
||||||
|
// (found in the LICENSE.Apache file in the root directory).
|
||||||
|
|
||||||
|
#ifdef GFLAGS
|
||||||
|
|
||||||
|
#include "db_stress_tool/db_stress_stat.h"
|
||||||
|
|
||||||
|
namespace ROCKSDB_NAMESPACE {
|
||||||
|
|
||||||
|
std::shared_ptr<ROCKSDB_NAMESPACE::Statistics> dbstats;
|
||||||
|
std::shared_ptr<ROCKSDB_NAMESPACE::Statistics> dbstats_secondaries;
|
||||||
|
|
||||||
|
} // namespace ROCKSDB_NAMESPACE
|
||||||
|
|
||||||
|
#endif // GFLAGS
|
@ -21,9 +21,10 @@ DECLARE_bool(histogram);
|
|||||||
DECLARE_bool(progress_reports);
|
DECLARE_bool(progress_reports);
|
||||||
|
|
||||||
namespace ROCKSDB_NAMESPACE {
|
namespace ROCKSDB_NAMESPACE {
|
||||||
|
|
||||||
// Database statistics
|
// Database statistics
|
||||||
static std::shared_ptr<ROCKSDB_NAMESPACE::Statistics> dbstats;
|
extern std::shared_ptr<ROCKSDB_NAMESPACE::Statistics> dbstats;
|
||||||
static std::shared_ptr<ROCKSDB_NAMESPACE::Statistics> dbstats_secondaries;
|
extern std::shared_ptr<ROCKSDB_NAMESPACE::Statistics> dbstats_secondaries;
|
||||||
|
|
||||||
class Stats {
|
class Stats {
|
||||||
private:
|
private:
|
||||||
|
1
src.mk
1
src.mk
@ -349,6 +349,7 @@ STRESS_LIB_SOURCES = \
|
|||||||
db_stress_tool/db_stress_gflags.cc \
|
db_stress_tool/db_stress_gflags.cc \
|
||||||
db_stress_tool/db_stress_listener.cc \
|
db_stress_tool/db_stress_listener.cc \
|
||||||
db_stress_tool/db_stress_shared_state.cc \
|
db_stress_tool/db_stress_shared_state.cc \
|
||||||
|
db_stress_tool/db_stress_stat.cc \
|
||||||
db_stress_tool/db_stress_test_base.cc \
|
db_stress_tool/db_stress_test_base.cc \
|
||||||
db_stress_tool/db_stress_tool.cc \
|
db_stress_tool/db_stress_tool.cc \
|
||||||
db_stress_tool/expected_state.cc \
|
db_stress_tool/expected_state.cc \
|
||||||
|
Loading…
Reference in New Issue
Block a user