From: David Zafman Date: Tue, 6 Aug 2019 03:57:48 +0000 (-0700) Subject: osd mon mgr: Convert all network ping time output to milliseconds X-Git-Tag: v15.1.0~1664^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9d02e5d39d7b5e2806a5d98bdde24f4584e70528;p=ceph.git osd mon mgr: Convert all network ping time output to milliseconds To output milliseconds (usec / 1000), treat as fixed point integers Signed-off-by: David Zafman --- diff --git a/src/mgr/ClusterState.cc b/src/mgr/ClusterState.cc index 0bb06229bd90..80eb6828a8dc 100644 --- a/src/mgr/ClusterState.cc +++ b/src/mgr/ClusterState.cc @@ -339,21 +339,21 @@ bool ClusterState::asok_command(std::string_view admin_command, const cmdmap_t& f->dump_int("to osd", sitem.to); f->dump_string("interface", (sitem.back ? "back" : "front")); f->open_object_section("average"); - f->dump_unsigned("1min", sitem.times[0]); - f->dump_unsigned("5min", sitem.times[1]); - f->dump_unsigned("15min", sitem.times[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.times[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.times[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.times[2],3).c_str()); f->close_section(); // average f->open_object_section("min"); - f->dump_unsigned("1min", sitem.min[0]); - f->dump_unsigned("5min", sitem.min[1]); - f->dump_unsigned("15min", sitem.min[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.min[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.min[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.min[2],3).c_str()); f->close_section(); // min f->open_object_section("max"); - f->dump_unsigned("1min", sitem.max[0]); - f->dump_unsigned("5min", sitem.max[1]); - f->dump_unsigned("15min", sitem.max[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.max[2],3).c_str()); f->close_section(); // max - f->dump_unsigned("last", sitem.last); + f->dump_format_unquoted("last", "%s", fixed_u_to_string(sitem.last,3).c_str()); f->close_section(); // entry } f->close_section(); // entries diff --git a/src/mon/PGMap.cc b/src/mon/PGMap.cc index 8bebe8f1c4b9..2b7f1f6d17a3 100644 --- a/src/mon/PGMap.cc +++ b/src/mon/PGMap.cc @@ -2836,7 +2836,7 @@ void PGMap::get_health_checks( << (osdmap.is_down(sback.from) ? " (down)" : "") << " to osd." << sback.to << (osdmap.is_down(sback.to) ? " (down)" : "") - << " " << sback.pingtime << " usec" + << " " << fixed_u_to_string(sback.pingtime, 3) << " msec" << (sback.improving ? " possibly improving" : ""); detail_back.push_back(ss.str()); } @@ -2853,14 +2853,14 @@ void PGMap::get_health_checks( << (osdmap.is_down(sfront.from) ? " (down)" : "") << " to osd." << sfront.to << (osdmap.is_down(sfront.to) ? " (down)" : "") - << " " << sfront.pingtime << " usec" + << " " << fixed_u_to_string(sfront.pingtime, 3) << " msec" << (sfront.improving ? " possibly improving" : ""); detail_front.push_back(ss.str()); } if (detail_back.size() != 0) { ostringstream ss; ss << "Long heartbeat ping times on back interface seen, longest is " - << back_sorted.rbegin()->pingtime << " usec"; + << fixed_u_to_string(back_sorted.rbegin()->pingtime, 3) << " msec"; auto& d = checks->add("OSD_SLOW_PING_TIME_BACK", HEALTH_WARN, ss.str(), back_sorted.size()); d.detail.swap(detail_back); @@ -2868,7 +2868,7 @@ void PGMap::get_health_checks( if (detail_front.size() != 0) { ostringstream ss; ss << "Long heartbeat ping times on front interface seen, longest is " - << front_sorted.rbegin()->pingtime << " usec"; + << fixed_u_to_string(front_sorted.rbegin()->pingtime, 3) << " msec"; auto& d = checks->add("OSD_SLOW_PING_TIME_FRONT", HEALTH_WARN, ss.str(), front_sorted.size()); d.detail.swap(detail_front); diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index d4f831b74d2d..84eba7408880 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2667,21 +2667,21 @@ will start to track new ops received afterwards."; f->dump_int("to osd", sitem.to); f->dump_string("interface", (sitem.back ? "back" : "front")); f->open_object_section("average"); - f->dump_int("1min", sitem.times[0]); - f->dump_int("5min", sitem.times[1]); - f->dump_int("15min", sitem.times[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.times[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.times[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.times[2],3).c_str()); f->close_section(); // average f->open_object_section("min"); - f->dump_int("1min", sitem.min[0]); - f->dump_int("5min", sitem.min[1]); - f->dump_int("15min", sitem.min[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.max[2],3).c_str()); f->close_section(); // min f->open_object_section("max"); - f->dump_int("1min", sitem.max[0]); - f->dump_int("5min", sitem.max[1]); - f->dump_int("15min", sitem.max[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(sitem.max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(sitem.max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(sitem.max[2],3).c_str()); f->close_section(); // max - f->dump_int("last", sitem.last); + f->dump_format_unquoted("last", "%s", fixed_u_to_string(sitem.last,3).c_str()); f->close_section(); // entry } f->close_section(); // entries diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index 284f150edc09..4df81aa7e1ad 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -441,42 +441,42 @@ void osd_stat_t::dump(Formatter *f) const f->open_object_section("interface"); f->dump_string("interface", "back"); f->open_object_section("average"); - f->dump_int("1min", i.second.back_pingtime[0]); - f->dump_int("5min", i.second.back_pingtime[1]); - f->dump_int("15min", i.second.back_pingtime[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.back_pingtime[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.back_pingtime[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.back_pingtime[2],3).c_str()); f->close_section(); // average f->open_object_section("min"); - f->dump_int("1min", i.second.back_min[0]); - f->dump_int("5min", i.second.back_min[1]); - f->dump_int("15min", i.second.back_min[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.back_min[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.back_min[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.back_min[2],3).c_str()); f->close_section(); // min f->open_object_section("max"); - f->dump_int("1min", i.second.back_max[0]); - f->dump_int("5min", i.second.back_max[1]); - f->dump_int("15min", i.second.back_max[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.back_max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.back_max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.back_max[2],3).c_str()); f->close_section(); // max - f->dump_int("last", i.second.back_last); + f->dump_format_unquoted("last", "%s", fixed_u_to_string(i.second.back_last,3).c_str()); f->close_section(); // interface if (i.second.front_pingtime[0] != 0) { f->open_object_section("interface"); f->dump_string("interface", "front"); f->open_object_section("average"); - f->dump_int("1min", i.second.front_pingtime[0]); - f->dump_int("5min", i.second.front_pingtime[1]); - f->dump_int("15min", i.second.front_pingtime[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.front_pingtime[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.front_pingtime[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.front_pingtime[2],3).c_str()); f->close_section(); // average f->open_object_section("min"); - f->dump_int("1min", i.second.front_min[0]); - f->dump_int("5min", i.second.front_min[1]); - f->dump_int("15min", i.second.front_min[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.front_min[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.front_min[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.front_min[2],3).c_str()); f->close_section(); // min f->open_object_section("max"); - f->dump_int("1min", i.second.front_max[0]); - f->dump_int("5min", i.second.front_max[1]); - f->dump_int("15min", i.second.front_max[2]); + f->dump_format_unquoted("1min", "%s", fixed_u_to_string(i.second.front_max[0],3).c_str()); + f->dump_format_unquoted("5min", "%s", fixed_u_to_string(i.second.front_max[1],3).c_str()); + f->dump_format_unquoted("15min", "%s", fixed_u_to_string(i.second.front_max[2],3).c_str()); f->close_section(); // max - f->dump_int("last", i.second.front_last); + f->dump_format_unquoted("last", "%s", fixed_u_to_string(i.second.front_last,3).c_str()); f->close_section(); // interface } f->close_section(); // interfaces