diff options
| author | Anton Samokhvalov <[email protected]> | 2022-02-10 16:45:17 +0300 | 
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:17 +0300 | 
| commit | d3a398281c6fd1d3672036cb2d63f842d2cb28c5 (patch) | |
| tree | dd4bd3ca0f36b817e96812825ffaf10d645803f2 /library/cpp/malloc/jemalloc | |
| parent | 72cb13b4aff9bc9cf22e49251bc8fd143f82538f (diff) | |
Restoring authorship annotation for Anton Samokhvalov <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/malloc/jemalloc')
| -rw-r--r-- | library/cpp/malloc/jemalloc/malloc-info.cpp | 114 | ||||
| -rw-r--r-- | library/cpp/malloc/jemalloc/ya.make | 22 | 
2 files changed, 68 insertions, 68 deletions
| diff --git a/library/cpp/malloc/jemalloc/malloc-info.cpp b/library/cpp/malloc/jemalloc/malloc-info.cpp index df2df745a41..2643ca47668 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 diff --git a/library/cpp/malloc/jemalloc/ya.make b/library/cpp/malloc/jemalloc/ya.make index 672f72e6d98..99db474eab6 100644 --- a/library/cpp/malloc/jemalloc/ya.make +++ b/library/cpp/malloc/jemalloc/ya.make @@ -4,18 +4,18 @@ NO_UTIL()  OWNER(nga) -IF (OS_ANDROID)  -    PEERDIR(  +IF (OS_ANDROID) +    PEERDIR(          library/cpp/malloc/system -    )  -ELSE()  -    PEERDIR(  +    ) +ELSE() +    PEERDIR(          library/cpp/malloc/api -        contrib/libs/jemalloc  -    )  -    SRCS(  -        malloc-info.cpp  -    )  -ENDIF()  +        contrib/libs/jemalloc +    ) +    SRCS( +        malloc-info.cpp +    ) +ENDIF()  END() | 
