Merge "Fix slow query log." into qt-dev
This commit is contained in:
@@ -1105,7 +1105,6 @@ android.database.sqlite.SQLiteDatabase
|
|||||||
android.database.sqlite.SQLiteDatabaseConfiguration
|
android.database.sqlite.SQLiteDatabaseConfiguration
|
||||||
android.database.sqlite.SQLiteDatabaseCorruptException
|
android.database.sqlite.SQLiteDatabaseCorruptException
|
||||||
android.database.sqlite.SQLiteDatabaseLockedException
|
android.database.sqlite.SQLiteDatabaseLockedException
|
||||||
android.database.sqlite.SQLiteDebug$Consts
|
|
||||||
android.database.sqlite.SQLiteDebug$DbStats
|
android.database.sqlite.SQLiteDebug$DbStats
|
||||||
android.database.sqlite.SQLiteDebug$PagerStats
|
android.database.sqlite.SQLiteDebug$PagerStats
|
||||||
android.database.sqlite.SQLiteDebug
|
android.database.sqlite.SQLiteDebug
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ package android.database.sqlite;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.CursorWindow;
|
import android.database.CursorWindow;
|
||||||
import android.database.DatabaseUtils;
|
import android.database.DatabaseUtils;
|
||||||
import android.database.sqlite.SQLiteDebug.Consts;
|
|
||||||
import android.database.sqlite.SQLiteDebug.DbStats;
|
import android.database.sqlite.SQLiteDebug.DbStats;
|
||||||
|
import android.database.sqlite.SQLiteDebug.NoPreloadHolder;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.os.OperationCanceledException;
|
import android.os.OperationCanceledException;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
@@ -214,7 +214,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen
|
|||||||
try {
|
try {
|
||||||
mConnectionPtr = nativeOpen(mConfiguration.path, mConfiguration.openFlags,
|
mConnectionPtr = nativeOpen(mConfiguration.path, mConfiguration.openFlags,
|
||||||
mConfiguration.label,
|
mConfiguration.label,
|
||||||
SQLiteDebug.Consts.DEBUG_SQL_STATEMENTS, SQLiteDebug.Consts.DEBUG_SQL_TIME,
|
NoPreloadHolder.DEBUG_SQL_STATEMENTS, NoPreloadHolder.DEBUG_SQL_TIME,
|
||||||
mConfiguration.lookasideSlotSize, mConfiguration.lookasideSlotCount);
|
mConfiguration.lookasideSlotSize, mConfiguration.lookasideSlotCount);
|
||||||
} finally {
|
} finally {
|
||||||
mRecentOperations.endOperation(cookie);
|
mRecentOperations.endOperation(cookie);
|
||||||
@@ -1500,7 +1500,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen
|
|||||||
operation.mFinished = true;
|
operation.mFinished = true;
|
||||||
final long execTime = operation.mEndTime - operation.mStartTime;
|
final long execTime = operation.mEndTime - operation.mStartTime;
|
||||||
mPool.onStatementExecuted(execTime);
|
mPool.onStatementExecuted(execTime);
|
||||||
return SQLiteDebug.Consts.DEBUG_LOG_SLOW_QUERIES && SQLiteDebug.shouldLogSlowQuery(
|
return NoPreloadHolder.DEBUG_LOG_SLOW_QUERIES && SQLiteDebug.shouldLogSlowQuery(
|
||||||
execTime);
|
execTime);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -1608,7 +1608,7 @@ public final class SQLiteConnection implements CancellationSignal.OnCancelListen
|
|||||||
if (mSql != null) {
|
if (mSql != null) {
|
||||||
msg.append(", sql=\"").append(trimSqlForDisplay(mSql)).append("\"");
|
msg.append(", sql=\"").append(trimSqlForDisplay(mSql)).append("\"");
|
||||||
}
|
}
|
||||||
final boolean dumpDetails = allowDetailedLog && Consts.DEBUG_LOG_DETAILED
|
final boolean dumpDetails = allowDetailedLog && NoPreloadHolder.DEBUG_LOG_DETAILED
|
||||||
&& mBindArgs != null && mBindArgs.size() != 0;
|
&& mBindArgs != null && mBindArgs.size() != 0;
|
||||||
if (dumpDetails) {
|
if (dumpDetails) {
|
||||||
msg.append(", bindArgs=[");
|
msg.append(", bindArgs=[");
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public final class SQLiteDebug {
|
|||||||
*
|
*
|
||||||
* {@hide}
|
* {@hide}
|
||||||
*/
|
*/
|
||||||
public static final class Consts {
|
public static final class NoPreloadHolder {
|
||||||
/**
|
/**
|
||||||
* Controls the printing of informational SQL log messages.
|
* Controls the printing of informational SQL log messages.
|
||||||
*
|
*
|
||||||
@@ -103,8 +103,9 @@ public final class SQLiteDebug {
|
|||||||
*/
|
*/
|
||||||
public static boolean shouldLogSlowQuery(long elapsedTimeMillis) {
|
public static boolean shouldLogSlowQuery(long elapsedTimeMillis) {
|
||||||
final int slowQueryMillis = Math.min(
|
final int slowQueryMillis = Math.min(
|
||||||
SystemProperties.getInt(Consts.SLOW_QUERY_THRESHOLD_PROP, Integer.MAX_VALUE),
|
SystemProperties.getInt(NoPreloadHolder.SLOW_QUERY_THRESHOLD_PROP,
|
||||||
SystemProperties.getInt(Consts.SLOW_QUERY_THRESHOLD_UID_PROP,
|
Integer.MAX_VALUE),
|
||||||
|
SystemProperties.getInt(NoPreloadHolder.SLOW_QUERY_THRESHOLD_UID_PROP,
|
||||||
Integer.MAX_VALUE));
|
Integer.MAX_VALUE));
|
||||||
return elapsedTimeMillis >= slowQueryMillis;
|
return elapsedTimeMillis >= slowQueryMillis;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user