From: Sage Weil Date: Tue, 18 Oct 2016 14:16:13 +0000 (-0400) Subject: osd/PG: add perfcounters for pg info updates X-Git-Tag: v11.1.0~600^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F11213%2Fhead;p=ceph.git osd/PG: add perfcounters for pg info updates Note info updates (of any kind), fastinfo updates, and biginfo updates. Signed-off-by: Sage Weil --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 40b14c112c84..d6c37d1aa4ba 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2591,6 +2591,13 @@ void OSD::create_logger() osd_plb.add_time_avg(l_osd_tier_promote_lat, "osd_tier_promote_lat", "Object promote latency"); osd_plb.add_time_avg(l_osd_tier_r_lat, "osd_tier_r_lat", "Object proxy read latency"); + osd_plb.add_u64_counter(l_osd_pg_info, "osd_pg_info", + "PG updated its info (using any method)"); + osd_plb.add_u64_counter(l_osd_pg_fastinfo, "osd_pg_fastinfo", + "PG updated its info using fastinfo attr"); + osd_plb.add_u64_counter(l_osd_pg_biginfo, "osd_pg_biginfo", + "PG updated its biginfo attr"); + logger = osd_plb.create_perf_counters(); cct->get_perfcounters_collection()->add(logger); } diff --git a/src/osd/OSD.h b/src/osd/OSD.h index a15368bb3ab6..a08a34f45462 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -158,6 +158,10 @@ enum { l_osd_tier_promote_lat, l_osd_tier_r_lat, + l_osd_pg_info, + l_osd_pg_fastinfo, + l_osd_pg_biginfo, + l_osd_last, }; diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 8f4ed7d072ca..5557e41eea98 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -25,6 +25,7 @@ #include "ScrubStore.h" #include "common/Timer.h" +#include "common/perf_counters.h" #include "messages/MOSDOp.h" #include "messages/MOSDPGNotify.h" @@ -2794,12 +2795,16 @@ int PG::_prepare_write_info(map *km, map &past_intervals, bool dirty_big_info, bool dirty_epoch, - bool try_fast_info) + bool try_fast_info, + PerfCounters *logger) { if (dirty_epoch) { ::encode(epoch, (*km)[epoch_key]); } + if (logger) + logger->inc(l_osd_pg_info); + // try to do info efficiently? if (!dirty_big_info && try_fast_info && info.last_update > last_written_info.last_update) { @@ -2809,6 +2814,8 @@ int PG::_prepare_write_info(map *km, assert(did); // we verified last_update increased above if (info == last_written_info) { ::encode(fast, (*km)[fastinfo_key]); + if (logger) + logger->inc(l_osd_pg_fastinfo); return 0; } generic_dout(30) << __func__ << " fastinfo failed, info:\n"; @@ -2839,6 +2846,8 @@ int PG::_prepare_write_info(map *km, ::encode(past_intervals, bigbl); ::encode(info.purged_snaps, bigbl); //dout(20) << "write_info bigbl " << bigbl.length() << dendl; + if (logger) + logger->inc(l_osd_pg_biginfo); } return 0; @@ -2884,7 +2893,8 @@ void PG::prepare_write_info(map *km) last_written_info, past_intervals, dirty_big_info, need_update_epoch, - g_conf->osd_fast_info); + g_conf->osd_fast_info, + osd->logger); assert(ret == 0); if (need_update_epoch) last_epoch = get_osdmap()->get_epoch(); diff --git a/src/osd/PG.h b/src/osd/PG.h index 0a8fbe04a605..9f53362a6c4b 100644 --- a/src/osd/PG.h +++ b/src/osd/PG.h @@ -2243,7 +2243,8 @@ public: map &past_intervals, bool dirty_big_info, bool dirty_epoch, - bool try_fast_info); + bool try_fast_info, + PerfCounters *logger = NULL); void write_if_dirty(ObjectStore::Transaction& t); eversion_t get_next_version() const {