diff options
Diffstat (limited to 'src/profiling/memory/heapprofd_producer.cc')
-rw-r--r-- | src/profiling/memory/heapprofd_producer.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/profiling/memory/heapprofd_producer.cc b/src/profiling/memory/heapprofd_producer.cc index 3403d3773..dfc69222c 100644 --- a/src/profiling/memory/heapprofd_producer.cc +++ b/src/profiling/memory/heapprofd_producer.cc @@ -149,6 +149,9 @@ bool HeapprofdConfigToClientConfiguration( cli_config->adaptive_sampling_max_sampling_interval_bytes = heapprofd_config.adaptive_sampling_max_sampling_interval_bytes(); size_t n = 0; + const std::vector<std::string>& exclude_heaps = heapprofd_config.exclude_heaps(); + // heaps[i] and heaps_interval[i] represent that the heap named in heaps[i] + // should be sampled with sampling interval of heap_interval[i]. std::vector<std::string> heaps = heapprofd_config.heaps(); std::vector<uint64_t> heap_intervals = heapprofd_config.heap_sampling_intervals(); @@ -169,6 +172,15 @@ bool HeapprofdConfigToClientConfiguration( PERFETTO_ELOG("zero sampling interval."); return false; } + if (!exclude_heaps.empty()) { + // For disabled heaps, we add explicit entries but with sampling interval + // 0. The consumer of the sampling intervals in ClientConfiguration, + // GetSamplingInterval in wire_protocol.h, uses 0 to signal a heap is + // disabled, either because it isn't enabled (all_heaps is not set, and the + // heap isn't named), or because we explicitely set it here. + heaps.insert(heaps.end(), exclude_heaps.cbegin(), exclude_heaps.cend()); + heap_intervals.insert(heap_intervals.end(), exclude_heaps.size(), 0u); + } if (heaps.size() > base::ArraySize(cli_config->heaps)) { heaps.resize(base::ArraySize(cli_config->heaps)); PERFETTO_ELOG("Too many heaps requested. Truncating."); |