diff --git a/db/db_bench.cc b/db/db_bench.cc index 8cfdfcb82..04f1f4ca1 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -1817,7 +1817,7 @@ int main(int argc, char** argv) { } else if (sscanf(argv[i], "--statistics=%d%c", &n, &junk) == 1 && (n == 0 || n == 1)) { if (n == 1) { - dbstats.reset(new leveldb::DBStatistics()); + dbstats = leveldb::CreateDBStatistics(); FLAGS_statistics = true; } } else if (sscanf(argv[i], "--writes=%d%c", &n, &junk) == 1) { diff --git a/db/db_statistics.h b/db/db_statistics.h index badfd1b58..9f2d93ef2 100644 --- a/db/db_statistics.h +++ b/db/db_statistics.h @@ -8,6 +8,7 @@ #include #include #include +#include #include "leveldb/statistics.h" #include "util/histogram.h" @@ -48,6 +49,11 @@ class DBStatistics: public Statistics { std::vector allTickers_; std::vector allHistograms_; }; + +std::shared_ptr CreateDBStatistics() { + return std::make_shared(); +} + } // namespace leveldb #endif // LEVELDB_STORAGE_DB_DB_STATISTICS_H_ diff --git a/include/leveldb/statistics.h b/include/leveldb/statistics.h index 31f542edd..fe4878f23 100644 --- a/include/leveldb/statistics.h +++ b/include/leveldb/statistics.h @@ -128,6 +128,9 @@ class Statistics { }; +// Create a concrete DBStatistics object +std::shared_ptr CreateDBStatistics(); + // Ease of Use functions inline void RecordTick(std::shared_ptr statistics, Tickers ticker, diff --git a/tools/db_stress.cc b/tools/db_stress.cc index 3a759d5c9..791ff25c1 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -1081,7 +1081,7 @@ int main(int argc, char** argv) { } else if (sscanf(argv[i], "--statistics=%d%c", &n, &junk) == 1 && (n == 0 || n == 1)) { if (n == 1) { - dbstats.reset(new leveldb::DBStatistics()); + dbstats = leveldb::CreateDBStatistics(); } } else if (sscanf(argv[i], "--sync=%d%c", &n, &junk) == 1 && (n == 0 || n == 1)) {