summaryrefslogtreecommitdiffstats
path: root/vncviewer/CConn.cxx
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2017-02-24 12:33:09 +0100
committerPierre Ossman <ossman@cendio.se>2017-02-24 12:34:27 +0100
commit921f6c86ba2a6761ac4f640dd36903dc8bb9eed7 (patch)
tree6d8359699444ae08ffd82a27a387266aed13d76e /vncviewer/CConn.cxx
parent2e7c744426e4dff6c630e973a1464df814f24abe (diff)
downloadtigervnc-921f6c86ba2a6761ac4f640dd36903dc8bb9eed7.tar.gz
tigervnc-921f6c86ba2a6761ac4f640dd36903dc8bb9eed7.zip
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.
Diffstat (limited to 'vncviewer/CConn.cxx')
-rw-r--r--vncviewer/CConn.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index a692732c..addc30df 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -73,7 +73,7 @@ static const PixelFormat mediumColourPF(8, 8, false, true,
CConn::CConn(const char* vncServerName, network::Socket* socket=NULL)
: serverHost(0), serverPort(0), desktop(NULL),
- pendingPFChange(false),
+ frameCount(0), pixelCount(0), pendingPFChange(false),
currentEncoding(encodingTight), lastServerEncoding((unsigned int)-1),
formatChange(false), encodingChange(false),
firstUpdate(true), pendingUpdate(false), continuousUpdates(false),
@@ -223,6 +223,21 @@ const char *CConn::connectionInfo()
return infoText;
}
+unsigned CConn::getFrameCount()
+{
+ return frameCount;
+}
+
+unsigned CConn::getPixelCount()
+{
+ return pixelCount;
+}
+
+unsigned CConn::getPosition()
+{
+ return sock->inStream().pos();
+}
+
// The RFB core is not properly asynchronous, so it calls this callback
// whenever it needs to block to wait for more data. Since FLTK is
// monitoring the socket, we just make sure FLTK gets to run.
@@ -365,6 +380,8 @@ void CConn::framebufferUpdateEnd()
{
CConnection::framebufferUpdateEnd();
+ frameCount++;
+
Fl::remove_timeout(handleUpdateTimeout, this);
desktop->updateWindow();
@@ -441,6 +458,8 @@ void CConn::dataRect(const Rect& r, int encoding)
CConnection::dataRect(r, encoding);
sock->inStream().stopTiming();
+
+ pixelCount += r.area();
}
void CConn::setCursor(int width, int height, const Point& hotspot,