Coverage Report

Created: 2026-10-28 06:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/perfetto/src/profiling/memory/log_histogram.h
Line
Count
Source
1
/*
2
 * Copyright (C) 2020 The Android Open Source Project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
17
#ifndef SRC_PROFILING_MEMORY_LOG_HISTOGRAM_H_
18
#define SRC_PROFILING_MEMORY_LOG_HISTOGRAM_H_
19
20
#include <stddef.h>
21
22
#include <array>
23
#include <cinttypes>
24
#include <utility>
25
#include <vector>
26
27
namespace perfetto {
28
namespace profiling {
29
30
class LogHistogram {
31
 public:
32
  static const uint64_t kMaxBucket;
33
  static constexpr size_t kBuckets = 20;
34
35
0
  void Add(uint64_t value) { values_[GetBucket(value)]++; }
36
  std::vector<std::pair<uint64_t, uint64_t>> GetData() const;
37
38
 private:
39
  size_t GetBucket(uint64_t value);
40
41
  std::array<uint64_t, kBuckets> values_ = {};
42
};
43
44
}  // namespace profiling
45
}  // namespace perfetto
46
47
#endif  // SRC_PROFILING_MEMORY_LOG_HISTOGRAM_H_