]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr: add "total" perf counter types
authorMykola Golub <mgolub@suse.com>
Thu, 22 Nov 2018 11:11:28 +0000 (13:11 +0200)
committerMykola Golub <mgolub@suse.com>
Mon, 3 Dec 2018 16:12:12 +0000 (18:12 +0200)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/mgr/BaseMgrModule.cc
src/mgr/OSDPerfMetricTypes.cc
src/mgr/OSDPerfMetricTypes.h
src/osd/DynamicPerfStats.h
src/pybind/mgr/mgr_module.py

index 03103ba1b3d4022f657096e6be43697c18e2d65e..5c08bb88abc95b6ebaea8a00a7dc21514d502e40 100644 (file)
@@ -689,10 +689,13 @@ ceph_add_osd_perf_query(BaseMgrModule *self, PyObject *args)
     {"object_name", OSDPerfMetricSubKeyType::OBJECT_NAME},
   };
   static const std::map<std::string, PerformanceCounterType> counter_types = {
+    {"ops", PerformanceCounterType::OPS},
     {"write_ops", PerformanceCounterType::WRITE_OPS},
     {"read_ops", PerformanceCounterType::READ_OPS},
+    {"bytes", PerformanceCounterType::BYTES},
     {"write_bytes", PerformanceCounterType::WRITE_BYTES},
     {"read_bytes", PerformanceCounterType::READ_BYTES},
+    {"latency", PerformanceCounterType::LATENCY},
     {"write_latency", PerformanceCounterType::WRITE_LATENCY},
     {"read_latency", PerformanceCounterType::READ_LATENCY},
   };
index 266fc403cc5edc5b643e7f9f6a856776534bf6e8..181a1f38c7c596619c5c82f9d6bd058a93f0ba70 100644 (file)
@@ -28,11 +28,14 @@ void PerformanceCounterDescriptor::pack_counter(const PerformanceCounter &c,
   using ceph::encode;
   encode(c.first, *bl);
   switch(type) {
+  case PerformanceCounterType::OPS:
   case PerformanceCounterType::WRITE_OPS:
   case PerformanceCounterType::READ_OPS:
     break;
+  case PerformanceCounterType::BYTES:
   case PerformanceCounterType::WRITE_BYTES:
   case PerformanceCounterType::READ_BYTES:
+  case PerformanceCounterType::LATENCY:
   case PerformanceCounterType::WRITE_LATENCY:
   case PerformanceCounterType::READ_LATENCY:
     encode(c.second, *bl);
@@ -47,11 +50,14 @@ void PerformanceCounterDescriptor::unpack_counter(
   using ceph::decode;
   decode(c->first, bl);
   switch(type) {
+  case PerformanceCounterType::OPS:
   case PerformanceCounterType::WRITE_OPS:
   case PerformanceCounterType::READ_OPS:
     break;
+  case PerformanceCounterType::BYTES:
   case PerformanceCounterType::WRITE_BYTES:
   case PerformanceCounterType::READ_BYTES:
+  case PerformanceCounterType::LATENCY:
   case PerformanceCounterType::WRITE_LATENCY:
   case PerformanceCounterType::READ_LATENCY:
     decode(c->second, bl);
@@ -64,14 +70,20 @@ void PerformanceCounterDescriptor::unpack_counter(
 std::ostream& operator<<(std::ostream& os,
                          const PerformanceCounterDescriptor &d) {
   switch(d.type) {
+  case PerformanceCounterType::OPS:
+    return os << "ops";
   case PerformanceCounterType::WRITE_OPS:
     return os << "write ops";
   case PerformanceCounterType::READ_OPS:
     return os << "read ops";
+  case PerformanceCounterType::BYTES:
+    return os << "bytes";
   case PerformanceCounterType::WRITE_BYTES:
     return os << "write bytes";
   case PerformanceCounterType::READ_BYTES:
     return os << "read bytes";
+  case PerformanceCounterType::LATENCY:
+    return os << "latency";
   case PerformanceCounterType::WRITE_LATENCY:
     return os << "write latency";
   case PerformanceCounterType::READ_LATENCY:
index c3d281e235a368e220e3d971693bf87ab0325084..c1777af0fa4c4d93435876577e1ceea84343b24d 100644 (file)
@@ -116,12 +116,15 @@ typedef std::pair<uint64_t,uint64_t> PerformanceCounter;
 typedef std::vector<PerformanceCounter> PerformanceCounters;
 
 enum class PerformanceCounterType : uint8_t {
-  WRITE_OPS = 0,
-  READ_OPS = 1,
-  WRITE_BYTES = 2,
-  READ_BYTES = 3,
-  WRITE_LATENCY = 4,
-  READ_LATENCY = 5,
+  OPS = 0,
+  WRITE_OPS = 1,
+  READ_OPS = 2,
+  BYTES = 3,
+  WRITE_BYTES = 4,
+  READ_BYTES = 5,
+  LATENCY = 6,
+  WRITE_LATENCY = 7,
+  READ_LATENCY = 8,
 };
 
 struct PerformanceCounterDescriptor {
@@ -129,10 +132,13 @@ struct PerformanceCounterDescriptor {
 
   bool is_supported() const {
     switch (type) {
+    case PerformanceCounterType::OPS:
     case PerformanceCounterType::WRITE_OPS:
     case PerformanceCounterType::READ_OPS:
+    case PerformanceCounterType::BYTES:
     case PerformanceCounterType::WRITE_BYTES:
     case PerformanceCounterType::READ_BYTES:
+    case PerformanceCounterType::LATENCY:
     case PerformanceCounterType::WRITE_LATENCY:
     case PerformanceCounterType::READ_LATENCY:
       return true;
index dddfb69ee87cbe446675ee1f7a872590604e8510..049451575c29d8f7c766137e65d66396ee65db3f 100644 (file)
@@ -61,6 +61,9 @@ public:
           ceph_assert(d.is_supported());
 
           switch(d.type) {
+          case PerformanceCounterType::OPS:
+            c->first++;
+            return;
           case PerformanceCounterType::WRITE_OPS:
             if (op.may_write() || op.may_cache()) {
               c->first++;
@@ -71,6 +74,10 @@ public:
               c->first++;
             }
             return;
+          case PerformanceCounterType::BYTES:
+            c->first += inb + outb;
+            c->second++;
+            return;
           case PerformanceCounterType::WRITE_BYTES:
             if (op.may_write() || op.may_cache()) {
               c->first += inb;
@@ -83,6 +90,10 @@ public:
               c->second++;
             }
             return;
+          case PerformanceCounterType::LATENCY:
+            c->first += latency.to_nsec();
+            c->second++;
+            return;
           case PerformanceCounterType::WRITE_LATENCY:
             if (op.may_write() || op.may_cache()) {
               c->first += latency.to_nsec();
index fbdd3f1f420743157a8935a690546ff9f8d39c00..ccf763c776ed1259ffbfb700c87a66ab22b9e28a 100644 (file)
@@ -971,8 +971,8 @@ class MgrModule(ceph_module.BaseMgrModule):
 
         Valid subkey types: 'client_id', 'pool_id', 'object_name'
         Valid performance counter types:
-           'write_ops', 'read_ops', 'write_bytes', 'read_bytes',
-           'write_latency', 'read_latency'
+           'ops', 'write_ops', 'read_ops', 'bytes', 'write_bytes', 'read_bytes',
+           'latency', 'write_latency', 'read_latency'
 
         :param object query: query
         :rtype: int (query id)