comparison data/model/Dense3DModelPeakCache.cpp @ 1340:f5f83fb49852 3.0-integration

More cache hit counts; make debug output from colour 3d plot renderer (even though it is to SVDEBUG) appear only with explicit debug flag
author Chris Cannam
date Thu, 05 Jan 2017 14:30:49 +0000
parents 9884efa1f88a
children 368449629a30
comparison
equal deleted inserted replaced
1339:df59bf0b4236 1340:f5f83fb49852
14 */ 14 */
15 15
16 #include "Dense3DModelPeakCache.h" 16 #include "Dense3DModelPeakCache.h"
17 17
18 #include "base/Profiler.h" 18 #include "base/Profiler.h"
19
20 #include "base/HitCount.h"
19 21
20 Dense3DModelPeakCache::Dense3DModelPeakCache(const DenseThreeDimensionalModel *source, 22 Dense3DModelPeakCache::Dense3DModelPeakCache(const DenseThreeDimensionalModel *source,
21 int columnsPerPeak) : 23 int columnsPerPeak) :
22 m_source(source), 24 m_source(source),
23 m_columnsPerPeak(columnsPerPeak) 25 m_columnsPerPeak(columnsPerPeak)
42 } 44 }
43 45
44 Dense3DModelPeakCache::Column 46 Dense3DModelPeakCache::Column
45 Dense3DModelPeakCache::getColumn(int column) const 47 Dense3DModelPeakCache::getColumn(int column) const
46 { 48 {
47 Profiler profiler("Dense3DModelPeakCache::getColumn");
48 if (!m_source) return Column(); 49 if (!m_source) return Column();
49 if (!haveColumn(column)) fillColumn(column); 50 if (!haveColumn(column)) fillColumn(column);
50 return m_cache->getColumn(column); 51 return m_cache->getColumn(column);
51 } 52 }
52 53
77 } 78 }
78 79
79 bool 80 bool
80 Dense3DModelPeakCache::haveColumn(int column) const 81 Dense3DModelPeakCache::haveColumn(int column) const
81 { 82 {
82 return in_range_for(m_coverage, column) && m_coverage[column]; 83 static HitCount count("Dense3DModelPeakCache");
84 if (in_range_for(m_coverage, column) && m_coverage[column]) {
85 count.hit();
86 return true;
87 } else {
88 count.miss();
89 return false;
90 }
83 } 91 }
84 92
85 void 93 void
86 Dense3DModelPeakCache::fillColumn(int column) const 94 Dense3DModelPeakCache::fillColumn(int column) const
87 { 95 {