代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/procps-ng 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 6e59f5e746c15df4d4b53f2df85b64aa1f10d0c3 Mon Sep 17 00:00:00 2001
From: xuchunmei <xuchunmei@huawei.com>
Date: Fri, 11 Jan 2019 01:29:55 -0500
Subject: [PATCH] procps-ng: add -M and -N options for top
Signed-off-by: xuchunmei <xuchunmei@huawei.com>
Signed-off-by: zhoujie <zhoujie133@huawei.com>
Signed-off-by: Qiang Wei <qiang.wei@suse.com>
Signed-off-by: liweigang <weigangli99@gmail.com>
---
src/top/top.c | 15 ++++++++++++++-
src/top/top_nls.c | 2 ++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/top/top.c b/src/top/top.c
index 969c553..466341f 100644
--- a/src/top/top.c
+++ b/src/top/top.c
@@ -4243,7 +4243,7 @@ default_or_error:
* overridden -- we'll force some on and negate others in our
* best effort to honor the loser's (oops, user's) wishes... */
static void parse_args (int argc, char **argv) {
- static const char sopts[] = "bcd:E:e:Hhin:Oo:p:SsU:u:Vw::1";
+ static const char sopts[] = "bcd:E:e:Hhin:Oo:p:SsU:u:Vw::1MN:";
static const struct option lopts[] = {
{ "batch-mode", no_argument, NULL, 'b' },
{ "cmdline-toggle", no_argument, NULL, 'c' },
@@ -4264,6 +4264,8 @@ static void parse_args (int argc, char **argv) {
{ "version", no_argument, NULL, 'V' },
{ "width", optional_argument, NULL, 'w' },
{ "single-cpu-toggle", no_argument, NULL, '1' },
+ { "sort-by-mem", no_argument, NULL, 'M' },
+ { "display-task-num", required_argument, NULL, 'N' },
{ NULL, 0, NULL, 0 }
};
float tmp_delay = FLT_MAX;
@@ -4386,6 +4388,17 @@ static void parse_args (int argc, char **argv) {
error_exit(fmtmk(N_fmt(BAD_widtharg_fmt), cp));
Width_mode = (int)tmp;
continue;
+ case 'M':
+ {
+ Curwin->rc.sortindx = EU_MEM;
+ break;
+ }
+ case 'N':
+ {
+ if (sscanf(cp, "%d", &Curwin->rc.maxtasks) != 1 || Curwin->rc.maxtasks < 0)
+ error_exit(fmtmk("bad iterations arg '%s'", cp));
+ continue;
+ }
default:
/* we'll rely on getopt for any error message while
forcing an EXIT_FAILURE with an empty string ... */
diff --git a/src/top/top_nls.c b/src/top/top_nls.c
index d7ab8dc..0201d64 100644
--- a/src/top/top_nls.c
+++ b/src/top/top_nls.c
@@ -431,6 +431,8 @@ static void build_norm_nlstab (void) {
" -u, --filter-only-euser =USER show only processes owned by USER\n"
" -w, --width [=COLUMNS] change print width [,use COLUMNS]\n"
" -1, --single-cpu-toggle reverse last remembered '1' state\n"
+ " -M, --sort-by-mem show tasks by memory usage\n"
+ " -N, --show-task-num show the specified number of tasks\n"
"\n"
" -h, --help display this help text, then exit\n"
" -V, --version output version information & exit\n"
--
2.41.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。