diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /library/cpp/histogram | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/histogram')
-rw-r--r-- | library/cpp/histogram/adaptive/adaptive_histogram.cpp | 30 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/auto_histogram.h | 10 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/block_histogram.cpp | 28 | ||||
-rw-r--r-- | library/cpp/histogram/adaptive/fixed_bin_histogram.cpp | 2 | ||||
-rw-r--r-- | library/cpp/histogram/hdr/histogram_iter_ut.cpp | 16 | ||||
-rw-r--r-- | library/cpp/histogram/hdr/histogram_ut.cpp | 20 |
6 files changed, 53 insertions, 53 deletions
diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.cpp b/library/cpp/histogram/adaptive/adaptive_histogram.cpp index cbfc494021..ce204de6fd 100644 --- a/library/cpp/histogram/adaptive/adaptive_histogram.cpp +++ b/library/cpp/histogram/adaptive/adaptive_histogram.cpp @@ -80,7 +80,7 @@ namespace NKiwiAggr { histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM || histo.GetType() == HT_ADAPTIVE_HISTOGRAM) { - Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo"); + Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo"); for (size_t j = 0; j < histo.FreqSize(); ++j) { double value = histo.GetPosition(j); double weight = histo.GetFreq(j); @@ -350,7 +350,7 @@ namespace NKiwiAggr { } double TAdaptiveHistogram::CalcUpperBound(double sum) { - Y_VERIFY(sum >= 0, "Sum must be >= 0"); + Y_VERIFY(sum >= 0, "Sum must be >= 0"); if (sum == 0.0) { return MinValue; } @@ -391,7 +391,7 @@ namespace NKiwiAggr { } double TAdaptiveHistogram::CalcLowerBound(double sum) { - Y_VERIFY(sum >= 0, "Sum must be >= 0"); + Y_VERIFY(sum >= 0, "Sum must be >= 0"); if (sum == 0.0) { return MaxValue; } @@ -509,13 +509,13 @@ namespace NKiwiAggr { ++rightBin; TWeightedValue newBin(value, weight + currentBin->second); if (rightBin != Bins.end()) { - Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) == 1, "Erase failed"); + Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) == 1, "Erase failed"); BinsByQuality.insert(CalcQuality(newBin, *rightBin)); } if (currentBin != Bins.begin()) { TPairSet::iterator leftBin = currentBin; --leftBin; - Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) == 1, "Erase failed"); + Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) == 1, "Erase failed"); BinsByQuality.insert(CalcQuality(*leftBin, newBin)); } Bins.erase(currentBin); @@ -530,7 +530,7 @@ namespace NKiwiAggr { if (rightBin == Bins.end()) { BinsByQuality.insert(CalcQuality(*leftBin, weightedValue)); } else { - Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *rightBin)) == 1, "Erase failed"); + Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *rightBin)) == 1, "Erase failed"); BinsByQuality.insert(CalcQuality(*leftBin, weightedValue)); BinsByQuality.insert(CalcQuality(weightedValue, *rightBin)); } @@ -543,20 +543,20 @@ namespace NKiwiAggr { void TAdaptiveHistogram::Erase(double value) { TPairSet::iterator currentBin = Bins.lower_bound(TWeightedValue(value, -1.0)); - Y_VERIFY(currentBin != Bins.end() && currentBin->first == value, "Can't find bin that should be erased"); + Y_VERIFY(currentBin != Bins.end() && currentBin->first == value, "Can't find bin that should be erased"); TPairSet::iterator rightBin = currentBin; ++rightBin; if (currentBin == Bins.begin()) { - Y_VERIFY(rightBin != Bins.end(), "No right bin for the first bin"); - Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) != 0, "Erase failed"); + Y_VERIFY(rightBin != Bins.end(), "No right bin for the first bin"); + Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) != 0, "Erase failed"); } else { TPairSet::iterator leftBin = currentBin; --leftBin; if (rightBin == Bins.end()) { - Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) != 0, "Erase failed"); + Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) != 0, "Erase failed"); } else { - Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) != 0, "Erase failed"); - Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) != 0, "Erase failed"); + Y_VERIFY(BinsByQuality.erase(CalcQuality(*leftBin, *currentBin)) != 0, "Erase failed"); + Y_VERIFY(BinsByQuality.erase(CalcQuality(*currentBin, *rightBin)) != 0, "Erase failed"); BinsByQuality.insert(CalcQuality(*leftBin, *rightBin)); } } @@ -565,12 +565,12 @@ namespace NKiwiAggr { void TAdaptiveHistogram::Shrink() { TPairSet::iterator worstBin = BinsByQuality.begin(); - Y_VERIFY(worstBin != BinsByQuality.end(), "No right bin for the first bin"); + Y_VERIFY(worstBin != BinsByQuality.end(), "No right bin for the first bin"); TPairSet::iterator leftBin = Bins.lower_bound(TWeightedValue(worstBin->second, -1.0)); - Y_VERIFY(leftBin != Bins.end() && leftBin->first == worstBin->second, "Can't find worst bin"); + Y_VERIFY(leftBin != Bins.end() && leftBin->first == worstBin->second, "Can't find worst bin"); TPairSet::iterator rightBin = leftBin; ++rightBin; - Y_VERIFY(rightBin != Bins.end(), "Can't find right bin"); + Y_VERIFY(rightBin != Bins.end(), "Can't find right bin"); TWeightedValue newBin((leftBin->first * leftBin->second + rightBin->first * rightBin->second) / (leftBin->second + rightBin->second), leftBin->second + rightBin->second); if (Bins.size() > 2) { diff --git a/library/cpp/histogram/adaptive/auto_histogram.h b/library/cpp/histogram/adaptive/auto_histogram.h index 9fdf0b9abe..08e4e3d9d4 100644 --- a/library/cpp/histogram/adaptive/auto_histogram.h +++ b/library/cpp/histogram/adaptive/auto_histogram.h @@ -20,8 +20,8 @@ namespace NKiwiAggr { public: TAutoHistogram(size_t intervals, ui64 id = 0) { - Y_UNUSED(intervals); - Y_UNUSED(id); + Y_UNUSED(intervals); + Y_UNUSED(id); ythrow yexception() << "Empty constructor is not defined for TAutoHistogram"; } @@ -33,9 +33,9 @@ namespace NKiwiAggr { } TAutoHistogram(IHistogram* histo, size_t defaultIntervals = DEFAULT_INTERVALS, ui64 defaultId = 0) { - Y_UNUSED(histo); - Y_UNUSED(defaultIntervals); - Y_UNUSED(defaultId); + Y_UNUSED(histo); + Y_UNUSED(defaultIntervals); + Y_UNUSED(defaultId); ythrow yexception() << "IHistogram constructor is not defined for TAutoHistogram"; } diff --git a/library/cpp/histogram/adaptive/block_histogram.cpp b/library/cpp/histogram/adaptive/block_histogram.cpp index 6586d13ff6..7003255916 100644 --- a/library/cpp/histogram/adaptive/block_histogram.cpp +++ b/library/cpp/histogram/adaptive/block_histogram.cpp @@ -149,7 +149,7 @@ namespace NKiwiAggr { histo.GetType() == HT_ADAPTIVE_WARD_HISTOGRAM || histo.GetType() == HT_ADAPTIVE_HISTOGRAM) { - Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo"); + Y_VERIFY(histo.FreqSize() == histo.PositionSize(), "Corrupted histo"); for (size_t j = 0; j < histo.FreqSize(); ++j) { double value = histo.GetPosition(j); double weight = histo.GetFreq(j); @@ -189,7 +189,7 @@ namespace NKiwiAggr { } void TBlockHistogram::Merge(TVector<IHistogramPtr> histogramsToMerge) { - Y_UNUSED(histogramsToMerge); + Y_UNUSED(histogramsToMerge); ythrow yexception() << "IHistogram::Merge(TVector<IHistogramPtr>) is not defined for TBlockHistogram"; } @@ -286,7 +286,7 @@ namespace NKiwiAggr { } void TBlockHistogram::SortAndShrink(size_t intervals, bool final) { - Y_VERIFY(intervals > 0); + Y_VERIFY(intervals > 0); if (Bins.size() <= intervals) { return; @@ -382,7 +382,7 @@ namespace NKiwiAggr { ui32 a = (ui32)(bins[b].Prev() - bins); ui32 c = (ui32)(bins[b].Next() - bins); ui32 d = (ui32)(bins[b].Next()->Next() - bins); - Y_VERIFY(Bins[c].second != -1); + Y_VERIFY(Bins[c].second != -1); double mass = Bins[b].second + Bins[c].second; Bins[c].first = (Bins[b].first * Bins[b].second + Bins[c].first * Bins[c].second) / mass; @@ -411,48 +411,48 @@ namespace NKiwiAggr { Bins.resize(pos); PrevSize = pos; - Y_VERIFY(pos == intervals); + Y_VERIFY(pos == intervals); } double TBlockHistogram::GetSumInRange(double leftBound, double rightBound) { - Y_UNUSED(leftBound); - Y_UNUSED(rightBound); + Y_UNUSED(leftBound); + Y_UNUSED(rightBound); ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } double TBlockHistogram::GetSumAboveBound(double bound) { - Y_UNUSED(bound); + Y_UNUSED(bound); ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } double TBlockHistogram::GetSumBelowBound(double bound) { - Y_UNUSED(bound); + Y_UNUSED(bound); ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } double TBlockHistogram::CalcUpperBound(double sum) { - Y_UNUSED(sum); + Y_UNUSED(sum); ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } double TBlockHistogram::CalcLowerBound(double sum) { - Y_UNUSED(sum); + Y_UNUSED(sum); ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } double TBlockHistogram::CalcUpperBoundSafe(double sum) { - Y_UNUSED(sum); + Y_UNUSED(sum); ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } double TBlockHistogram::CalcLowerBoundSafe(double sum) { - Y_UNUSED(sum); + Y_UNUSED(sum); ythrow yexception() << "Method is not implemented for TBlockHistogram"; return 0; } @@ -528,7 +528,7 @@ namespace NKiwiAggr { } void TBlockWardHistogram::FastGreedyShrink(size_t intervals) { - Y_VERIFY(intervals > 0); + Y_VERIFY(intervals > 0); if (Bins.size() <= intervals) { return; diff --git a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp index 558aba9e2d..aa33174f2d 100644 --- a/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp +++ b/library/cpp/histogram/adaptive/fixed_bin_histogram.cpp @@ -512,7 +512,7 @@ namespace NKiwiAggr { } void TFixedBinHistogram::Shrink(double newReferencePoint, double newMaxValue) { - Y_VERIFY(newReferencePoint < newMaxValue, "Invalid Shrink()"); + Y_VERIFY(newReferencePoint < newMaxValue, "Invalid Shrink()"); memset(&(ReserveFreqs[0]), 0, ReserveFreqs.size() * sizeof(double)); double newBinRange = CalcBinRange(newReferencePoint, newMaxValue); diff --git a/library/cpp/histogram/hdr/histogram_iter_ut.cpp b/library/cpp/histogram/hdr/histogram_iter_ut.cpp index 9c291a2547..2d6ffc68d9 100644 --- a/library/cpp/histogram/hdr/histogram_iter_ut.cpp +++ b/library/cpp/histogram/hdr/histogram_iter_ut.cpp @@ -4,8 +4,8 @@ using namespace NHdr; -Y_UNIT_TEST_SUITE(THistogramIterTest) { - Y_UNIT_TEST(RecordedValues) { +Y_UNIT_TEST_SUITE(THistogramIterTest) { + Y_UNIT_TEST(RecordedValues) { THistogram h(TDuration::Hours(1).MicroSeconds(), 3); UNIT_ASSERT(h.RecordValues(1000, 1000)); UNIT_ASSERT(h.RecordValue(1000 * 1000)); @@ -32,7 +32,7 @@ Y_UNIT_TEST_SUITE(THistogramIterTest) { UNIT_ASSERT_EQUAL(index, 2); } - Y_UNIT_TEST(CorrectedRecordedValues) { + Y_UNIT_TEST(CorrectedRecordedValues) { THistogram h(TDuration::Hours(1).MicroSeconds(), 3); UNIT_ASSERT(h.RecordValuesWithExpectedInterval(1000, 1000, 1000)); UNIT_ASSERT(h.RecordValueWithExpectedInterval(1000 * 1000, 1000)); @@ -59,7 +59,7 @@ Y_UNIT_TEST_SUITE(THistogramIterTest) { UNIT_ASSERT_EQUAL(totalCount, 2000); } - Y_UNIT_TEST(LinearValues) { + Y_UNIT_TEST(LinearValues) { THistogram h(TDuration::Hours(1).MicroSeconds(), 3); UNIT_ASSERT(h.RecordValues(1000, 1000)); UNIT_ASSERT(h.RecordValue(1000 * 1000)); @@ -87,7 +87,7 @@ Y_UNIT_TEST_SUITE(THistogramIterTest) { UNIT_ASSERT_EQUAL(index, 1000); } - Y_UNIT_TEST(CorrectLinearValues) { + Y_UNIT_TEST(CorrectLinearValues) { THistogram h(TDuration::Hours(1).MicroSeconds(), 3); UNIT_ASSERT(h.RecordValuesWithExpectedInterval(1000, 1000, 1000)); UNIT_ASSERT(h.RecordValueWithExpectedInterval(1000 * 1000, 1000)); @@ -116,7 +116,7 @@ Y_UNIT_TEST_SUITE(THistogramIterTest) { UNIT_ASSERT_EQUAL(totalCount, 2000); } - Y_UNIT_TEST(LogarithmicValues) { + Y_UNIT_TEST(LogarithmicValues) { THistogram h(TDuration::Hours(1).MicroSeconds(), 3); UNIT_ASSERT(h.RecordValues(1000, 1000)); UNIT_ASSERT(h.RecordValue(1000 * 1000)); @@ -150,7 +150,7 @@ Y_UNIT_TEST_SUITE(THistogramIterTest) { UNIT_ASSERT_EQUAL(index, 11); } - Y_UNIT_TEST(CorrectedLogarithmicValues) { + Y_UNIT_TEST(CorrectedLogarithmicValues) { THistogram h(TDuration::Hours(1).MicroSeconds(), 3); UNIT_ASSERT(h.RecordValuesWithExpectedInterval(1000, 1000, 1000)); UNIT_ASSERT(h.RecordValueWithExpectedInterval(1000 * 1000, 1000)); @@ -181,7 +181,7 @@ Y_UNIT_TEST_SUITE(THistogramIterTest) { UNIT_ASSERT_EQUAL(totalCount, 2000); } - Y_UNIT_TEST(LinearIterBucketsCorrectly) { + Y_UNIT_TEST(LinearIterBucketsCorrectly) { THistogram h(255, 2); UNIT_ASSERT(h.RecordValue(193)); UNIT_ASSERT(h.RecordValue(255)); diff --git a/library/cpp/histogram/hdr/histogram_ut.cpp b/library/cpp/histogram/hdr/histogram_ut.cpp index 4841b76e71..8974e60e2b 100644 --- a/library/cpp/histogram/hdr/histogram_ut.cpp +++ b/library/cpp/histogram/hdr/histogram_ut.cpp @@ -16,14 +16,14 @@ void LoadData(THistogram* h1, THistogram* h2) { UNIT_ASSERT(h2->RecordValueWithExpectedInterval(1000 * 1000, 1000)); } -Y_UNIT_TEST_SUITE(THistogramTest) { - Y_UNIT_TEST(Creation) { +Y_UNIT_TEST_SUITE(THistogramTest) { + Y_UNIT_TEST(Creation) { THistogram h(TDuration::Hours(1).MicroSeconds(), 3); UNIT_ASSERT_EQUAL(h.GetMemorySize(), 188512); UNIT_ASSERT_EQUAL(h.GetCountsLen(), 23552); } - Y_UNIT_TEST(CreateWithLargeValues) { + Y_UNIT_TEST(CreateWithLargeValues) { THistogram h(20L * 1000 * 1000, 100L * 1000 * 1000, 5); UNIT_ASSERT(h.RecordValue(100L * 1000 * 1000)); UNIT_ASSERT(h.RecordValue(20L * 1000 * 1000)); @@ -45,18 +45,18 @@ Y_UNIT_TEST_SUITE(THistogramTest) { UNIT_ASSERT(h.ValuesAreEqual(v99, 100L * 1000 * 1000)); } - Y_UNIT_TEST(InvalidSignificantValueDigits) { + Y_UNIT_TEST(InvalidSignificantValueDigits) { UNIT_ASSERT_EXCEPTION(THistogram(1000, -1), yexception); UNIT_ASSERT_EXCEPTION(THistogram(1000, 0), yexception); UNIT_ASSERT_EXCEPTION(THistogram(1000, 6), yexception); } - Y_UNIT_TEST(InvalidLowestDiscernibleValue) { + Y_UNIT_TEST(InvalidLowestDiscernibleValue) { UNIT_ASSERT_EXCEPTION(THistogram(0, 100, 3), yexception); UNIT_ASSERT_EXCEPTION(THistogram(110, 100, 3), yexception); } - Y_UNIT_TEST(TotalCount) { + Y_UNIT_TEST(TotalCount) { i64 oneHour = SafeIntegerCast<i64>(TDuration::Hours(1).MicroSeconds()); THistogram h1(oneHour, 3); THistogram h2(oneHour, 3); @@ -66,7 +66,7 @@ Y_UNIT_TEST_SUITE(THistogramTest) { UNIT_ASSERT_EQUAL(h2.GetTotalCount(), 2000); } - Y_UNIT_TEST(StatsValues) { + Y_UNIT_TEST(StatsValues) { i64 oneHour = SafeIntegerCast<i64>(TDuration::Hours(1).MicroSeconds()); THistogram h1(oneHour, 3); THistogram h2(oneHour, 3); @@ -97,7 +97,7 @@ Y_UNIT_TEST_SUITE(THistogramTest) { } } - Y_UNIT_TEST(Percentiles) { + Y_UNIT_TEST(Percentiles) { i64 oneHour = SafeIntegerCast<i64>(TDuration::Hours(1).MicroSeconds()); THistogram h1(oneHour, 3); THistogram h2(oneHour, 3); @@ -156,13 +156,13 @@ Y_UNIT_TEST_SUITE(THistogramTest) { } } - Y_UNIT_TEST(OutOfRangeValues) { + Y_UNIT_TEST(OutOfRangeValues) { THistogram h(1000, 4); UNIT_ASSERT(h.RecordValue(32767)); UNIT_ASSERT(!h.RecordValue(32768)); } - Y_UNIT_TEST(Reset) { + Y_UNIT_TEST(Reset) { THistogram h(TDuration::Hours(1).MicroSeconds(), 3); UNIT_ASSERT(h.RecordValues(1000, 1000)); UNIT_ASSERT(h.RecordValue(1000 * 1000)); |