diff layer/ScrollableImageCache.cpp @ 1164:f2f43802718b 3.0-integration

More timings and cache hit counts
author Chris Cannam
date Thu, 10 Nov 2016 09:58:28 +0000
parents c53ed1a6fcbd
children a34a2a25907c
line wrap: on
line diff
--- a/layer/ScrollableImageCache.cpp	Tue Nov 08 14:55:53 2016 +0000
+++ b/layer/ScrollableImageCache.cpp	Thu Nov 10 09:58:28 2016 +0000
@@ -14,6 +14,8 @@
 
 #include "ScrollableImageCache.h"
 
+#include "base/HitCount.h"
+
 #include <iostream>
 using namespace std;
 
@@ -23,6 +25,8 @@
 ScrollableImageCache::scrollTo(const LayerGeometryProvider *v,
                                sv_frame_t newStartFrame)
 {
+    static HitCount count("ScrollableImageCache: scrolling");
+    
     int dx = (v->getXForFrame(m_startFrame) -
 	      v->getXForFrame(newStartFrame));
     
@@ -33,12 +37,14 @@
 
     if (m_startFrame == newStartFrame) {
 	// haven't moved
+        count.hit();
         return;
     }
 	
     m_startFrame = newStartFrame;
 	
     if (!isValid()) {
+        count.miss();
 	return;
     }
 
@@ -46,14 +52,18 @@
 
     if (dx == 0) {
 	// haven't moved visibly (even though start frame may have changed)
+        count.hit();
 	return;
     }
 
     if (dx <= -w || dx >= w) {
 	// scrolled entirely off
 	invalidate();
+        count.miss();
 	return;
     }
+
+    count.partial();
 	
     // dx is in range, cache is scrollable