nshlib: Support top command

show thread sort by cpuloading:
use `top [-n <num> ][ -d <delay>] [ -p <pidlist>] [ -h ]`

Signed-off-by: anjiahao <anjiahao@xiaomi.com>
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
anjiahao
2024-05-21 21:41:45 +08:00
committed by GUIDINGLI
parent 6951b64038
commit 6979fca4dc
4 changed files with 280 additions and 0 deletions

View File

@@ -595,6 +595,11 @@ static const struct cmdmap_s g_cmdmap[] =
3, CONFIG_NSH_MAXARGUMENTS, "<expression>"),
#endif
#if !defined(CONFIG_NSH_DISABLE_TOP) && defined(NSH_HAVE_CPULOAD)
CMD_MAP("top", cmd_top, 1, 5,
"[ -n <num> ][ -d <delay>] [ -p <pidlist>] [-h]"),
#endif
#ifndef CONFIG_NSH_DISABLE_TIME
CMD_MAP("time", cmd_time, 2, 2, "\"<command>\""),
#endif