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

Commit fcd51085 authored by Hans Boehm's avatar Hans Boehm
Browse files

Remove more redundant fillInStackTrace calls

Throwable's constructor already calls it, and it is quite expensive.
All removed calls were redundant.

We often see suspension timeouts triggered by stack trace generation.
Much of the cost is in paging in rarely used information, so clearly
redundant calls like these are likely to be less expensive. But they
still seem worth removing.

This continues an exercise started with ag/30132636 .

Note that a few of these don't appear to be on exceptional paths,
and it may be worth removing the exception construction as well.
I leave that to people more familiar with this code.

Bug: 407383437
Test: Treehugger
Flag: EXEMPT bugfix
Change-Id: I46630d4ac860141f1142af509d24ee33568068d8
parent 93e6a145
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1073,7 +1073,7 @@ public final class JobStatus {
        }
        prepared = false;
        if (DEBUG_PREPARE) {
            unpreparedPoint = new Throwable().fillInStackTrace();
            unpreparedPoint = new Throwable();
        }
        if (uriPerms != null) {
            uriPerms.revoke();
+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ public abstract class SQLiteClosable implements Closeable {
        synchronized (this) {
            if (mTrackClosure && (mClosedBy == null)) {
                String name = getClass().getName();
                mClosedBy = new Exception("closed by " + name + ".close()").fillInStackTrace();
                mClosedBy = new Exception("closed by " + name + ".close()");
            }
        }
    }
+0 −2
Original line number Diff line number Diff line
@@ -1571,7 +1571,6 @@ public final class ActiveServices {
            r.startingBgTimeout = SystemClock.uptimeMillis() + mAm.mConstants.BG_START_TIMEOUT;
            if (DEBUG_DELAYED_SERVICE) {
                RuntimeException here = new RuntimeException("here");
                here.fillInStackTrace();
                Slog.v(TAG_SERVICE, "Starting background (first=" + first + "): " + r, here);
            } else if (DEBUG_DELAYED_STARTS) {
                Slog.v(TAG_SERVICE, "Starting background (first=" + first + "): " + r);
@@ -6391,7 +6390,6 @@ public final class ActiveServices {

        if (DEBUG_SERVICE) {
            RuntimeException here = new RuntimeException();
            here.fillInStackTrace();
            Slog.v(TAG_SERVICE, "Bringing down " + r + " " + r.intent, here);
        }
        r.destroyTime = SystemClock.uptimeMillis();
+1 −1
Original line number Diff line number Diff line
@@ -1154,7 +1154,7 @@ public class OomAdjuster {
            final long duration = mInjector.getUptimeMillis() - now;
            if (false) {
                Slog.d(TAG_OOM_ADJ, "Did OOM ADJ in " + duration + "ms",
                        new RuntimeException("here").fillInStackTrace());
                        new RuntimeException("here"));
            } else {
                Slog.d(TAG_OOM_ADJ, "Did OOM ADJ in " + duration + "ms");
            }
+0 −1
Original line number Diff line number Diff line
@@ -625,7 +625,6 @@ public final class DeviceStateManagerService extends SystemService {
        if (Thread.holdsLock(mLock)) {
            Throwable error = new Throwable("Attempting to notify DeviceStatePolicy with service"
                    + " lock held");
            error.fillInStackTrace();
            Slog.w(TAG, error);
        }
        int state;
Loading