]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/common/mutex_debug.cc
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / common / mutex_debug.cc
index 49cc82b29ab52a137f8d8dfaf5642bc21659fd34..5660826ef2cf6d99bfc8cc19a29fae98c2d98f4e 100644 (file)
@@ -25,36 +25,21 @@ enum {
   l_mutex_last
 };
 
-mutex_debugging_base::mutex_debugging_base(const std::string &n, bool bt,
-                                          CephContext *cct) :
-  id(-1), backtrace(bt), nlock(0), locked_by(thread::id()),
-  cct(cct), logger(0) {
-  if (n.empty()) {
-    uuid_d uu;
-    uu.generate_random();
-    name = string("Unnamed-Mutex-") + uu.to_string();
-  } else {
-    name = n;
-  }
-  if (cct) {
-    PerfCountersBuilder b(cct, string("mutex-") + name,
-                         l_mutex_first, l_mutex_last);
-    b.add_time_avg(l_mutex_wait, "wait",
-                  "Average time of mutex in locked state");
-    logger = b.create_perf_counters();
-    cct->get_perfcounters_collection()->add(logger);
-    logger->set(l_mutex_wait, 0);
-  }
+mutex_debugging_base::mutex_debugging_base(const std::string &n, bool bt)
+  : name(n), id(-1), backtrace(bt), nlock(0), locked_by(thread::id())
+{
+  if (g_lockdep)
+    _register();
+}
+mutex_debugging_base::mutex_debugging_base(const char *n, bool bt)
+  : name(n), id(-1), backtrace(bt), nlock(0), locked_by(thread::id())
+{
   if (g_lockdep)
     _register();
 }
 
 mutex_debugging_base::~mutex_debugging_base() {
-  assert(nlock == 0);
-  if (cct && logger) {
-    cct->get_perfcounters_collection()->remove(logger);
-    delete logger;
-  }
+  ceph_assert(nlock == 0);
   if (g_lockdep) {
     lockdep_unregister(id);
   }
@@ -63,8 +48,8 @@ mutex_debugging_base::~mutex_debugging_base() {
 void mutex_debugging_base::_register() {
   id = lockdep_register(name.c_str());
 }
-void mutex_debugging_base::_will_lock() { // about to lock
-  id = lockdep_will_lock(name.c_str(), id, backtrace);
+void mutex_debugging_base::_will_lock(bool recursive) { // about to lock
+  id = lockdep_will_lock(name.c_str(), id, backtrace, recursive);
 }
 void mutex_debugging_base::_locked() {    // just locked
   id = lockdep_locked(name.c_str(), id, backtrace);
@@ -73,19 +58,5 @@ void mutex_debugging_base::_will_unlock() {  // about to unlock
   id = lockdep_will_unlock(name.c_str(), id);
 }
 
-ceph::mono_time mutex_debugging_base::before_lock_blocks() {
-  if (logger && cct && cct->_conf->mutex_perf_counter)
-    return ceph::mono_clock::now();
-  return ceph::mono_time::min();
-}
-
-void mutex_debugging_base::after_lock_blocks(ceph::mono_time start,
-                                            bool no_lockdep) {
-  if (logger && cct && cct->_conf->mutex_perf_counter)
-    logger->tinc(l_mutex_wait,
-                ceph::mono_clock::now() - start);
-  if (!no_lockdep && g_lockdep)
-    _locked();
-}
 } // namespace mutex_debug_detail
 } // namespace ceph