process: fixes 42/184342/4
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 17 Jul 2018 09:15:13 +0000 (11:15 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 17 Jul 2018 14:26:57 +0000 (14:26 +0000)
- implement getting appid
- return memory as KiB not bytes

Change-Id: I21e4af8c8627ae52a6be8afb77eb1a03df26166b

src/process.c

index ff788e6..25460bf 100644 (file)
@@ -4,6 +4,7 @@
 #include "process.h"
 #include "err-check.h"
 #include "procfs.h"
+#include "appinfo-provider.h"
 
 int process_get_memory_usage(struct process *proc, int *usage)
 {
@@ -34,7 +35,7 @@ int process_update(struct process *proc)
        ticks = info.stime + info.utime;
        proc->frame_ticks_used = ticks - proc->total_ticks_used;
        proc->total_ticks_used = ticks;
-       proc->memory_used = info.rss * stats_get_page_size();
+       proc->memory_used = info.rss * stats_get_page_size() / 1024;
 
        return 0;
 }
@@ -56,6 +57,7 @@ const char *process_get_appid(struct process *proc)
        ON_NULL_RETURN_VAL(proc, NULL);
 
        if (!proc->appid) {
+               proc->appid = app_info_provider_find_app_id(proc->pid);
        }
        return proc->appid;
 }