From cd8686be822d284e5b2a73229ebfac1c3f0a20c9 Mon Sep 17 00:00:00 2001 From: Kai Elwert Date: Wed, 29 Sep 2010 18:49:10 +0200 Subject: [PATCH] Add DB profiling support --- src/db.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/db.c b/src/db.c index 7695d2bb..95874122 100644 --- a/src/db.c +++ b/src/db.c @@ -3662,6 +3662,16 @@ db_watch_enum_fetchwd(struct watch_enum *we, uint32_t *wd) } +#ifdef DB_PROFILE +static void +db_xprofile(void *notused, const char *pquery, sqlite3_uint64 ptime) +{ + DPRINTF(E_DBG, L_DB, "SQL PROFILE query: %s\n", pquery); + DPRINTF(E_DBG, L_DB, "SQL PROFILE time: %" PRIu64 "\n", (uint64_t)ptime); +} +#endif + + int db_perthread_init(void) { @@ -3711,6 +3721,10 @@ db_perthread_init(void) return -1; } +#ifdef DB_PROFILE + sqlite3_profile(hdl, db_xprofile, NULL); +#endif + return 0; }