]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-top: add read/write average io sizes support 40514/head
authorXiubo Li <xiubli@redhat.com>
Thu, 22 Apr 2021 04:59:02 +0000 (12:59 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 19 Oct 2021 01:15:45 +0000 (09:15 +0800)
Fixes: https://tracker.ceph.com/issues/49811
Signed-off-by: Xiubo Li <xiubli@redhat.com>
doc/man/8/cephfs-top.rst
src/tools/cephfs/top/cephfs-top

index 936e02e201a27c39bf17bbe27e85a96529024177..654633c7568038565dd750694cb33acf4409cfeb 100644 (file)
@@ -79,6 +79,14 @@ Descriptions of fields
 
    total size of write IOs
 
+.. describe:: raio
+
+   average size of read IOs
+
+.. describe:: waio
+
+   average size of write IOs
+
 .. describe:: rsp
 
    speed of read IOs compared with the last refresh
index 73bb411b7bed586771d75979a6aa6dcb3cd216d3..7ca3d284199bf6da50945aeafa833d221ae5434e 100755 (executable)
@@ -103,6 +103,13 @@ def calc_size(c):
     return round(c[1] / (1024 * 1024), 2)
 
 
+# in MB
+def calc_avg_size(c):
+    if c[0] == 0:
+        return 0.0
+    return round(c[1] / (c[0] * 1024 * 1024), 2)
+
+
 # in MB/s
 def calc_speed(size, duration):
     if duration == 0:
@@ -236,6 +243,15 @@ class FSTop(object):
             # return empty string for none type
             return ''
 
+    def avg_items(self, item):
+        if item == "READ_IO_SIZES":
+            return "raio"
+        if item == "WRITE_IO_SIZES":
+            return "waio"
+        else:
+            # return empty string for none type
+            return ''
+
     def speed_items(self, item):
         if item == "READ_IO_SIZES":
             return "rsp"
@@ -274,6 +290,17 @@ class FSTop(object):
             xp += nlen
 
             if item == "READ_IO_SIZES" or item == "WRITE_IO_SIZES":
+                # average io sizes
+                it = f'{self.avg_items(item)}{self.mtype(typ)}'
+                heading.append(it)
+                nlen = len(it) + len(ITEMS_PAD)
+                if item == "READ_IO_SIZES":
+                    x_coord_map["READ_IO_AVG"] = (xp, nlen)
+                if item == "WRITE_IO_SIZES":
+                    x_coord_map["WRITE_IO_AVG"] = (xp, nlen)
+                xp += nlen
+
+                # io speeds
                 it = f'{self.speed_items(item)}{self.speed_mtype(typ)}'
                 heading.append(it)
                 nlen = len(it) + len(ITEMS_PAD)
@@ -354,6 +381,23 @@ class FSTop(object):
                     self.mainw.addnstr(y_coord, coord[0], f'{calc_lat(m)}', hlen)
                 elif typ == MetricType.METRIC_TYPE_SIZE:
                     self.mainw.addnstr(y_coord, coord[0], f'{calc_size(m)}', hlen)
+
+                    # average io sizes
+                    if remaining_hlen == 0:
+                        return
+                    if key == "READ_IO_SIZES":
+                        coord = x_coord_map["READ_IO_AVG"]
+                    elif key == "WRITE_IO_SIZES":
+                        coord = x_coord_map["WRITE_IO_AVG"]
+                    hlen = coord[1] - len(ITEMS_PAD)
+                    hlen = min(hlen, remaining_hlen)
+                    if remaining_hlen < coord[1]:
+                        remaining_hlen = 0
+                    else:
+                        remaining_hlen -= coord[1]
+                    self.mainw.addnstr(y_coord, coord[0], f'{calc_avg_size(m)}', hlen)
+
+                    # io speeds
                     if remaining_hlen == 0:
                         return
                     if key == "READ_IO_SIZES":