aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/histogram/adaptive/adaptive_histogram.cpp
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2024-05-20 12:16:11 +0300
committerthegeorg <thegeorg@yandex-team.com>2024-05-20 12:33:16 +0300
commit73d783fe0b096861111e19b63fa2259296050916 (patch)
treea507f65155934186eab5aba8ecc3db09f21dbc83 /library/cpp/histogram/adaptive/adaptive_histogram.cpp
parent46c0bf458366293d3fff860ead4d1a3a34272df6 (diff)
downloadydb-73d783fe0b096861111e19b63fa2259296050916.tar.gz
Switch to std::format to fix -Wformat
e2d3a54377ea6268a39c35989c259720c10edefa
Diffstat (limited to 'library/cpp/histogram/adaptive/adaptive_histogram.cpp')
-rw-r--r--library/cpp/histogram/adaptive/adaptive_histogram.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/library/cpp/histogram/adaptive/adaptive_histogram.cpp b/library/cpp/histogram/adaptive/adaptive_histogram.cpp
index 4bc4f63cda..bfe76330e0 100644
--- a/library/cpp/histogram/adaptive/adaptive_histogram.cpp
+++ b/library/cpp/histogram/adaptive/adaptive_histogram.cpp
@@ -7,6 +7,8 @@
#include <util/system/backtrace.h>
+#include <format>
+
namespace NKiwiAggr {
TAdaptiveHistogram::TAdaptiveHistogram(size_t intervals, ui64 id, TQualityFunction qualityFunc)
: Id(id)
@@ -71,7 +73,10 @@ namespace NKiwiAggr {
void TAdaptiveHistogram::Merge(const THistogram& histo, double multiplier) {
if (!IsValidFloat(histo.GetMinValue()) || !IsValidFloat(histo.GetMaxValue())) {
- fprintf(stderr, "Merging in histogram id %lu: skip bad histo with minvalue %f maxvalue %f\n", Id, histo.GetMinValue(), histo.GetMaxValue());
+ Cerr << std::format(
+ "Merging in histogram id {}: skip bad histo with minvalue {} maxvalue {}\n",
+ Id, histo.GetMinValue(), histo.GetMaxValue()
+ );
return;
}
if (histo.FreqSize() == 0) {
@@ -87,7 +92,10 @@ namespace NKiwiAggr {
double value = histo.GetPosition(j);
double weight = histo.GetFreq(j);
if (!IsValidFloat(value) || !IsValidFloat(weight)) {
- fprintf(stderr, "Merging in histogram id %lu: skip bad value %f weight %f\n", Id, value, weight);
+ Cerr << std::format(
+ "Merging in histogram id {}: skip bad value {} weight {}\n",
+ Id, value, weight
+ );
continue;
}
Add(value, weight * multiplier);
@@ -100,7 +108,10 @@ namespace NKiwiAggr {
for (size_t j = 0; j < histo.FreqSize(); ++j) {
double weight = histo.GetFreq(j);
if (!IsValidFloat(pos) || !IsValidFloat(weight)) {
- fprintf(stderr, "Merging in histogram id %lu: skip bad value %f weight %f\n", Id, pos, weight);
+ Cerr << std::format(
+ "Merging in histogram id {}: skip bad value {} weight {}\n",
+ Id, pos, weight
+ );
pos += histo.GetBinRange();
continue;
}
@@ -218,7 +229,10 @@ namespace NKiwiAggr {
double value = histo.GetPosition(i);
double weight = histo.GetFreq(i);
if (!IsValidFloat(value) || !IsValidFloat(weight)) {
- fprintf(stderr, "FromProto in histogram id %lu: skip bad value %f weight %f\n", Id, value, weight);
+ Cerr << std::format(
+ "FromProto in histogram id {}: skip bad value {} weight {}\n",
+ Id, value, weight
+ );
continue;
}
Add(value, weight);