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

Commit 2461fef4 authored by Christopher Tate's avatar Christopher Tate Committed by Android (Google) Code Review
Browse files

Merge "Disable db_sample logging"

parents 0ded8c8a ad9e8b1a
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.