]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: gather perf stats on elections 1939/head
authorSage Weil <sage@inktank.com>
Sun, 8 Jun 2014 15:56:46 +0000 (08:56 -0700)
committerSage Weil <sage@inktank.com>
Sun, 8 Jun 2014 15:56:46 +0000 (08:56 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
src/mon/Monitor.cc
src/mon/Monitor.h

index 5bd6c2eaab442c2625992e1fa43292779a3f8324..369f7c48c157e79b53b50d3db1cbced4dbc9452b 100644 (file)
@@ -393,6 +393,10 @@ int Monitor::preinit()
     pcb.add_u64_counter(l_mon_session_add, "session_add");
     pcb.add_u64_counter(l_mon_session_rm, "session_rm");
     pcb.add_u64_counter(l_mon_session_trim, "session_trim");
+    pcb.add_u64_counter(l_mon_num_elections, "num_elections");
+    pcb.add_u64_counter(l_mon_election_call, "election_call");
+    pcb.add_u64_counter(l_mon_election_win, "election_win");
+    pcb.add_u64_counter(l_mon_election_lose, "election_lose");
     logger = pcb.create_perf_counters();
     cct->get_perfcounters_collection()->add(logger);
   }
@@ -1579,6 +1583,9 @@ void Monitor::join_election()
 {
   dout(10) << __func__ << dendl;
   state = STATE_ELECTING;
+
+  logger->inc(l_mon_num_elections);
+
   _reset();
 }
 
@@ -1588,6 +1595,9 @@ void Monitor::start_election()
   state = STATE_ELECTING;
   _reset();
 
+  logger->inc(l_mon_num_elections);
+  logger->inc(l_mon_election_call);
+
   cancel_probe_timeout();
 
   clog.info() << "mon." << name << " calling new monitor election\n";
@@ -1659,6 +1669,8 @@ void Monitor::win_election(epoch_t epoch, set<int>& active, uint64_t features,
   }
   health_monitor->start(epoch);
 
+  logger->inc(l_mon_election_win);
+
   finish_election();
   if (monmap->size() > 1 &&
       monmap->get_epoch() > 0)
@@ -1681,6 +1693,8 @@ void Monitor::lose_election(epoch_t epoch, set<int> &q, int l, uint64_t features
     (*p)->election_finished();
   health_monitor->start(epoch);
 
+  logger->inc(l_mon_election_win);
+
   finish_election();
 }
 
index c3ed9ce589e993939898edf9116728e0eed08149..b976d3041300cc7ed921b3d5a853e8f479308da8 100644 (file)
@@ -91,6 +91,10 @@ enum {
   l_mon_session_add,
   l_mon_session_rm,
   l_mon_session_trim,
+  l_mon_num_elections,
+  l_mon_election_call,
+  l_mon_election_win,
+  l_mon_election_lose,
   l_mon_last,
 };