aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/malloc/jemalloc/malloc-info.cpp
diff options
context:
space:
mode:
authorAnton Samokhvalov <pg83@yandex.ru>2022-02-10 16:45:17 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:45:17 +0300
commitd3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch)
treedd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/malloc/jemalloc/malloc-info.cpp
parent72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff)
downloadydb-d3a398281c6fd1d3672036cb2d63f842d2cb28c5.tar.gz
Restoring authorship annotation for Anton Samokhvalov <pg83@yandex.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/malloc/jemalloc/malloc-info.cpp')
-rw-r--r--library/cpp/malloc/jemalloc/malloc-info.cpp114
1 files changed, 57 insertions, 57 deletions
diff --git a/library/cpp/malloc/jemalloc/malloc-info.cpp b/library/cpp/malloc/jemalloc/malloc-info.cpp
index df2df745a4..2643ca4766 100644
--- a/library/cpp/malloc/jemalloc/malloc-info.cpp
+++ b/library/cpp/malloc/jemalloc/malloc-info.cpp
@@ -1,65 +1,65 @@
#include <library/cpp/malloc/api/malloc.h>
-using namespace NMalloc;
-
-#if defined(_MSC_VER)
-TMallocInfo NMalloc::MallocInfo() {
- TMallocInfo r;
- r.Name = "jemalloc";
- return r;
-}
-#else
-#include <strings.h>
-#include <stdlib.h>
-#include <inttypes.h>
-
-#include <contrib/libs/jemalloc/include/jemalloc/jemalloc.h>
-
-namespace {
+using namespace NMalloc;
+
+#if defined(_MSC_VER)
+TMallocInfo NMalloc::MallocInfo() {
+ TMallocInfo r;
+ r.Name = "jemalloc";
+ return r;
+}
+#else
+#include <strings.h>
+#include <stdlib.h>
+#include <inttypes.h>
+
+#include <contrib/libs/jemalloc/include/jemalloc/jemalloc.h>
+
+namespace {
bool JESetParam(const char* param, const char*) {
- if (param) {
- if (strcmp(param, "j:reset_epoch") == 0) {
- uint64_t epoch = 1;
- size_t sz = sizeof(epoch);
-
- mallctl("epoch", &epoch, &sz, &epoch, sz);
-
- return true;
- }
-
- return false;
- }
-
- return false;
- }
-
- const char* JEGetParam(const char* param) {
- if (param) {
- if (strcmp(param, "allocated") == 0) {
- JESetParam("j:reset_epoch", nullptr);
-
- size_t allocated = 0;
- size_t sz = sizeof(allocated);
-
- mallctl("stats.allocated", &allocated, &sz, nullptr, 0);
-
- static_assert(sizeof(size_t) == sizeof(void*), "fix me");
-
- return (const char*)(void*)allocated;
- }
-
- return nullptr;
- }
-
- return nullptr;
- }
-}
-
+ if (param) {
+ if (strcmp(param, "j:reset_epoch") == 0) {
+ uint64_t epoch = 1;
+ size_t sz = sizeof(epoch);
+
+ mallctl("epoch", &epoch, &sz, &epoch, sz);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ return false;
+ }
+
+ const char* JEGetParam(const char* param) {
+ if (param) {
+ if (strcmp(param, "allocated") == 0) {
+ JESetParam("j:reset_epoch", nullptr);
+
+ size_t allocated = 0;
+ size_t sz = sizeof(allocated);
+
+ mallctl("stats.allocated", &allocated, &sz, nullptr, 0);
+
+ static_assert(sizeof(size_t) == sizeof(void*), "fix me");
+
+ return (const char*)(void*)allocated;
+ }
+
+ return nullptr;
+ }
+
+ return nullptr;
+ }
+}
+
TMallocInfo NMalloc::MallocInfo() {
TMallocInfo r;
r.Name = "jemalloc";
- r.SetParam = JESetParam;
- r.GetParam = JEGetParam;
+ r.SetParam = JESetParam;
+ r.GetParam = JEGetParam;
return r;
}
-#endif
+#endif