From: Xiubo Li Date: Wed, 31 Mar 2021 14:00:03 +0000 (+0800) Subject: cephfs-top: improve the output X-Git-Tag: v17.1.0~2240^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0b4807aefbb33d1d923422372260e757ec4e617b;p=ceph.git cephfs-top: improve the output When adding more metrics the top line will be too long and maybe wrapped with serval lines, which will make it hard to read. Signed-off-by: Xiubo Li --- diff --git a/doc/man/8/cephfs-top.rst b/doc/man/8/cephfs-top.rst index 2ff8f7c5cac5..bad687f9aa61 100644 --- a/doc/man/8/cephfs-top.rst +++ b/doc/man/8/cephfs-top.rst @@ -36,6 +36,42 @@ Options Perform a selftest. This mode performs a sanity check of ``stats`` module. +Descriptions of fields +====================== + +.. describe:: chit + + cap hit rate + +.. describe:: rlat + + read latency + +.. describe:: wlat + + write latency + +.. describe:: mlat + + metadata latency + +.. describe:: dlease + + dentry lease rate + +.. describe:: ofiles + + number of opened files + +.. describe:: oicaps + + number of pinned caps + +.. describe:: oinodes + + number of opened inodes + + Availability ============ diff --git a/src/tools/cephfs/top/cephfs-top b/src/tools/cephfs/top/cephfs-top index 26987a474e81..4a8faf8a36a6 100755 --- a/src/tools/cephfs/top/cephfs-top +++ b/src/tools/cephfs/top/cephfs-top @@ -36,15 +36,15 @@ FS_TOP_PROG_STR = 'cephfs-top' FS_TOP_SUPPORTED_VER = 1 ITEMS_PAD_LEN = 1 -ITEMS_PAD = " " * ITEMS_PAD_LEN +ITEMS_PAD = " " * ITEMS_PAD_LEN DEFAULT_REFRESH_INTERVAL = 1 # min refresh interval allowed MIN_REFRESH_INTERVAL = 0.5 # metadata provided by mgr/stats -FS_TOP_MAIN_WINDOW_COL_CLIENT_ID = "CLIENT_ID" -FS_TOP_MAIN_WINDOW_COL_MNT_ROOT = "MOUNT_ROOT" -FS_TOP_MAIN_WINDOW_COL_MNTPT_HOST_ADDR = "MOUNT_POINT@HOST/ADDR" +FS_TOP_MAIN_WINDOW_COL_CLIENT_ID = "client_id" +FS_TOP_MAIN_WINDOW_COL_MNT_ROOT = "mount_root" +FS_TOP_MAIN_WINDOW_COL_MNTPT_HOST_ADDR = "mount_point@host/addr" MAIN_WINDOW_TOP_LINE_ITEMS_START = [ITEMS_PAD, FS_TOP_MAIN_WINDOW_COL_CLIENT_ID, @@ -179,6 +179,27 @@ class FSTop(object): raise FSTopException(f'error in \'perf stats\' query: {out}') return json.loads(buf.decode('utf-8')) + def items(self, item): + if item == "CAP_HIT": + return "chit" + if item == "READ_LATENCY": + return "rlat" + if item == "WRITE_LATENCY": + return "wlat" + if item == "METADATA_LATENCY": + return "mlat" + if item == "DENTRY_LEASE": + return "dlease" + if item == "OPENED_FILES": + return "ofiles" + if item == "PINNED_ICAPS": + return "oicaps" + if item == "OPENED_INODES": + return "oinodes" + else: + # return empty string for none type + return '' + def mtype(self, typ): if typ == MetricType.METRIC_TYPE_PERCENTAGE: return "(%)" @@ -200,7 +221,7 @@ class FSTop(object): xp += nlen for item, typ in MAIN_WINDOW_TOP_LINE_METRICS.items(): - it = f'{item}{self.mtype(typ)}' + it = f'{self.items(item)}{self.mtype(typ)}' heading.append(it) nlen = len(it) + len(ITEMS_PAD) x_coord_map[item] = (xp, nlen)