mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
[RocksDB] Use raw pointer instead of shared pointer when passing Statistics object internally
Summary: liveness of the statistics object is already ensured by the shared pointer in DB options. There's no reason to pass again shared pointer among internal functions. Raw pointer is sufficient and efficient. Test Plan: make check Reviewers: dhruba, MarkCallaghan, igor Reviewed By: dhruba CC: leveldb, reconnect.grayhat Differential Revision: https://reviews.facebook.net/D14289
This commit is contained in:
@@ -5,16 +5,16 @@
|
||||
//
|
||||
#pragma once
|
||||
#include "rocksdb/env.h"
|
||||
#include "rocksdb/statistics.h"
|
||||
#include "util/statistics_imp.h"
|
||||
|
||||
namespace rocksdb {
|
||||
// Auto-scoped.
|
||||
// Records the statistic into the corresponding histogram.
|
||||
class StopWatch {
|
||||
public:
|
||||
StopWatch(
|
||||
explicit StopWatch(
|
||||
Env * const env,
|
||||
std::shared_ptr<Statistics> statistics = nullptr,
|
||||
Statistics* statistics = nullptr,
|
||||
const Histograms histogram_name = DB_GET) :
|
||||
env_(env),
|
||||
start_time_(env->NowMicros()),
|
||||
@@ -36,7 +36,7 @@ class StopWatch {
|
||||
private:
|
||||
Env* const env_;
|
||||
const uint64_t start_time_;
|
||||
std::shared_ptr<Statistics> statistics_;
|
||||
Statistics* statistics_;
|
||||
const Histograms histogram_name_;
|
||||
|
||||
};
|
||||
@@ -44,7 +44,7 @@ class StopWatch {
|
||||
// a nano second precision stopwatch
|
||||
class StopWatchNano {
|
||||
public:
|
||||
StopWatchNano(Env* const env, bool auto_start = false)
|
||||
explicit StopWatchNano(Env* const env, bool auto_start = false)
|
||||
: env_(env), start_(0) {
|
||||
if (auto_start) {
|
||||
Start();
|
||||
|
||||
Reference in New Issue
Block a user