diff options
author | vskipin <vskipin@yandex-team.ru> | 2022-02-10 16:46:00 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:00 +0300 |
commit | 4d8b546b89b5afc08cf3667e176271c7ba935f33 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/lfalloc/dbg_info/dbg_info.cpp | |
parent | 4e4b78bd7b67e2533da4dbb9696374a6d6068e32 (diff) | |
download | ydb-4d8b546b89b5afc08cf3667e176271c7ba935f33.tar.gz |
Restoring authorship annotation for <vskipin@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/lfalloc/dbg_info/dbg_info.cpp')
-rw-r--r-- | library/cpp/lfalloc/dbg_info/dbg_info.cpp | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/lfalloc/dbg_info/dbg_info.cpp b/library/cpp/lfalloc/dbg_info/dbg_info.cpp index c900cb4f96..1fb9f7ad93 100644 --- a/library/cpp/lfalloc/dbg_info/dbg_info.cpp +++ b/library/cpp/lfalloc/dbg_info/dbg_info.cpp @@ -1,83 +1,83 @@ -#include "dbg_info.h" - +#include "dbg_info.h" + #include <library/cpp/malloc/api/malloc.h> - -namespace NAllocDbg { + +namespace NAllocDbg { //////////////////////////////////////////////////////////////////////////////// - + using TGetAllocationCounter = i64(int counter); - + using TSetThreadAllocTag = int(int tag); using TGetPerTagAllocInfo = void( bool flushPerThreadCounters, TPerTagAllocInfo* info, int& maxTag, int& numSizes); - + using TSetProfileCurrentThread = bool(bool newVal); using TSetProfileAllThreads = bool(bool newVal); using TSetAllocationSamplingEnabled = bool(bool newVal); - + using TSetAllocationSampleRate = size_t(size_t newVal); using TSetAllocationSampleMaxSize = size_t(size_t newVal); - + using TSetAllocationCallback = TAllocationCallback*(TAllocationCallback* newVal); using TSetDeallocationCallback = TDeallocationCallback*(TDeallocationCallback* newVal); - + struct TAllocFn { TGetAllocationCounter* GetAllocationCounterFast = nullptr; TGetAllocationCounter* GetAllocationCounterFull = nullptr; - + TSetThreadAllocTag* SetThreadAllocTag = nullptr; TGetPerTagAllocInfo* GetPerTagAllocInfo = nullptr; - + TSetProfileCurrentThread* SetProfileCurrentThread = nullptr; TSetProfileAllThreads* SetProfileAllThreads = nullptr; TSetAllocationSamplingEnabled* SetAllocationSamplingEnabled = nullptr; - + TSetAllocationSampleRate* SetAllocationSampleRate = nullptr; TSetAllocationSampleMaxSize* SetAllocationSampleMaxSize = nullptr; - + TSetAllocationCallback* SetAllocationCallback = nullptr; TSetDeallocationCallback* SetDeallocationCallback = nullptr; - + TAllocFn() { auto mallocInfo = NMalloc::MallocInfo(); - + GetAllocationCounterFast = (TGetAllocationCounter*)mallocInfo.GetParam("GetLFAllocCounterFast"); GetAllocationCounterFull = (TGetAllocationCounter*)mallocInfo.GetParam("GetLFAllocCounterFull"); - + SetThreadAllocTag = (TSetThreadAllocTag*)mallocInfo.GetParam("SetThreadAllocTag"); GetPerTagAllocInfo = (TGetPerTagAllocInfo*)mallocInfo.GetParam("GetPerTagAllocInfo"); - + SetProfileCurrentThread = (TSetProfileCurrentThread*)mallocInfo.GetParam("SetProfileCurrentThread"); SetProfileAllThreads = (TSetProfileAllThreads*)mallocInfo.GetParam("SetProfileAllThreads"); SetAllocationSamplingEnabled = (TSetAllocationSamplingEnabled*)mallocInfo.GetParam("SetAllocationSamplingEnabled"); - + SetAllocationSampleRate = (TSetAllocationSampleRate*)mallocInfo.GetParam("SetAllocationSampleRate"); SetAllocationSampleMaxSize = (TSetAllocationSampleMaxSize*)mallocInfo.GetParam("SetAllocationSampleMaxSize"); - + SetAllocationCallback = (TSetAllocationCallback*)mallocInfo.GetParam("SetAllocationCallback"); SetDeallocationCallback = (TSetDeallocationCallback*)mallocInfo.GetParam("SetDeallocationCallback"); } }; - + //////////////////////////////////////////////////////////////////////////////// - + static TAllocFn AllocFn; - + i64 GetAllocationCounterFast(ELFAllocCounter counter) { return AllocFn.GetAllocationCounterFast ? AllocFn.GetAllocationCounterFast(counter) : 0; } - + i64 GetAllocationCounterFull(ELFAllocCounter counter) { return AllocFn.GetAllocationCounterFull ? AllocFn.GetAllocationCounterFull(counter) : 0; } - + int SetThreadAllocTag(int tag) { return AllocFn.SetThreadAllocTag ? AllocFn.SetThreadAllocTag(tag) : 0; } - + TArrayPtr<TPerTagAllocInfo> GetPerTagAllocInfo( bool flushPerThreadCounters, int& maxTag, @@ -92,11 +92,11 @@ namespace NAllocDbg { numSizes = 0; return nullptr; } - + bool SetProfileCurrentThread(bool newVal) { return AllocFn.SetProfileCurrentThread ? AllocFn.SetProfileCurrentThread(newVal) : false; - } - + } + bool SetProfileAllThreads(bool newVal) { return AllocFn.SetProfileAllThreads ? AllocFn.SetProfileAllThreads(newVal) : false; } @@ -104,21 +104,21 @@ namespace NAllocDbg { bool SetAllocationSamplingEnabled(bool newVal) { return AllocFn.SetAllocationSamplingEnabled ? AllocFn.SetAllocationSamplingEnabled(newVal) : false; } - + size_t SetAllocationSampleRate(size_t newVal) { return AllocFn.SetAllocationSampleRate ? AllocFn.SetAllocationSampleRate(newVal) : 0; } - + size_t SetAllocationSampleMaxSize(size_t newVal) { return AllocFn.SetAllocationSampleMaxSize ? AllocFn.SetAllocationSampleMaxSize(newVal) : 0; } - + TAllocationCallback* SetAllocationCallback(TAllocationCallback* newVal) { return AllocFn.SetAllocationCallback ? AllocFn.SetAllocationCallback(newVal) : nullptr; } - + TDeallocationCallback* SetDeallocationCallback(TDeallocationCallback* newVal) { return AllocFn.SetDeallocationCallback ? AllocFn.SetDeallocationCallback(newVal) : nullptr; } - -} + +} |