diff options
author | TreeHugger Robot <treehugger-gerrit@google.com> | 2019-03-11 15:20:29 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2019-03-11 15:20:29 +0000 |
commit | 0e8ebbd4f3c26df840369ed29c78f3103723cbb9 (patch) | |
tree | f70d8a527c021ceccfaa4f7abf07c3d354a5cbf2 | |
parent | 7c82c0a3a02a9529437c4ed95cd013a6a02692b4 (diff) | |
parent | 7acaef9c4197e3df1e0d9c34f61c6f59a64e7c00 (diff) | |
download | android_hardware_qcom_sdm845_display-0e8ebbd4f3c26df840369ed29c78f3103723cbb9.tar.gz android_hardware_qcom_sdm845_display-0e8ebbd4f3c26df840369ed29c78f3103723cbb9.tar.bz2 android_hardware_qcom_sdm845_display-0e8ebbd4f3c26df840369ed29c78f3103723cbb9.zip |
Merge "histogram: limit dumpsys output"
-rw-r--r-- | libhistogram/histogram_collector.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/libhistogram/histogram_collector.cpp b/libhistogram/histogram_collector.cpp index dd2c391d..868aaff5 100644 --- a/libhistogram/histogram_collector.cpp +++ b/libhistogram/histogram_collector.cpp @@ -287,10 +287,27 @@ histogram::HistogramCollector::~HistogramCollector() { stop(); } +namespace { +static constexpr size_t numBuckets = 8; +static_assert((HIST_V_SIZE % numBuckets) == 0, + "histogram cannot be rebucketed to smaller number of buckets"); +static constexpr int bucket_compression = HIST_V_SIZE / numBuckets; + +std::array<uint64_t, numBuckets> rebucketTo8Buckets(std::array<uint64_t, HIST_V_SIZE> const& frame) { + std::array<uint64_t, numBuckets> bins; + bins.fill(0); + for (auto i = 0u; i < HIST_V_SIZE; i++) + bins[i / bucket_compression] += frame[i]; + return bins; +} +} + std::string histogram::HistogramCollector::Dump() const { uint64_t num_frames; - std::array<uint64_t, HIST_V_SIZE> samples; - std::tie(num_frames, samples) = histogram->collect_cumulative(); + std::array<uint64_t, HIST_V_SIZE> all_sample_buckets; + std::tie(num_frames, all_sample_buckets) = histogram->collect_cumulative(); + std::array<uint64_t, numBuckets> samples = rebucketTo8Buckets(all_sample_buckets); + std::stringstream ss; ss << "Color Sampling, dark (0.0) to light (1.0): sampled frames: " << num_frames << '\n'; if (num_frames == 0) { @@ -309,21 +326,6 @@ std::string histogram::HistogramCollector::Dump() const { return ss.str(); } -namespace { -static constexpr size_t numBuckets = 8; -static_assert((HIST_V_SIZE % numBuckets) == 0, - "histogram cannot be rebucketed to smaller number of buckets"); -static constexpr int bucket_compression = HIST_V_SIZE / numBuckets; - -std::array<uint64_t, numBuckets> rebucketTo8Buckets(std::array<uint64_t, HIST_V_SIZE> const& frame) { - std::array<uint64_t, numBuckets> bins; - bins.fill(0); - for (auto i = 0u; i < HIST_V_SIZE; i++) - bins[i / bucket_compression] += frame[i]; - return bins; -} -} - HWC2::Error histogram::HistogramCollector::collect( uint64_t max_frames, uint64_t timestamp, |