Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 298e7d70 authored by Kevin Jeon's avatar Kevin Jeon
Browse files

Update duration calculation in AppProfiler

This change replaces currentThreadTimeMillis() calls in AppProfiler's
collectPssInBackground/collectRssInBackground with uptimeMillis(). This
should be less expensive, while still calculating the same duration.

Test: build, flash, grab bug report and verify that dumpsys procstats
      still contains PSS/RSS duration info
Bug: 296454553
Change-Id: I0c5f59c99e1e0bc71a42c0ea887b1a0a32c5dbd6
parent d0658959
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -711,7 +711,7 @@ public class AppProfiler {
                }
            }
            if (profile != null) {
                long startTime = SystemClock.currentThreadTimeMillis();
                long startTime = SystemClock.uptimeMillis();
                // skip background PSS calculation under the following situations:
                //  - app is capturing camera imagery
                //  - app is frozen and we have already collected PSS once.
@@ -721,7 +721,7 @@ public class AppProfiler {
                        || mService.isCameraActiveForUid(profile.mApp.uid)
                        || mService.mConstants.APP_PROFILER_PSS_PROFILING_DISABLED;
                long pss = skipPSSCollection ? 0 : Debug.getPss(pid, tmp, null);
                long endTime = SystemClock.currentThreadTimeMillis();
                long endTime = SystemClock.uptimeMillis();
                synchronized (mProfilerLock) {
                    if (pss != 0 && profile.getThread() != null
                            && profile.getSetProcState() == procState
@@ -852,7 +852,7 @@ public class AppProfiler {
                }
            }
            if (profile != null) {
                long startTime = SystemClock.currentThreadTimeMillis();
                long startTime = SystemClock.uptimeMillis();
                // skip background RSS calculation under the following situations:
                //  - app is capturing camera imagery
                //  - app is frozen and we have already collected RSS once.
@@ -862,7 +862,7 @@ public class AppProfiler {
                        || mService.isCameraActiveForUid(profile.mApp.uid)
                        || mService.mConstants.APP_PROFILER_PSS_PROFILING_DISABLED;
                long rss = skipRSSCollection ? 0 : Debug.getRss(pid, null);
                long endTime = SystemClock.currentThreadTimeMillis();
                long endTime = SystemClock.uptimeMillis();
                synchronized (mProfilerLock) {
                    if (rss != 0 && profile.getThread() != null
                            && profile.getSetProcState() == procState