diff options
author | Pierre Ossman <ossman@cendio.se> | 2016-11-08 14:57:11 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2016-11-08 16:44:46 +0100 |
commit | 05338bccb76e9019f51d1528631c3eecd36026ae (patch) | |
tree | 615a0ce8467fbc62b584e3d10d28e845da025428 /common/rfb/ComparingUpdateTracker.cxx | |
parent | 76166012098efd3285d90f59c033c232ae146962 (diff) | |
download | tigervnc-05338bccb76e9019f51d1528631c3eecd36026ae.tar.gz tigervnc-05338bccb76e9019f51d1528631c3eecd36026ae.zip |
Log statistics from ComparingUpdateTracker
Diffstat (limited to 'common/rfb/ComparingUpdateTracker.cxx')
-rw-r--r-- | common/rfb/ComparingUpdateTracker.cxx | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/common/rfb/ComparingUpdateTracker.cxx b/common/rfb/ComparingUpdateTracker.cxx index 1d27f3c4..237adc41 100644 --- a/common/rfb/ComparingUpdateTracker.cxx +++ b/common/rfb/ComparingUpdateTracker.cxx @@ -20,12 +20,16 @@ #include <vector> #include <rdr/types.h> #include <rfb/Exception.h> +#include <rfb/LogWriter.h> #include <rfb/ComparingUpdateTracker.h> using namespace rfb; +static LogWriter vlog("ComparingUpdateTracker"); + ComparingUpdateTracker::ComparingUpdateTracker(PixelBuffer* buffer) - : fb(buffer), oldFb(fb->getPF(), 0, 0), firstCompare(true), enabled(true) + : fb(buffer), oldFb(fb->getPF(), 0, 0), firstCompare(true), + enabled(true), totalPixels(0), missedPixels(0) { changed.assign_union(fb->getRect()); } @@ -72,6 +76,13 @@ bool ComparingUpdateTracker::compare() for (i = rects.begin(); i != rects.end(); i++) compareRect(*i, &newChanged); + changed.get_rects(&rects); + for (i = rects.begin(); i != rects.end(); i++) + totalPixels += i->area(); + newChanged.get_rects(&rects); + for (i = rects.begin(); i != rects.end(); i++) + missedPixels += i->area(); + if (changed.equals(newChanged)) return false; @@ -165,3 +176,19 @@ void ComparingUpdateTracker::compareRect(const Rect& r, Region* newChanged) newChanged->assign_union(temp); } } + +void ComparingUpdateTracker::logStats() +{ + double ratio; + char a[1024], b[1024]; + + siPrefix(totalPixels, "pixels", a, sizeof(a)); + siPrefix(missedPixels, "pixels", b, sizeof(b)); + + ratio = (double)totalPixels / missedPixels; + + vlog.info("%s in / %s out", a, b); + vlog.info("(1:%g ratio)", ratio); + + totalPixels = missedPixels = 0; +} |