Display performance statistics in viewer
Adds an optional graph to the viewer to display current frame rate,
pixel rate and network bandwidth. Makes it easier to debug and test
performance related issues.
diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h
index 11f3dc2..4224699 100644
--- a/vncviewer/DesktopWindow.h
+++ b/vncviewer/DesktopWindow.h
@@ -22,6 +22,8 @@
#include <map>
+#include <sys/time.h>
+
#include <rfb/Rect.h>
#include <rfb/Pixel.h>
@@ -103,6 +105,8 @@
static void handleScroll(Fl_Widget *wnd, void *data);
static void handleEdgeScroll(void *data);
+ static void handleStatsTimeout(void *data);
+
private:
CConn* cc;
Fl_Scrollbar *hscroll, *vscroll;
@@ -115,6 +119,20 @@
bool firstUpdate;
bool delayedFullscreen;
bool delayedDesktopSize;
+
+ struct statsEntry {
+ unsigned fps;
+ unsigned pps;
+ unsigned bps;
+ };
+ struct statsEntry stats[100];
+
+ struct timeval statsLastTime;
+ unsigned statsLastFrame;
+ unsigned statsLastPixels;
+ unsigned statsLastPosition;
+
+ Surface *statsGraph;
};
#endif