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

Commit ee013b9b authored by Andy Kittner's avatar Andy Kittner
Browse files

Avoid divide-by-zero exception when printing process state

Change-Id: Ifa1c64ff6917c3a6f7d72a92862b48eec2540afd
parent 843609a7
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -699,7 +699,9 @@ public class ProcessStats {

        long sampleTime = mCurrentSampleTime - mLastSampleTime;
        long sampleRealTime = mCurrentSampleRealTime - mLastSampleRealTime;
        long percAwake = (sampleTime*100) / sampleRealTime;
        long percAwake = ((sampleRealTime > 0)
            ? (sampleTime*100) / sampleRealTime
            : 100);
        if (percAwake != 100) {
            pw.print(" with ");
            pw.print(percAwake);