Code

instrument event latency
[inkscape.git] / src / debug / gdk-event-latency-tracker.h
1 /*
2  * Inkscape::Debug::GdkEventLatencyTracker - tracks backlog of GDK events
3  *
4  * Authors:
5  *   MenTaLguY <mental@rydia.net>
6  *
7  * Copyright (C) 2008 MenTaLguY
8  *
9  * Released under GNU GPL, read the file 'COPYING' for more information
10  */
12 #ifndef SEEN_INKSCAPE_DEBUG_GDK_EVENT_LATENCY_TRACKER_H
13 #define SEEN_INKSCAPE_DEBUG_GDK_EVENT_LATENCY_TRACKER_H
15 #include <gdk/gdkevents.h>
16 #include <glibmm/timer.h>
17 #include <boost/optional.hpp>
19 namespace Inkscape {
20 namespace Debug {
22 class GdkEventLatencyTracker {
23 public:
24     GdkEventLatencyTracker();
25     boost::optional<double> process(GdkEvent const *e);
26     double maxLatency() const { return max_latency; }
28     static GdkEventLatencyTracker &default_tracker();
30 private:
31     GdkEventLatencyTracker(GdkEventLatencyTracker const &); // no copy
32     void operator=(GdkEventLatencyTracker const &); // no assign
34     double start_seconds;
35     double max_latency;
36     Glib::Timer elapsed;
37 };
39 }
40 }
42 #endif
43 /*
44   Local Variables:
45   mode:c++
46   c-file-style:"stroustrup"
47   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
48   indent-tabs-mode:nil
49   fill-column:99
50   End:
51 */
52 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :