[PATCH 1/2] fix three trivival places
From: Shenghong Han
Date: Sun Jul 24 2022 - 11:26:58 EST
Some dirty work:
1.Rename some Variables.
2.Some if-statement was missed at Commit ebbeae36387c,so make up them.
Signed-off-by: Shenghong Han <hanshenghong2019@xxxxxxxxxxxxxxxx>
Signed-off-by: Jiajian Ye <yejiajian2018@xxxxxxxxxxxxxxxx>
---
tools/vm/page_owner_sort.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/tools/vm/page_owner_sort.c b/tools/vm/page_owner_sort.c
index ec2e67c85..fb103aaf4 100644
--- a/tools/vm/page_owner_sort.c
+++ b/tools/vm/page_owner_sort.c
@@ -63,7 +63,7 @@ enum ALLOCATOR_BIT {
};
enum ARG_TYPE {
ARG_TXT, ARG_COMM, ARG_STACKTRACE, ARG_ALLOC_TS, ARG_FREE_TS,
- ARG_CULL_TIME, ARG_PAGE_NUM, ARG_PID, ARG_TGID, ARG_UNKNOWN, ARG_FREE,
+ ARG_TIMES, ARG_TOTAL_MEM, ARG_PID, ARG_TGID, ARG_UNKNOWN, ARG_FREE,
ARG_ALLOCATOR
};
enum SORT_ORDER {
@@ -402,7 +402,11 @@ static char *get_comm(char *buf)
static int get_arg_type(const char *arg)
{
- if (!strcmp(arg, "pid") || !strcmp(arg, "p"))
+ if (!strcmp(arg, "times") || !strcmp(arg, "t"))
+ return ARG_TIMES;
+ else if (!strcmp(arg, "memory") || !strcmp(arg, "m"))
+ return ARG_TOTAL_MEM;
+ else if (!strcmp(arg, "pid") || !strcmp(arg, "p"))
return ARG_PID;
else if (!strcmp(arg, "tgid") || !strcmp(arg, "tg"))
return ARG_TGID;
@@ -599,7 +603,11 @@ static bool parse_sort_args(const char *arg_str)
int arg_type = get_arg_type(args[i]+offset);
- if (arg_type == ARG_PID)
+ if (arg_type == ARG_TIMES)
+ sc.cmps[i] = compare_num;
+ else if (arg_type == ARG_TOTAL_MEM)
+ sc.cmps[i] = compare_page_num;
+ else if (arg_type == ARG_PID)
sc.cmps[i] = compare_pid;
else if (arg_type == ARG_TGID)
sc.cmps[i] = compare_tgid;
--
2.30.1