summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Christopher Tate <ctate@google.com> 2011-10-05 17:49:26 -0700
committer Christopher Tate <ctate@google.com> 2011-10-05 17:49:26 -0700
commitad9e8b1a87edc8009ff60932a22fead1df944089 (patch)
treeb179cf31e78fbe6236d54d8d08bd60e2d6f24320
parent63d8b0c8b509fb744c034c67027380959279cdc4 (diff)
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
-rw-r--r--core/java/android/database/sqlite/SQLiteDatabase.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 93a6ad3f55c1..d23873d7dc97 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -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,7 +441,9 @@ public class SQLiteDatabase extends SQLiteClosable {
}
}
if (sql != null) {
- logTimeStat(sql, timeStart, GET_LOCK_LOG_PREFIX);
+ if (ENABLE_DB_SAMPLE) {
+ logTimeStat(sql, timeStart, GET_LOCK_LOG_PREFIX);
+ }
}
}
private static class DatabaseReentrantLock extends ReentrantLock {
@@ -726,7 +729,9 @@ public class SQLiteDatabase extends SQLiteClosable {
}
}
// log the transaction time to the Eventlog.
- logTimeStat(getLastSqlStatement(), mTransStartTime, COMMIT_SQL);
+ if (ENABLE_DB_SAMPLE) {
+ logTimeStat(getLastSqlStatement(), mTransStartTime, COMMIT_SQL);
+ }
} else {
try {
execSQL("ROLLBACK;");
@@ -2036,7 +2041,9 @@ public class SQLiteDatabase extends SQLiteClosable {
}
/* package */ void logTimeStat(String sql, long beginMillis) {
- logTimeStat(sql, beginMillis, null);
+ if (ENABLE_DB_SAMPLE) {
+ logTimeStat(sql, beginMillis, null);
+ }
}
private void logTimeStat(String sql, long beginMillis, String prefix) {