diff options
author | kbalakirev <kbalakirev@yandex-team.ru> | 2022-02-10 16:48:58 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:58 +0300 |
commit | 498a47e48d41e5ec64ee3aa622a76a80274f35bd (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/monlib/metrics/log_histogram_snapshot.h | |
parent | 1906a186042870fd03a12180acd1a6fcee045e42 (diff) | |
download | ydb-498a47e48d41e5ec64ee3aa622a76a80274f35bd.tar.gz |
Restoring authorship annotation for <kbalakirev@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/metrics/log_histogram_snapshot.h')
-rw-r--r-- | library/cpp/monlib/metrics/log_histogram_snapshot.h | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/library/cpp/monlib/metrics/log_histogram_snapshot.h b/library/cpp/monlib/metrics/log_histogram_snapshot.h index 7f7826d49d..7673b43751 100644 --- a/library/cpp/monlib/metrics/log_histogram_snapshot.h +++ b/library/cpp/monlib/metrics/log_histogram_snapshot.h @@ -1,71 +1,71 @@ -#pragma once - -#include <util/generic/ptr.h> -#include <util/generic/vector.h> - -#include <cmath> - -namespace NMonitoring { - - constexpr ui32 LOG_HIST_MAX_BUCKETS = 100; - - class TLogHistogramSnapshot: public TAtomicRefCount<TLogHistogramSnapshot> { - public: - TLogHistogramSnapshot(double base, ui64 zerosCount, int startPower, TVector<double> buckets) - : Base_(base) - , ZerosCount_(zerosCount) - , StartPower_(startPower) - , Buckets_(std::move(buckets)) { - } - - /** - * @return buckets count. - */ - ui32 Count() const noexcept { - return Buckets_.size(); - } - - /** - * @return upper bound for the bucket with particular index. - */ - double UpperBound(int index) const noexcept { - return std::pow(Base_, StartPower_ + index); - } - - /** - * @return value stored in the bucket with particular index. - */ - double Bucket(ui32 index) const noexcept { - return Buckets_[index]; - } - - /** - * @return nonpositive values count - */ - ui64 ZerosCount() const noexcept { - return ZerosCount_; - } - - double Base() const noexcept { - return Base_; - } - - int StartPower() const noexcept { - return StartPower_; - } - - ui64 MemorySizeBytes() const noexcept { - return sizeof(*this) + Buckets_.capacity() * sizeof(double); - } - - private: - double Base_; - ui64 ZerosCount_; - int StartPower_; - TVector<double> Buckets_; - }; - - using TLogHistogramSnapshotPtr = TIntrusivePtr<TLogHistogramSnapshot>; -} +#pragma once + +#include <util/generic/ptr.h> +#include <util/generic/vector.h> + +#include <cmath> + +namespace NMonitoring { + + constexpr ui32 LOG_HIST_MAX_BUCKETS = 100; + + class TLogHistogramSnapshot: public TAtomicRefCount<TLogHistogramSnapshot> { + public: + TLogHistogramSnapshot(double base, ui64 zerosCount, int startPower, TVector<double> buckets) + : Base_(base) + , ZerosCount_(zerosCount) + , StartPower_(startPower) + , Buckets_(std::move(buckets)) { + } + + /** + * @return buckets count. + */ + ui32 Count() const noexcept { + return Buckets_.size(); + } + + /** + * @return upper bound for the bucket with particular index. + */ + double UpperBound(int index) const noexcept { + return std::pow(Base_, StartPower_ + index); + } + + /** + * @return value stored in the bucket with particular index. + */ + double Bucket(ui32 index) const noexcept { + return Buckets_[index]; + } + + /** + * @return nonpositive values count + */ + ui64 ZerosCount() const noexcept { + return ZerosCount_; + } + + double Base() const noexcept { + return Base_; + } + + int StartPower() const noexcept { + return StartPower_; + } + + ui64 MemorySizeBytes() const noexcept { + return sizeof(*this) + Buckets_.capacity() * sizeof(double); + } + + private: + double Base_; + ui64 ZerosCount_; + int StartPower_; + TVector<double> Buckets_; + }; + + using TLogHistogramSnapshotPtr = TIntrusivePtr<TLogHistogramSnapshot>; +} std::ostream& operator<<(std::ostream& os, const NMonitoring::TLogHistogramSnapshot& hist); |