aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/counters
diff options
context:
space:
mode:
authorAndrey Fomichev <andrey.fomichev@gmail.com>2022-02-10 16:49:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:15 +0300
commit1c61afbf3db63940d05e6fefa3104b03457788a1 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/monlib/counters
parente542cc14db4240643a06bb0dde87ecf361f101ab (diff)
downloadydb-1c61afbf3db63940d05e6fefa3104b03457788a1.tar.gz
Restoring authorship annotation for Andrey Fomichev <andrey.fomichev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/counters')
-rw-r--r--library/cpp/monlib/counters/counters.cpp40
-rw-r--r--library/cpp/monlib/counters/counters.h4
2 files changed, 22 insertions, 22 deletions
diff --git a/library/cpp/monlib/counters/counters.cpp b/library/cpp/monlib/counters/counters.cpp
index 318c99ad38..50dca4c577 100644
--- a/library/cpp/monlib/counters/counters.cpp
+++ b/library/cpp/monlib/counters/counters.cpp
@@ -1,31 +1,31 @@
-
-#include "counters.h"
-
-namespace NMonitoring {
+
+#include "counters.h"
+
+namespace NMonitoring {
char* PrettyNumShort(i64 val, char* buf, size_t size) {
static const char shorts[] = {' ', 'K', 'M', 'G', 'T', 'P', 'E'};
- unsigned i = 0;
- i64 major = val;
- i64 minor = 0;
+ unsigned i = 0;
+ i64 major = val;
+ i64 minor = 0;
const unsigned imax = sizeof(shorts) / sizeof(char);
for (i = 0; i < imax; i++) {
- if (major >> 10 == 0)
- break;
- else {
+ if (major >> 10 == 0)
+ break;
+ else {
minor = major - (major >> 10 << 10);
- major = major >> 10;
- }
- }
+ major = major >> 10;
+ }
+ }
minor = (minor * 10) >> 10;
-
+
if (i == 0 || i >= imax)
- *buf = '\0';
- else
+ *buf = '\0';
+ else
snprintf(buf, size, "%" PRId64 ".%" PRId64 "%c", major, minor, shorts[i]);
-
- return buf;
- }
-
+
+ return buf;
+ }
+
char* PrettyNum(i64 val, char* buf, size_t size) {
Y_ASSERT(buf);
if (size < 4) {
diff --git a/library/cpp/monlib/counters/counters.h b/library/cpp/monlib/counters/counters.h
index 3492231282..038b55f0c8 100644
--- a/library/cpp/monlib/counters/counters.h
+++ b/library/cpp/monlib/counters/counters.h
@@ -21,7 +21,7 @@
namespace NMonitoring {
#define BEGIN_OUTPUT_COUNTERS \
void OutputImpl(IOutputStream& out) { \
- char prettyBuf[32];
+ char prettyBuf[32];
#define END_OUTPUT_COUNTERS \
out.Flush(); \
}
@@ -31,7 +31,7 @@ namespace NMonitoring {
char* PrettyNumShort(i64 val, char* buf, size_t size);
char* PrettyNum(i64 val, char* buf, size_t size);
-
+
// This class is deprecated. Please consider to use
// library/cpp/monlib/metrics instead. See more info at
// https://wiki.yandex-team.ru/solomon/libs/monlib_cpp/