[evolution-data-server/evolution-data-server-3-12] Bug 736116 - Add EBSQL_DEBUG=timing
- From: David Woodhouse <dwmw2 src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/evolution-data-server-3-12] Bug 736116 - Add EBSQL_DEBUG=timing
- Date: Thu, 11 Sep 2014 20:33:54 +0000 (UTC)
commit 874696855adfe44e7df8bbecc9b7584130019cc2
Author: David Woodhouse <David Woodhouse intel com>
Date: Mon Sep 8 14:56:20 2014 +0100
Bug 736116 - Add EBSQL_DEBUG=timing
(cherry picked from commit 67f707e9b61b460f223795b8e7505ee6da617067)
addressbook/libedata-book/e-book-sqlite.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/addressbook/libedata-book/e-book-sqlite.c b/addressbook/libedata-book/e-book-sqlite.c
index 9131c09..87b1c80 100644
--- a/addressbook/libedata-book/e-book-sqlite.c
+++ b/addressbook/libedata-book/e-book-sqlite.c
@@ -88,6 +88,7 @@ typedef enum {
EBSQL_DEBUG_REF_COUNTS = 1 << 9, /* Print about shared EBookSqlite instances, print when
finalized */
EBSQL_DEBUG_CANCEL = 1 << 10, /* Print information about GCancellable cancellations */
EBSQL_DEBUG_PREFLIGHT = 1 << 11, /* Print information about query preflighting */
+ EBSQL_DEBUG_TIMING = 1 << 12, /* Print information about timing */
} EbSqlDebugFlag;
static const GDebugKey ebsql_debug_keys[] = {
@@ -103,6 +104,7 @@ static const GDebugKey ebsql_debug_keys[] = {
{ "ref-counts", EBSQL_DEBUG_REF_COUNTS },
{ "cancel", EBSQL_DEBUG_CANCEL },
{ "preflight", EBSQL_DEBUG_PREFLIGHT },
+ { "timing", EBSQL_DEBUG_TIMING },
};
static EbSqlDebugFlag ebsql_debug_flags = 0;
@@ -1081,6 +1083,7 @@ ebsql_exec (EBookSqlite *ebsql,
gboolean had_cancel;
gchar *errmsg = NULL;
gint ret = -1;
+ gint64 t1 = 0, t2;
/* Debug output for statements and query plans */
ebsql_exec_maybe_debug (ebsql, stmt);
@@ -1096,6 +1099,10 @@ ebsql_exec (EBookSqlite *ebsql,
had_cancel = FALSE;
}
+ if ((ebsql_debug_flags & EBSQL_DEBUG_TIMING) != 0 &&
+ strncmp (stmt, "EXPLAIN QUERY PLAN ", 19) != 0)
+ t1 = g_get_monotonic_time();
+
ret = sqlite3_exec (ebsql->priv->db, stmt, callback, data, &errmsg);
while (ret == SQLITE_BUSY || ret == SQLITE_LOCKED || ret == -1) {
@@ -1104,12 +1111,20 @@ ebsql_exec (EBookSqlite *ebsql,
errmsg = NULL;
}
g_thread_yield ();
+
+ if (t1)
+ t1 = g_get_monotonic_time();
+
ret = sqlite3_exec (ebsql->priv->db, stmt, callback, data, &errmsg);
}
if (!had_cancel)
ebsql->priv->cancel = NULL;
+ if (t1) {
+ t2 = g_get_monotonic_time();
+ g_printerr ("TIME: %" G_GINT64_FORMAT " ms\n", (t2 - t1) / 1000);
+ }
if (ret != SQLITE_OK) {
EBSQL_SET_ERROR_FROM_SQLITE (error, ret, errmsg);
sqlite3_free (errmsg);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]