Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
kernel
caches.h
Go to the documentation of this file.
1
// Copyright (c) 2024-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_KERNEL_CACHES_H
6
#define BITCOIN_KERNEL_CACHES_H
7
8
#include <
util/byte_units.h
>
9
10
#include <algorithm>
11
13
static
constexpr
size_t
DEFAULT_KERNEL_CACHE
{450_MiB};
15
static
constexpr
size_t
DEFAULT_DB_CACHE_BATCH
{32_MiB};
16
18
static
constexpr
size_t
MAX_BLOCK_DB_CACHE
{2_MiB};
20
static
constexpr
size_t
MAX_COINS_DB_CACHE
{8_MiB};
21
22
namespace
kernel
{
23
struct
CacheSizes
{
24
size_t
block_tree_db
;
25
size_t
coins_db
;
26
size_t
coins
;
27
28
CacheSizes
(
size_t
total_cache)
29
{
30
block_tree_db
= std::min(total_cache / 8,
MAX_BLOCK_DB_CACHE
);
31
total_cache -=
block_tree_db
;
32
coins_db
= std::min(total_cache / 2,
MAX_COINS_DB_CACHE
);
33
total_cache -=
coins_db
;
34
coins
= total_cache;
// the rest goes to the coins cache
35
}
36
};
37
}
// namespace kernel
38
39
#endif
// BITCOIN_KERNEL_CACHES_H
byte_units.h
MAX_BLOCK_DB_CACHE
static constexpr size_t MAX_BLOCK_DB_CACHE
Max memory allocated to block tree DB specific cache (bytes).
Definition
caches.h:18
DEFAULT_KERNEL_CACHE
static constexpr size_t DEFAULT_KERNEL_CACHE
Suggested default amount of cache reserved for the kernel (bytes).
Definition
caches.h:13
DEFAULT_DB_CACHE_BATCH
static constexpr size_t DEFAULT_DB_CACHE_BATCH
Default LevelDB write batch size.
Definition
caches.h:15
MAX_COINS_DB_CACHE
static constexpr size_t MAX_COINS_DB_CACHE
Max memory allocated to coin DB specific cache (bytes).
Definition
caches.h:20
kernel
Definition
coinstatsindex.h:21
CacheSizes::CacheSizes
CacheSizes(size_t total_cache)
Definition
caches.h:28
kernel::CacheSizes::block_tree_db
size_t block_tree_db
Definition
caches.h:24
kernel::CacheSizes::CacheSizes
CacheSizes(size_t total_cache)
Definition
caches.h:28
kernel::CacheSizes::coins
size_t coins
Definition
caches.h:26
kernel::CacheSizes::coins_db
size_t coins_db
Definition
caches.h:25
Generated on
for Bitcoin Core by
1.17.0