summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2007-05-06 21:30:21 +0000
committermental <mental@users.sourceforge.net>2007-05-06 21:30:21 +0000
commitdea80967b5daa96501900df6722454f793325870 (patch)
tree984c11fb3cac096d6751b4fdb7433ce7193a64d0 /src
parentFix native path on <fileset>-included objects (diff)
downloadinkscape-dea80967b5daa96501900df6722454f793325870.tar.gz
inkscape-dea80967b5daa96501900df6722454f793325870.zip
touch up logging infrastructure in preparation for interaction logging
(bzr r2976)
Diffstat (limited to 'src')
-rw-r--r--src/debug/Makefile_insert3
-rw-r--r--src/debug/event.h1
-rw-r--r--src/debug/logger.h75
-rw-r--r--src/debug/timestamp.cpp45
-rw-r--r--src/debug/timestamp.h37
5 files changed, 160 insertions, 1 deletions
diff --git a/src/debug/Makefile_insert b/src/debug/Makefile_insert
index a8bf7761e..6205b5ca9 100644
--- a/src/debug/Makefile_insert
+++ b/src/debug/Makefile_insert
@@ -12,5 +12,6 @@ debug_libinkdebug_a_SOURCES = \
debug/gc-heap.h \
debug/logger.cpp debug/logger.h \
debug/simple-event.h \
- debug/sysv-heap.cpp debug/sysv-heap.h
+ debug/sysv-heap.cpp debug/sysv-heap.h \
+ debug/timestamp.cpp debug/timestamp.h
diff --git a/src/debug/event.h b/src/debug/event.h
index 54ac31476..2d91ea9f5 100644
--- a/src/debug/event.h
+++ b/src/debug/event.h
@@ -31,6 +31,7 @@ public:
REFCOUNT,
EXTENSION,
FINALIZERS,
+ INTERACTION,
OTHER
};
enum { N_CATEGORIES=OTHER+1 };
diff --git a/src/debug/logger.h b/src/debug/logger.h
index 61f9c2764..1513c0ac6 100644
--- a/src/debug/logger.h
+++ b/src/debug/logger.h
@@ -142,6 +142,81 @@ public:
}
}
+ template <typename EventType>
+ inline static void write() {
+ start<EventType>();
+ finish();
+ }
+
+ template <typename EventType, typename A>
+ inline static void write(A const &a) {
+ start<EventType, A>(a);
+ finish();
+ }
+
+ template <typename EventType, typename A, typename B>
+ inline static void write(A const &a, B const &b) {
+ start<EventType, A, B>(a, b);
+ finish();
+ }
+
+ template <typename EventType, typename A, typename B, typename C>
+ inline static void write(A const &a, B const &b, C const &c) {
+ start<EventType, A, B, C>(a, b, c);
+ finish();
+ }
+
+ template <typename EventType, typename A, typename B,
+ typename C, typename D>
+ inline static void write(A const &a, B const &b, C const &c, D const &d) {
+ start<EventType, A, B, C, D>(a, b, c, d);
+ finish();
+ }
+
+ template <typename EventType, typename A, typename B,
+ typename C, typename D,
+ typename E>
+ inline static void write(A const &a, B const &b, C const &c,
+ D const &d, E const &e)
+ {
+ start<EventType, A, B, C, D, E>(a, b, c, d, e);
+ finish();
+ }
+
+ template <typename EventType, typename A, typename B,
+ typename C, typename D,
+ typename E, typename F>
+ inline static void write(A const &a, B const &b, C const &c,
+ D const &d, E const &e, F const &f)
+ {
+ start<EventType, A, B, C, D, E, F>(a, b, c, d, e, f);
+ finish();
+ }
+
+ template <typename EventType, typename A, typename B,
+ typename C, typename D,
+ typename E, typename F,
+ typename G>
+ inline static void write(A const &a, B const &b, C const &c,
+ D const &d, E const &e, F const &f,
+ G const &g)
+ {
+ start<EventType, A, B, C, D, E, F, G>(a, b, c, d, e, f, g);
+ finish();
+ }
+
+ template <typename EventType, typename A, typename B,
+ typename C, typename D,
+ typename E, typename F,
+ typename G, typename H>
+ inline static void write(A const &a, B const &b, C const &c,
+ D const &d, E const &e, F const &f,
+ G const &g, H const &h)
+ {
+ start<EventType, A, B, C, D, E, F, G, H>(a, b, c, d, e, f, g, h);
+ finish();
+ }
+
static void shutdown();
private:
diff --git a/src/debug/timestamp.cpp b/src/debug/timestamp.cpp
new file mode 100644
index 000000000..75447ff35
--- /dev/null
+++ b/src/debug/timestamp.cpp
@@ -0,0 +1,45 @@
+/*
+ * Inkscape::Debug::SimpleEvent - trivial implementation of Debug::Event
+ *
+ * Authors:
+ * MenTaLguY <mental@rydia.net>
+ *
+ * Copyright (C) 2007 MenTaLguY
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+
+#include <glib/gtypes.h>
+#include <glib/gmain.h>
+#include <glibmm/ustring.h>
+#include "debug/simple-event.h"
+
+namespace Inkscape {
+
+namespace Debug {
+
+Util::ptr_shared<char> timestamp() {
+ Util::ptr_shared<char> result;
+ GTimeVal timestamp;
+ g_get_current_time(&timestamp);
+ gchar *value = g_strdup_printf("%d.%d", timestamp.tv_sec, timestamp.tv_usec);
+ result = Util::share_string(value);
+ g_free(value);
+ return result;
+}
+
+}
+
+}
+
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/debug/timestamp.h b/src/debug/timestamp.h
new file mode 100644
index 000000000..31eac35fd
--- /dev/null
+++ b/src/debug/timestamp.h
@@ -0,0 +1,37 @@
+/*
+ * Inkscape::Debug::timestamp - timestamp strings
+ *
+ * Authors:
+ * MenTaLguY <mental@rydia.net>
+ *
+ * Copyright (C) 2007 MenTaLguY
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifndef SEEN_INKSCAPE_DEBUG_TIMESTAMP_H
+#define SEEN_INKSCAPE_DEBUG_TIMESTAMP_H
+
+#include "util/share.h"
+
+namespace Inkscape {
+
+namespace Debug {
+
+Util::ptr_shared<char> timestamp();
+
+}
+
+}
+
+#endif
+/*
+ Local Variables:
+ mode:c++
+ c-file-style:"stroustrup"
+ c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+ indent-tabs-mode:nil
+ fill-column:99
+ End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :