From 3a0ee8e49dbaa84ff0faf6fbad5d24945aafce1f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Sat, 24 Nov 2012 09:30:07 -0800 Subject: [PATCH] perfcounters: add 'perf' option to disable perf counters Signed-off-by: Sage Weil --- src/common/config_opts.h | 3 +++ src/common/perf_counters.cc | 21 +++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 51f569c7e1f96..e2a29fca5095f 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -92,6 +92,8 @@ OPTION(keyfile, OPT_STR, "") OPTION(keyring, OPT_STR, "/etc/ceph/$cluster.$name.keyring,/etc/ceph/$cluster.keyring,/etc/ceph/keyring,/etc/ceph/keyring.bin") OPTION(heartbeat_interval, OPT_INT, 5) OPTION(heartbeat_file, OPT_STR, "") +OPTION(perf, OPT_BOOL, true) // enable internal perf counters + OPTION(ms_tcp_nodelay, OPT_BOOL, true) OPTION(ms_initial_backoff, OPT_DOUBLE, .2) OPTION(ms_max_backoff, OPT_DOUBLE, 15.0) @@ -104,6 +106,7 @@ OPTION(ms_bind_port_max, OPT_INT, 7100) OPTION(ms_rwthread_stack_bytes, OPT_U64, 1024 << 10) OPTION(ms_tcp_read_timeout, OPT_U64, 900) OPTION(ms_inject_socket_failures, OPT_U64, 0) + OPTION(mon_data, OPT_STR, "/var/lib/ceph/mon/$cluster-$id") OPTION(mon_initial_members, OPT_STR, "") // list of initial cluster mon ids; if specified, need majority to form initial quorum and create new cluster OPTION(mon_sync_fs_threshold, OPT_INT, 5) // sync() when writing this many objects; 0 to disable. diff --git a/src/common/perf_counters.cc b/src/common/perf_counters.cc index 4166343adb484..144ea3c4d3bfb 100644 --- a/src/common/perf_counters.cc +++ b/src/common/perf_counters.cc @@ -97,6 +97,9 @@ PerfCounters::~PerfCounters() void PerfCounters::inc(int idx, uint64_t amt) { + if (!m_cct->_conf->perf) + return; + Mutex::Locker lck(m_lock); assert(idx > m_lower_bound); assert(idx < m_upper_bound); @@ -110,6 +113,9 @@ void PerfCounters::inc(int idx, uint64_t amt) void PerfCounters::dec(int idx, uint64_t amt) { + if (!m_cct->_conf->perf) + return; + Mutex::Locker lck(m_lock); assert(idx > m_lower_bound); assert(idx < m_upper_bound); @@ -123,6 +129,9 @@ void PerfCounters::dec(int idx, uint64_t amt) void PerfCounters::set(int idx, uint64_t amt) { + if (!m_cct->_conf->perf) + return; + Mutex::Locker lck(m_lock); assert(idx > m_lower_bound); assert(idx < m_upper_bound); @@ -136,6 +145,9 @@ void PerfCounters::set(int idx, uint64_t amt) uint64_t PerfCounters::get(int idx) const { + if (!m_cct->_conf->perf) + return 0; + Mutex::Locker lck(m_lock); assert(idx > m_lower_bound); assert(idx < m_upper_bound); @@ -147,6 +159,9 @@ uint64_t PerfCounters::get(int idx) const void PerfCounters::finc(int idx, double amt) { + if (!m_cct->_conf->perf) + return; + Mutex::Locker lck(m_lock); assert(idx > m_lower_bound); assert(idx < m_upper_bound); @@ -160,6 +175,9 @@ void PerfCounters::finc(int idx, double amt) void PerfCounters::fset(int idx, double amt) { + if (!m_cct->_conf->perf) + return; + Mutex::Locker lck(m_lock); assert(idx > m_lower_bound); assert(idx < m_upper_bound); @@ -173,6 +191,9 @@ void PerfCounters::fset(int idx, double amt) double PerfCounters::fget(int idx) const { + if (!m_cct->_conf->perf) + return 0.0; + Mutex::Locker lck(m_lock); assert(idx > m_lower_bound); assert(idx < m_upper_bound); -- 2.39.5