aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_db.c
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2010-12-15 12:48:28 -0600
committerPeter Seebach <peter.seebach@windriver.com>2010-12-16 16:35:12 -0600
commit07e3c34553637ed8e62ccc1318c4fe91764a2017 (patch)
tree63c36e8870e10eea04a0d65e9d075f1f6d1c7c19 /pseudo_db.c
parent0eec00c99f7c7e25313caa97937a77383df8b0e8 (diff)
downloadpseudo-07e3c34553637ed8e62ccc1318c4fe91764a2017.tar.gz
pseudo-07e3c34553637ed8e62ccc1318c4fe91764a2017.tar.bz2
pseudo-07e3c34553637ed8e62ccc1318c4fe91764a2017.zip
Add sqlite call profiling
Add sqlite call profiling, this allows us to see the sqlite calls that are being made as the system runs, via the pseudo log. It was noted that by this profiling that a small change to pseudo.c, when a file was found, reduced the sqlite SELECT calls by about 1/3. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'pseudo_db.c')
-rw-r--r--pseudo_db.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/pseudo_db.c b/pseudo_db.c
index 225dd37..5c62598 100644
--- a/pseudo_db.c
+++ b/pseudo_db.c
@@ -30,6 +30,15 @@
#include "pseudo_ipc.h"
#include "pseudo_db.h"
+/* #define NPROFILE */
+
+#ifdef NPROFILE
+void xProfile(void * pArg, const char * pQuery, sqlite3_uint64 pTimeTaken)
+{
+ pseudo_diag("profile: %lld %s\n", pTimeTaken, pQuery);
+}
+#endif
+
struct log_history {
int rc;
unsigned long fields;
@@ -401,6 +410,9 @@ get_db(sqlite3 **db) {
if (db == &file_db) {
dbfile = pseudo_localstatedir_path("files.db");
rc = sqlite3_open(dbfile, db);
+#ifdef NPROFILE
+ sqlite3_profile(*db, xProfile, NULL);
+#endif
free(dbfile);
} else {
dbfile = pseudo_localstatedir_path("logs.db");