When an app is killed and re-launched,the CPU times are reset, the difference is negative, so checked for non-negative differences
Change-Id: Ib1611fcb5ea05295990bd3f127a24abf7a2df5c4
Signed-off-by: Kunal <kunal.chawla@samsung.com>
prevUtime = (lastAppCpuUsage->second).utime;
prevStime = (lastAppCpuUsage->second).stime;
+ // If the app is killed and launched again
+ if (prevStime > stime || prevUtime > utime) {
+ prevUtime = 0;
+ prevStime = 0;
+ prevTimestamp = lastTime;
+ }
+
Json row;
row.set(NULL, BATTERY_APP_ID, appId);
row.set(NULL, BATTERY_START_TIME, prevTimestamp);