Use monotonic time 95/220595/2
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 19 Dec 2019 23:52:38 +0000 (08:52 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Fri, 20 Dec 2019 01:59:56 +0000 (10:59 +0900)
To measure launching time properly, we should use monotonic time.

Requires:
 - https://review.tizen.org/gerrit/#/c/platform/core/appfw/aul-1/+/220595/
 - https://review.tizen.org/gerrit/#/c/platform/core/appfw/amd/+/220598/
 - https://review.tizen.org/gerrit/#/c/platform/core/appfw/launchpad/+/220600/

Change-Id: Ib4dcb78240a1f7d29001a673ca5e6d2074c02b92
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/launch.c

index 98fe395..355debf 100755 (executable)
@@ -178,11 +178,11 @@ static void __clear_internal_key(bundle *kb)
 
 static inline void __set_stime(bundle *kb)
 {
-       struct timeval tv;
+       struct timespec start;
        char tmp[MAX_LOCAL_BUFSZ];
 
-       gettimeofday(&tv, NULL);
-       snprintf(tmp, MAX_LOCAL_BUFSZ, "%ld/%ld", tv.tv_sec, tv.tv_usec);
+       clock_gettime(CLOCK_MONOTONIC, &start);
+       snprintf(tmp, sizeof(tmp), "%ld/%ld", start.tv_sec, start.tv_nsec);
        bundle_del(kb, AUL_K_STARTTIME);
        bundle_add(kb, AUL_K_STARTTIME, tmp);
 }