aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/balloc/setup/alloc.h
diff options
context:
space:
mode:
authorudovichenko-r <udovichenko-r@yandex-team.ru>2022-07-04 14:16:38 +0300
committerudovichenko-r <udovichenko-r@yandex-team.ru>2022-07-04 14:16:38 +0300
commit5fe1c2b2d90b4ddbd7d1683191a48851363cf53d (patch)
treec413b43fb69611ff1185ead7813a8e0973dca3dc /library/cpp/balloc/setup/alloc.h
parentf9651ab5ad67347bf06d6d0789b5d6eb31a7b2cc (diff)
downloadydb-5fe1c2b2d90b4ddbd7d1683191a48851363cf53d.tar.gz
[KIKIMR-15108] Add perf programs to build
ref:8f081efde09627da76e52231d32a83e34b78c1e4
Diffstat (limited to 'library/cpp/balloc/setup/alloc.h')
-rw-r--r--library/cpp/balloc/setup/alloc.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/library/cpp/balloc/setup/alloc.h b/library/cpp/balloc/setup/alloc.h
new file mode 100644
index 0000000000..89fee3e3e7
--- /dev/null
+++ b/library/cpp/balloc/setup/alloc.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <stddef.h>
+
+namespace NAllocSetup {
+ void ThrowOnError(size_t allocSize);
+ void SetThrowConditions(size_t currSize, size_t maxSize);
+ void SetSoftLimit(size_t softLimit);
+ void SetHardLimit(size_t hardLimit);
+ void SetAllocationThreshold(size_t allocationThreshold);
+ void SetSoftReclaimDivisor(size_t softReclaimDivisor);
+ void SetAngryReclaimDivisor(size_t angryReclaimDivisor);
+ bool CanAlloc(size_t allocSize, size_t totalAllocSize);
+ bool NeedReclaim(size_t gcSize_, size_t counter);
+ size_t GetTotalAllocSize();
+ size_t GetCurSize();
+ size_t GetGCSize();
+
+ size_t GetSoftLimit();
+ size_t GetHardLimit();
+ size_t GetAllocationThreshold();
+ size_t GetSoftReclaimDivisor();
+ size_t GetAngryReclaimDivisor();
+
+ bool IsEnabledByDefault();
+
+ struct TAllocGuard {
+ TAllocGuard(size_t maxSize) {
+ SetThrowConditions(0, maxSize);
+ }
+ ~TAllocGuard() {
+ SetThrowConditions(0, 0);
+ }
+ };
+}