FileDocCategorySizeDatePackage
SQLiteDebug.javaAPI DocAndroid 5.1 API6007Thu Mar 12 22:22:10 GMT 2015android.database.sqlite

SQLiteDebug

public final class SQLiteDebug extends Object
Provides debugging info about all SQLite databases running in the current process. {@hide}

Fields Summary
public static final boolean
DEBUG_SQL_LOG
Controls the printing of informational SQL log messages. Enable using "adb shell setprop log.tag.SQLiteLog VERBOSE".
public static final boolean
DEBUG_SQL_STATEMENTS
Controls the printing of SQL statements as they are executed. Enable using "adb shell setprop log.tag.SQLiteStatements VERBOSE".
public static final boolean
DEBUG_SQL_TIME
Controls the printing of wall-clock time taken to execute SQL statements as they are executed. Enable using "adb shell setprop log.tag.SQLiteTime VERBOSE".
public static final boolean
DEBUG_LOG_SLOW_QUERIES
True to enable database performance testing instrumentation.
Constructors Summary
private SQLiteDebug()


      
    
Methods Summary
public static voiddump(android.util.Printer printer, java.lang.String[] args)
Dumps detailed information about all databases used by the process.

param
printer The printer for dumping database state.
param
args Command-line arguments supplied to dumpsys dbinfo

        boolean verbose = false;
        for (String arg : args) {
            if (arg.equals("-v")) {
                verbose = true;
            }
        }

        SQLiteDatabase.dumpAll(printer, verbose);
    
public static android.database.sqlite.SQLiteDebug$PagerStatsgetDatabaseInfo()
return all pager and database stats for the current process.

return
{@link PagerStats}

        PagerStats stats = new PagerStats();
        nativeGetPagerStats(stats);
        stats.dbStats = SQLiteDatabase.getDbStats();
        return stats;
    
private static native voidnativeGetPagerStats(android.database.sqlite.SQLiteDebug$PagerStats stats)

public static final booleanshouldLogSlowQuery(long elapsedTimeMillis)
Determines whether a query should be logged. Reads the "db.log.slow_query_threshold" system property, which can be changed by the user at any time. If the value is zero, then all queries will be considered slow. If the value does not exist or is negative, then no queries will be considered slow. This value can be changed dynamically while the system is running. For example, "adb shell setprop db.log.slow_query_threshold 200" will log all queries that take 200ms or longer to run.

hide

        int slowQueryMillis = SystemProperties.getInt("db.log.slow_query_threshold", -1);
        return slowQueryMillis >= 0 && elapsedTimeMillis >= slowQueryMillis;