From 8bc5bae751d7a1c70f9fe06aa634da9cf09c0926 Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Thu, 14 Jul 2022 17:19:40 +0530 Subject: [PATCH] cephfs-top: fix the rsp/wsp display Fixes: https://tracker.ceph.com/issues/56537 Signed-off-by: Jos Collin (cherry picked from commit 26c7eb36e2f0c5769f7c9971042e92b25eabc4f2) --- src/tools/cephfs/top/cephfs-top | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index 7c361f1f9fd9..d33e2bd8ec75 100755 --- a/src/tools/cephfs/top/cephfs-top +++ b/src/tools/cephfs/top/cephfs-top @@ -362,7 +362,6 @@ class FSTop(object): return cidx = 0 - client_id = x_coord_map[FS_TOP_MAIN_WINDOW_COL_CLIENT_ID] for item in counters: coord = x_coord_map[item] hlen = coord[1] - len(ITEMS_PAD) @@ -410,18 +409,21 @@ class FSTop(object): remaining_hlen = 0 else: remaining_hlen -= coord[1] + size = 0 if key == "READ_IO_SIZES": - global last_read_size - last_size = last_read_size.get(client_id, 0) - size = m[1] - last_size - last_read_size[client_id] = m[1] + if m[1] > 0: + global last_read_size + last_size = last_read_size.get(client_id, 0) + size = m[1] - last_size + last_read_size[client_id] = m[1] if key == "WRITE_IO_SIZES": - global last_write_size - last_size = last_write_size.get(client_id, 0) - size = m[1] - last_size - last_write_size[client_id] = m[1] + if m[1] > 0: + global last_write_size + last_size = last_write_size.get(client_id, 0) + size = m[1] - last_size + last_write_size[client_id] = m[1] self.mainw.addnstr(y_coord, coord[0], - f'{calc_speed(size, duration)}', + f'{calc_speed(abs(size), duration)}', hlen) else: # display 0th element from metric tuple -- 2.47.3