summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin DuBois <kevindubois@google.com>2019-03-07 09:54:46 -0800
committerKevin DuBois <kevindubois@google.com>2019-03-07 10:21:48 -0800
commit7acaef9c4197e3df1e0d9c34f61c6f59a64e7c00 (patch)
tree6726bbed96f3ed514cac8956d976e4c436c60542
parent1284c3f5c329b2c6aa4057f172742aa724a84478 (diff)
downloadandroid_hardware_qcom_sdm845_display-7acaef9c4197e3df1e0d9c34f61c6f59a64e7c00.tar.gz
android_hardware_qcom_sdm845_display-7acaef9c4197e3df1e0d9c34f61c6f59a64e7c00.tar.bz2
android_hardware_qcom_sdm845_display-7acaef9c4197e3df1e0d9c34f61c6f59a64e7c00.zip
histogram: limit dumpsys output
Previously dumpsys SurfaceFlinger was printing all bucketed 256 values of the sampling. Reuse some bucketing code to condense this to 8 printed buckets. Test: dumpsys SurfaceFlinger Test: boot Fixes: 127512072 Change-Id: Ia14950818dd923bdfc9eea5b421acef6f18f1bbc
-rw-r--r--libhistogram/histogram_collector.cpp36
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,