aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-09-22 11:09:00 +0200
committerPierre Ossman <ossman@cendio.se>2015-09-22 11:09:00 +0200
commite539cb857f36dc0c6ca1f0e4af4d886c93ea1cfe (patch)
tree97aa2e645fef32630d1dfb999e9ffb9ebb7b42bb /common
parenteccaac0742d6e49b446096dd7c1be4580ed02996 (diff)
downloadtigervnc-e539cb857f36dc0c6ca1f0e4af4d886c93ea1cfe.tar.gz
tigervnc-e539cb857f36dc0c6ca1f0e4af4d886c93ea1cfe.zip
Track statistics for CopyRect
Diffstat (limited to 'common')
-rw-r--r--common/rfb/EncodeManager.cxx31
-rw-r--r--common/rfb/EncodeManager.h1
2 files changed, 32 insertions, 0 deletions
diff --git a/common/rfb/EncodeManager.cxx b/common/rfb/EncodeManager.cxx
index 9122cd75..0cd52060 100644
--- a/common/rfb/EncodeManager.cxx
+++ b/common/rfb/EncodeManager.cxx
@@ -135,6 +135,7 @@ EncodeManager::EncodeManager(SConnection* conn_) : conn(conn_)
encoders[encoderZRLE] = new ZRLEEncoder(conn);
updates = 0;
+ memset(&copyStats, 0, sizeof(copyStats));
stats.resize(encoderClassMax);
for (iter = stats.begin();iter != stats.end();++iter) {
StatsVector::value_type::iterator iter2;
@@ -170,6 +171,25 @@ void EncodeManager::logStats()
vlog.info("Framebuffer updates: %u", updates);
+ if (copyStats.rects != 0) {
+ vlog.info(" %s:", "CopyRect");
+
+ rects += copyStats.rects;
+ pixels += copyStats.pixels;
+ bytes += copyStats.bytes;
+ equivalent += copyStats.equivalent;
+
+ ratio = (double)copyStats.equivalent / copyStats.bytes;
+
+ siPrefix(copyStats.rects, "rects", a, sizeof(a));
+ siPrefix(copyStats.pixels, "pixels", b, sizeof(b));
+ vlog.info(" %s: %s, %s", "Copies", a, b);
+ iecPrefix(copyStats.bytes, "B", a, sizeof(a));
+ vlog.info(" %*s %s (1:%g ratio)",
+ (int)strlen("Copies"), "",
+ a, ratio);
+ }
+
for (i = 0;i < stats.size();i++) {
// Did this class do anything at all?
for (j = 0;j < stats[i].size();j++) {
@@ -450,11 +470,22 @@ void EncodeManager::writeCopyRects(const UpdateInfo& ui)
std::vector<Rect> rects;
std::vector<Rect>::const_iterator rect;
+ beforeLength = conn->getOutStream()->length();
+
ui.copied.get_rects(&rects, ui.copy_delta.x <= 0, ui.copy_delta.y <= 0);
for (rect = rects.begin(); rect != rects.end(); ++rect) {
+ int equiv;
+
+ copyStats.rects++;
+ copyStats.pixels += rect->area();
+ equiv = 12 + rect->area() * conn->cp.pf().bpp/8;
+ copyStats.equivalent += equiv;
+
conn->writer()->writeCopyRect(*rect, rect->tl.x - ui.copy_delta.x,
rect->tl.y - ui.copy_delta.y);
}
+
+ copyStats.bytes += conn->getOutStream()->length() - beforeLength;
}
void EncodeManager::writeSolidRects(Region *changed, const PixelBuffer* pb)
diff --git a/common/rfb/EncodeManager.h b/common/rfb/EncodeManager.h
index a3df8f74..79db950c 100644
--- a/common/rfb/EncodeManager.h
+++ b/common/rfb/EncodeManager.h
@@ -112,6 +112,7 @@ namespace rfb {
typedef std::vector< std::vector<struct EncoderStats> > StatsVector;
unsigned updates;
+ EncoderStats copyStats;
StatsVector stats;
int activeType;
int beforeLength;