am 67f17099: Merge "Fix unit issue in Slog.wtf output" into mnc-dev
* commit '67f170993fda3a5b629dc4c55ec52db99176d3df':
Fix unit issue in Slog.wtf output
diff --git a/core/java/com/android/internal/os/KernelUidCpuTimeReader.java b/core/java/com/android/internal/os/KernelUidCpuTimeReader.java
index 62926d1..41efd2c 100644
--- a/core/java/com/android/internal/os/KernelUidCpuTimeReader.java
+++ b/core/java/com/android/internal/os/KernelUidCpuTimeReader.java
@@ -51,7 +51,7 @@
private SparseLongArray mLastUserTimeUs = new SparseLongArray();
private SparseLongArray mLastSystemTimeUs = new SparseLongArray();
- private long mLastTimeRead = 0;
+ private long mLastTimeReadUs = 0;
/**
* Reads the proc file, calling into the callback with a delta of time for each UID.
@@ -60,7 +60,7 @@
* a fresh delta.
*/
public void readDelta(@Nullable Callback callback) {
- long now = SystemClock.elapsedRealtime();
+ long nowUs = SystemClock.elapsedRealtime() * 1000;
try (BufferedReader reader = new BufferedReader(new FileReader(sProcFile))) {
TextUtils.SimpleStringSplitter splitter = new TextUtils.SimpleStringSplitter(' ');
String line;
@@ -79,12 +79,12 @@
userTimeDeltaUs -= mLastUserTimeUs.valueAt(index);
systemTimeDeltaUs -= mLastSystemTimeUs.valueAt(index);
- final long timeDiffMs = (now - mLastTimeRead) * 1000;
+ final long timeDiffUs = nowUs - mLastTimeReadUs;
if (userTimeDeltaUs < 0 || systemTimeDeltaUs < 0 ||
- userTimeDeltaUs > timeDiffMs || systemTimeDeltaUs > timeDiffMs ) {
+ userTimeDeltaUs > timeDiffUs || systemTimeDeltaUs > timeDiffUs) {
StringBuilder sb = new StringBuilder("Malformed cpu data!\n");
sb.append("Time between reads: ");
- TimeUtils.formatDuration(timeDiffMs, sb);
+ TimeUtils.formatDuration(timeDiffUs / 1000, sb);
sb.append("ms\n");
sb.append("Previous times: u=");
TimeUtils.formatDuration(mLastUserTimeUs.valueAt(index) / 1000, sb);
@@ -118,7 +118,7 @@
} catch (IOException e) {
Slog.e(TAG, "Failed to read uid_cputime", e);
}
- mLastTimeRead = now;
+ mLastTimeReadUs = nowUs;
}
/**