|
9 | 9 | * limitation.
|
10 | 10 | */
|
11 | 11 |
|
| 12 | +#include "model/CResourceMonitor.h" |
12 | 13 | #include <model/CBucketGatherer.h>
|
13 | 14 |
|
14 | 15 | #include <core/CLogger.h>
|
@@ -202,29 +203,29 @@ const std::string CBucketGatherer::EVENTRATE_BUCKET_GATHERER_TAG("a");
|
202 | 203 | const std::string CBucketGatherer::METRIC_BUCKET_GATHERER_TAG("b");
|
203 | 204 |
|
204 | 205 | CBucketGatherer::CBucketGatherer(CDataGatherer& dataGatherer,
|
205 |
| - core_t::TTime startTime, |
206 |
| - std::size_t numberInfluencers) |
207 |
| - : m_DataGatherer(dataGatherer), m_EarliestTime(startTime), m_BucketStart(startTime), |
| 206 | + const SBucketGathererInitData& initData) |
| 207 | + : m_DataGatherer(dataGatherer), m_EarliestTime(initData.s_StartTime), m_BucketStart(initData.s_StartTime), |
208 | 208 | m_PersonAttributeCounts(dataGatherer.params().s_LatencyBuckets,
|
209 | 209 | dataGatherer.params().s_BucketLength,
|
210 |
| - startTime, |
| 210 | + initData.s_StartTime, |
211 | 211 | TSizeSizePrUInt64UMap(1)),
|
212 | 212 | m_PersonAttributeExplicitNulls(dataGatherer.params().s_LatencyBuckets,
|
213 | 213 | dataGatherer.params().s_BucketLength,
|
214 |
| - startTime, |
| 214 | + initData.s_StartTime, |
215 | 215 | TSizeSizePrUSet(1)),
|
216 | 216 | m_InfluencerCounts(dataGatherer.params().s_LatencyBuckets + 3,
|
217 | 217 | dataGatherer.params().s_BucketLength,
|
218 |
| - startTime, |
219 |
| - TSizeSizePrOptionalStrPrUInt64UMapVec(numberInfluencers)) { |
| 218 | + initData.s_StartTime, |
| 219 | + TSizeSizePrOptionalStrPrUInt64UMapVec(initData.s_InfluenceFieldNames.size())), |
| 220 | +m_ResourceMonitor(initData.s_ResourceMonitor){ |
220 | 221 | }
|
221 | 222 |
|
222 | 223 | CBucketGatherer::CBucketGatherer(bool isForPersistence, const CBucketGatherer& other)
|
223 | 224 | : m_DataGatherer(other.m_DataGatherer),
|
224 | 225 | m_EarliestTime(other.m_EarliestTime), m_BucketStart(other.m_BucketStart),
|
225 | 226 | m_PersonAttributeCounts(other.m_PersonAttributeCounts),
|
226 | 227 | m_PersonAttributeExplicitNulls(other.m_PersonAttributeExplicitNulls),
|
227 |
| - m_InfluencerCounts(other.m_InfluencerCounts) { |
| 228 | + m_InfluencerCounts(other.m_InfluencerCounts), m_ResourceMonitor(other.m_ResourceMonitor) { |
228 | 229 | if (!isForPersistence) {
|
229 | 230 | LOG_ABORT(<< "This constructor only creates clones for persistence");
|
230 | 231 | }
|
@@ -293,7 +294,7 @@ bool CBucketGatherer::addEventData(CEventData& data) {
|
293 | 294 | if (influence) {
|
294 | 295 | const std::string& inf = *influence;
|
295 | 296 | canonicalInfluences[i] = inf;
|
296 |
| - if (count > 0) { |
| 297 | + if (count > 0 && m_ResourceMonitor && m_ResourceMonitor->get().areAllocationsAllowed()) { |
297 | 298 | influencerCounts[i]
|
298 | 299 | .emplace(boost::unordered::piecewise_construct,
|
299 | 300 | boost::make_tuple(pidCid, inf),
|
|
0 commit comments