From: Sage Weil Date: Sun, 8 Jun 2014 15:56:46 +0000 (-0700) Subject: mon: gather perf stats on elections X-Git-Tag: v0.83~104^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1939%2Fhead;p=ceph.git mon: gather perf stats on elections Signed-off-by: Sage Weil --- diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 5bd6c2eaab44..369f7c48c157 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -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& 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 &q, int l, uint64_t features (*p)->election_finished(); health_monitor->start(epoch); + logger->inc(l_mon_election_win); + finish_election(); } diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index c3ed9ce589e9..b976d3041300 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -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, };