subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1068605 - /subversion/trunk/subversion/libsvn_subr/sqlite.c
Date Tue, 08 Feb 2011 22:06:56 GMT
Author: brane
Date: Tue Feb  8 22:06:55 2011
New Revision: 1068605

URL: http://svn.apache.org/viewvc?rev=1068605&view=rev
Log:
Add support for profiling sqlite statement execution.

* subversion/libsvn_subr/sqlite.c (sqlite_profiler): New.
* (svn_sqlite__open): If SQLITE3_PROFILE, register sqlite_profiler.

Modified:
    subversion/trunk/subversion/libsvn_subr/sqlite.c

Modified: subversion/trunk/subversion/libsvn_subr/sqlite.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/sqlite.c?rev=1068605&r1=1068604&r2=1068605&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/sqlite.c (original)
+++ subversion/trunk/subversion/libsvn_subr/sqlite.c Tue Feb  8 22:06:55 2011
@@ -63,6 +63,15 @@ sqlite_tracer(void *data, const char *sq
 }
 #endif
 
+#ifdef SQLITE3_PROFILE
+/* An sqlite execution timing callback. */
+static void
+sqlite_profiler(void *data, const char *sql, sqlite3_uint64 duration)
+{
+  /*  sqlite3 *db3 = data; */
+  SVN_DBG(("[%.3f] sql=\"%s\"\n", 1e-9 * duration, sql));
+}
+#endif
 
 struct svn_sqlite__db_t
 {
@@ -917,6 +926,9 @@ svn_sqlite__open(svn_sqlite__db_t **db, 
 #ifdef SQLITE3_DEBUG
   sqlite3_trace((*db)->db3, sqlite_tracer, (*db)->db3);
 #endif
+#ifdef SQLITE3_PROFILE
+  sqlite3_profile((*db)->db3, sqlite_profiler, (*db)->db3);
+#endif
 
   SVN_ERR(exec_sql(*db,
               "PRAGMA case_sensitive_like=1;"



Mime
View raw message