Skip to content

Commit 2461fef

Browse files
Christopher TateAndroid (Google) Code Review
authored andcommitted
Merge "Disable db_sample logging"
2 parents 0ded8c8 + ad9e8b1 commit 2461fef

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

core/java/android/database/sqlite/SQLiteDatabase.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
*/
6767
public class SQLiteDatabase extends SQLiteClosable {
6868
private static final String TAG = "SQLiteDatabase";
69+
private static final boolean ENABLE_DB_SAMPLE = false; // true to enable stats in event log
6970
private static final int EVENT_DB_OPERATION = 52000;
7071
private static final int EVENT_DB_CORRUPT = 75004;
7172

@@ -440,7 +441,9 @@ private void lock(String sql, boolean forced) {
440441
}
441442
}
442443
if (sql != null) {
443-
logTimeStat(sql, timeStart, GET_LOCK_LOG_PREFIX);
444+
if (ENABLE_DB_SAMPLE) {
445+
logTimeStat(sql, timeStart, GET_LOCK_LOG_PREFIX);
446+
}
444447
}
445448
}
446449
private static class DatabaseReentrantLock extends ReentrantLock {
@@ -726,7 +729,9 @@ public void endTransaction() {
726729
}
727730
}
728731
// log the transaction time to the Eventlog.
729-
logTimeStat(getLastSqlStatement(), mTransStartTime, COMMIT_SQL);
732+
if (ENABLE_DB_SAMPLE) {
733+
logTimeStat(getLastSqlStatement(), mTransStartTime, COMMIT_SQL);
734+
}
730735
} else {
731736
try {
732737
execSQL("ROLLBACK;");
@@ -2036,7 +2041,9 @@ public final String getPath() {
20362041
}
20372042

20382043
/* package */ void logTimeStat(String sql, long beginMillis) {
2039-
logTimeStat(sql, beginMillis, null);
2044+
if (ENABLE_DB_SAMPLE) {
2045+
logTimeStat(sql, beginMillis, null);
2046+
}
20402047
}
20412048

20422049
private void logTimeStat(String sql, long beginMillis, String prefix) {

0 commit comments

Comments
 (0)