/
githubmirror
/
nbs
Обзор
Документация
Войти
/
githubmirror
/
nbs
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
library/cpp/lfalloc/alloc_profiler/profiler.h
45 строк
1 KB
qkrorlqr
Initial NBS OpenSource export
28 апр 2023, 21:54
28 апр 2023, 21:54
783a858
Код
Авторство
О чём код?
#pragma once #include "stackcollect.h" #include <library/cpp/lfalloc/dbg_info/dbg_info.h> #include <util/generic/noncopyable.h> #include <util/stream/output.h> namespace NAllocProfiler { //////////////////////////////////////////////////////////////////////////////// inline int SetCurrentScopeTag(int value) { return NAllocDbg::SetThreadAllocTag(value); } inline bool SetProfileCurrentThread(bool value) { return NAllocDbg::SetProfileCurrentThread(value); } bool StartAllocationSampling(bool profileAllThreads = false); bool StopAllocationSampling(IAllocationStatsDumper& out, int count = 100); bool StopAllocationSampling(IOutputStream& out, int count = 100); //////////////////////////////////////////////////////////////////////////////// class TProfilingScope: private TNonCopyable { private: const int Prev; public: explicit TProfilingScope(int value) : Prev(SetCurrentScopeTag(value)) {} ~TProfilingScope() { SetCurrentScopeTag(Prev); } }; } // namespace NAllocProfiler