|
66 | 66 | */ |
67 | 67 | public class SQLiteDatabase extends SQLiteClosable { |
68 | 68 | private static final String TAG = "SQLiteDatabase"; |
| 69 | + private static final boolean ENABLE_DB_SAMPLE = false; // true to enable stats in event log |
69 | 70 | private static final int EVENT_DB_OPERATION = 52000; |
70 | 71 | private static final int EVENT_DB_CORRUPT = 75004; |
71 | 72 |
|
@@ -440,7 +441,9 @@ private void lock(String sql, boolean forced) { |
440 | 441 | } |
441 | 442 | } |
442 | 443 | 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 | + } |
444 | 447 | } |
445 | 448 | } |
446 | 449 | private static class DatabaseReentrantLock extends ReentrantLock { |
@@ -726,7 +729,9 @@ public void endTransaction() { |
726 | 729 | } |
727 | 730 | } |
728 | 731 | // 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 | + } |
730 | 735 | } else { |
731 | 736 | try { |
732 | 737 | execSQL("ROLLBACK;"); |
@@ -2036,7 +2041,9 @@ public final String getPath() { |
2036 | 2041 | } |
2037 | 2042 |
|
2038 | 2043 | /* package */ void logTimeStat(String sql, long beginMillis) { |
2039 | | - logTimeStat(sql, beginMillis, null); |
| 2044 | + if (ENABLE_DB_SAMPLE) { |
| 2045 | + logTimeStat(sql, beginMillis, null); |
| 2046 | + } |
2040 | 2047 | } |
2041 | 2048 |
|
2042 | 2049 | private void logTimeStat(String sql, long beginMillis, String prefix) { |
|
0 commit comments