summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 41298d5)
raw | patch | inline | side by side (parent: 41298d5)
author | joncruz <joncruz@users.sourceforge.net> | |
Sun, 27 Jul 2008 06:22:56 +0000 (06:22 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Sun, 27 Jul 2008 06:22:56 +0000 (06:22 +0000) |
src/debug/gdk-event-latency-tracker.cpp | patch | blob | history | |
src/debug/gdk-event-latency-tracker.h | patch | blob | history | |
src/display/sp-canvas.cpp | patch | blob | history |
index 6a8a48eb3c28e3f9ed266477bb6a345d37522d3e..cfd5a9b7133c1657d836cafefc6952abe72401a3 100644 (file)
namespace Debug {
GdkEventLatencyTracker::GdkEventLatencyTracker()
- : start_seconds(0.0), max_latency(0.0), skew(1.0)
+ : start_seconds(0.0), max_latency(0.0), skew(1.0), last_elapsed(0.0), last_seconds(0.0)
{
elapsed.stop();
elapsed.reset();
skew = prefs_get_double_attribute_limited("debug.latency", "skew", 1.0, 0.5, 2.0);
return boost::optional<double>(0.0);
} else {
- double const current_seconds = (elapsed.elapsed() * skew) + start_seconds;
+ last_elapsed = elapsed.elapsed();
+ last_seconds = timestamp_seconds;
+ double const current_seconds = (last_elapsed * skew) + start_seconds;
double delta = current_seconds - timestamp_seconds;
if (delta < 0.0) {
start_seconds += -delta;
}
}
+double GdkEventLatencyTracker::getSkew() {
+ double val = 0.0;
+ if ((last_elapsed > 0.0) && (last_seconds > 0.0)) {
+ val = (last_seconds - start_seconds) / last_elapsed;
+ }
+ return val;
+}
+
GdkEventLatencyTracker &GdkEventLatencyTracker::default_tracker() {
static GdkEventLatencyTracker tracker;
return tracker;
index cb04ee035ebdcd6bef45cdec584569f386c94117..5a05baf480d15bce5e3844f1a5f4199b5d87be4b 100644 (file)
GdkEventLatencyTracker();
boost::optional<double> process(GdkEvent const *e);
double maxLatency() const { return max_latency; }
+ double getSkew();
static GdkEventLatencyTracker &default_tracker();
double start_seconds;
double max_latency;
double skew;
+ double last_elapsed;
+ double last_seconds;
Glib::Timer elapsed;
};
index ba02099690434b84dbc69efbd5fda655617af822..592085bcd9ccb0f69f1eccc8851586c7b32bd135 100644 (file)
GdkEventLatencyTracker &tracker = GdkEventLatencyTracker::default_tracker();
boost::optional<double> latency = tracker.process(event);
if (latency && *latency > 2.0) {
- g_warning("Event latency reached %f sec", *latency);
+ g_warning("Event latency reached %f sec (%1.4f)", *latency, tracker.getSkew());
}
}