]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
buffer, osd: add missing crc cache miss perf counter 14957/head
authorPiotr Dałek <piotr.dalek@corp.ovh.com>
Tue, 9 May 2017 07:03:22 +0000 (09:03 +0200)
committerPiotr Dałek <piotr.dalek@corp.ovh.com>
Tue, 9 May 2017 07:03:22 +0000 (09:03 +0200)
This helps tracking if/how effective is the CRC cache in bufferlists.

Signed-off-by: Piotr Dałek <piotr.dalek@corp.ovh.com>
src/common/buffer.cc
src/include/buffer.h
src/osd/OSD.cc
src/osd/OSD.h

index 957f5da8c56812a1f8c7853c10d5d0bd03a93657..bf4b0af25d067e581ecafaa0e74b1cd29d0cb686 100644 (file)
@@ -91,6 +91,7 @@ static std::atomic_flag buffer_debug_lock = ATOMIC_FLAG_INIT;
 
   static atomic_t buffer_cached_crc;
   static atomic_t buffer_cached_crc_adjusted;
+  static atomic_t buffer_missed_crc;
   static bool buffer_track_crc = get_env_bool("CEPH_BUFFER_TRACK");
 
   void buffer::track_cached_crc(bool b) {
@@ -103,6 +104,10 @@ static std::atomic_flag buffer_debug_lock = ATOMIC_FLAG_INIT;
     return buffer_cached_crc_adjusted.read();
   }
 
+  int buffer::get_missed_crc() {
+    return buffer_missed_crc.read();
+  }
+
   static atomic_t buffer_c_str_accesses;
   static bool buffer_track_c_str = get_env_bool("CEPH_BUFFER_TRACK");
 
@@ -2391,6 +2396,8 @@ __u32 buffer::list::crc32c(__u32 crc) const
            buffer_cached_crc_adjusted.inc();
        }
       } else {
+       if (buffer_track_crc)
+         buffer_missed_crc.inc();
        uint32_t base = crc;
        crc = ceph_crc32c(crc, (unsigned char*)it->c_str(), it->length());
        r->set_crc(ofs, make_pair(base, crc));
index 4c807a00995972f46931d444ea3bb75cee8d17d6..d8f8999b6ce93a0e313c6483fb08f9a87ec29817 100644 (file)
@@ -116,6 +116,8 @@ namespace buffer CEPH_BUFFER_API {
   int get_cached_crc();
   /// count of cached crc hits (mismatching input, required adjustment)
   int get_cached_crc_adjusted();
+  /// count of crc cache misses
+  int get_missed_crc();
   /// enable/disable tracking of cached crcs
   void track_cached_crc(bool b);
 
index a3abe6c7bd2b7175e3cde8c20f3bc6d36fbe623b..e6d18ecd2df6702ee997928f8df63ad72a133df5 100644 (file)
@@ -2891,6 +2891,8 @@ void OSD::create_logger()
   osd_plb.add_u64(
     l_osd_cached_crc_adjusted, "cached_crc_adjusted",
     "Total number getting crc from crc_cache with adjusting");
+  osd_plb.add_u64(l_osd_missed_crc, "missed_crc", 
+    "Total number of crc cache misses");
 
   osd_plb.add_u64(l_osd_pg, "numpg", "Placement groups",
                  "pgs", PerfCountersBuilder::PRIO_USEFUL);
@@ -4869,6 +4871,7 @@ void OSD::tick_without_osd_lock()
   logger->set(l_osd_history_alloc_num, buffer::get_history_alloc_num());
   logger->set(l_osd_cached_crc, buffer::get_cached_crc());
   logger->set(l_osd_cached_crc_adjusted, buffer::get_cached_crc_adjusted());
+  logger->set(l_osd_missed_crc, buffer::get_missed_crc());
 
   // osd_lock is not being held, which means the OSD state
   // might change when doing the monitor report
index feb98e798aa8b7050b4e78c9525bfa0e4c9e7413..cad51ed9264357feab9b6804030baa0ea594bb21 100644 (file)
@@ -114,6 +114,7 @@ enum {
   l_osd_history_alloc_num,
   l_osd_cached_crc,
   l_osd_cached_crc_adjusted,
+  l_osd_missed_crc,
 
   l_osd_pg,
   l_osd_pg_primary,