Add support to show only top N process
Compare changes
+ 79
− 42
@@ -46,6 +46,7 @@ typedef struct process_ctx {
@@ -46,6 +46,7 @@ typedef struct process_ctx {
@@ -204,44 +205,83 @@ static void procps_get_cmdline(char *buf, int bufsz, const char *pid, const char
@@ -204,44 +205,83 @@ static void procps_get_cmdline(char *buf, int bufsz, const char *pid, const char
@@ -262,10 +302,12 @@ static void init_process_list(void)
@@ -262,10 +302,12 @@ static void init_process_list(void)
snprintf(cputime, sizeof(cputime), "%lu", ((stime / sysconf(_SC_CLK_TCK)) + (utime / sysconf(_SC_CLK_TCK))) * 1000);
@@ -274,20 +316,25 @@ static void init_process_list(void)
@@ -274,20 +316,25 @@ static void init_process_list(void)
@@ -302,6 +349,15 @@ static void free_process_list(void)
@@ -302,6 +349,15 @@ static void free_process_list(void)
@@ -322,29 +378,9 @@ static void run_refresh_process_list(void)
@@ -322,29 +378,9 @@ static void run_refresh_process_list(void)
int res = bbfdm_ubus_invoke_async(g_process_ctx.ubus_ctx, "tr069", "status", bb.head, NULL, ubus_call_complete_cb);
@@ -545,6 +581,7 @@ static void free_global_cpu_info(void)
@@ -545,6 +581,7 @@ static void free_global_cpu_info(void)