Small. Fast. Reliable.
Choose any three.

SQLite C Interface

Tracing And Profiling Functions

void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*);
void *sqlite3_profile(sqlite3*,
   void(*xProfile)(void*,const char*,sqlite3_uint64), void*);

These routines register callback functions that can be used for tracing and profiling the execution of SQL statements.

The callback function registered by sqlite3_trace() is invoked at the first sqlite3_step() for the evaluation of an SQL statement. Only a single trace callback can be registered at a time. Each call to sqlite3_trace() overrides the previous. A NULL callback for sqlite3_trace() disables tracing. The first argument to the trace callback is a copy of the pointer which was the 3rd argument to sqlite3_trace. The second argument to the trace callback is a zero-terminated UTF8 string containing the original text of the SQL statement as it was passed into sqlite3_prepare_v2() or the equivalent. Note that the host parameter are not expanded in the SQL statement text.

The callback function registered by sqlite3_profile() is invoked as each SQL statement finishes. The first parameter to the profile callback is a copy of the 3rd parameter to sqlite3_profile(). The second parameter to the profile callback is a zero-terminated UTF-8 string that contains the complete text of the SQL statement as it was processed by sqlite3_prepare_v2() or the equivalent. The third parameter to the profile callback is an estimate of the number of nanoseconds of wall-clock time required to run the SQL statement from start to finish.

The sqlite3_profile() API is currently considered experimental and is subject to change.

See also lists of Objects, Constants, and Functions.


This page last modified 2007/12/14 14:37:57 UTC