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

Commit ad9e8b1a authored by Christopher Tate's avatar Christopher Tate
Browse files

Disable db_sample logging

db_sample logging is thrashing the event log hard, and is currently
neither maintained nor heeded by anybody on the current release.  It
can be re-enabled simply by throwing the appropriate static boolean
to 'true', but for now this should greatly improve the utility of our
event logs.  (We were seeing a rollover period of 20 minutes or less;
ideally we want to see the event log run at least half a day before
rolling.)

Bug 5419627
Bug 5104300

Change-Id: I2125544130aae142974102dbad3b557e49fcd494
parent 63d8b0c8
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ import java.util.regex.Pattern;
 */
public class SQLiteDatabase extends SQLiteClosable {
    private static final String TAG = "SQLiteDatabase";
    private static final boolean ENABLE_DB_SAMPLE = false; // true to enable stats in event log
    private static final int EVENT_DB_OPERATION = 52000;
    private static final int EVENT_DB_CORRUPT = 75004;

@@ -440,9 +441,11 @@ public class SQLiteDatabase extends SQLiteClosable {
            }
        }
        if (sql != null) {
            if (ENABLE_DB_SAMPLE)  {
                logTimeStat(sql, timeStart, GET_LOCK_LOG_PREFIX);
            }
        }
    }
    private static class DatabaseReentrantLock extends ReentrantLock {
        DatabaseReentrantLock(boolean fair) {
            super(fair);
@@ -726,7 +729,9 @@ public class SQLiteDatabase extends SQLiteClosable {
                    }
                }
                // log the transaction time to the Eventlog.
                if (ENABLE_DB_SAMPLE) {
                    logTimeStat(getLastSqlStatement(), mTransStartTime, COMMIT_SQL);
                }
            } else {
                try {
                    execSQL("ROLLBACK;");
@@ -2036,8 +2041,10 @@ public class SQLiteDatabase extends SQLiteClosable {
    }

    /* package */ void logTimeStat(String sql, long beginMillis) {
        if (ENABLE_DB_SAMPLE) {
            logTimeStat(sql, beginMillis, null);
        }
    }

    private void logTimeStat(String sql, long beginMillis, String prefix) {
        // Sample fast queries in proportion to the time taken.