Skip to content

Commit 69731f0

Browse files
committed
nvme: add support for nvme top
This is to monitor the system changes. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent a0bc6b8 commit 69731f0

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

nvme-builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ COMMAND_LIST(
124124
ENTRY("io-mgmt-send", "I/O Management Send", io_mgmt_send)
125125
ENTRY("nvme-mi-recv", "Submit a NVMe-MI Receive command, return results", nmi_recv)
126126
ENTRY("nvme-mi-send", "Submit a NVMe-MI Send command, return results", nmi_send)
127+
ENTRY("top", "Monitor the topology", top)
127128
);
128129

129130
#endif

nvme.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10957,6 +10957,29 @@ static int get_pull_model_ddc_req_log(int argc, char **argv, struct command *acm
1095710957
return err;
1095810958
}
1095910959

10960+
static int top(int argc, char **argv, struct command *acmd,
10961+
struct plugin *plugin)
10962+
{
10963+
struct timespec ts = {
10964+
.tv_sec = 3,
10965+
};
10966+
int err;
10967+
10968+
while (true) {
10969+
err = system("clear");
10970+
if (err)
10971+
break;
10972+
err = show_topology_cmd(argc, argv, acmd, plugin);
10973+
if (err)
10974+
break;
10975+
err = pselect(0, NULL, NULL, NULL, &ts, NULL);
10976+
if (err < 0)
10977+
break;
10978+
}
10979+
10980+
return err;
10981+
}
10982+
1096010983
void register_extension(struct plugin *plugin)
1096110984
{
1096210985
plugin->parent = &nvme;

0 commit comments

Comments
 (0)