1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

celldb in-memory mode, stats for actors, perf counters, minor fix in rldp2 (#1164)

* getactorstats query for validator-engine-console

* celldb in-memory mode (--celldb-in-memory option)

* rldp2: bugfix - do not estimate speed while nothing is sent

* add simple ed25519 benchmark

* fix compilation errors of different platforms and move to c++20

* fix some warnings

* turn on TON_USE_ABSEIL for glibc 2.27 nix build

---------

Co-authored-by: birydrad <>
This commit is contained in:
birydrad 2024-09-23 16:34:37 +02:00 committed by GitHub
parent 5f51d3d04f
commit 72020c04c4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
100 changed files with 3407 additions and 359 deletions

View file

@ -23,6 +23,11 @@
#include "td/utils/Status.h"
#include "td/actor/PromiseFuture.h"
#include <thread>
namespace td {
class KeyValueReader;
}
namespace vm {
class CellLoader;
class CellStorer;
@ -45,12 +50,20 @@ class DynamicBagOfCellsDb {
public:
virtual ~DynamicBagOfCellsDb() = default;
virtual td::Result<Ref<DataCell>> load_cell(td::Slice hash) = 0;
virtual td::Result<Ref<DataCell>> load_root(td::Slice hash) = 0;
virtual td::Result<Ref<DataCell>> load_root_thread_safe(td::Slice hash) const = 0;
struct Stats {
td::int64 roots_total_count{0};
td::int64 cells_total_count{0};
td::int64 cells_total_size{0};
void apply_diff(Stats diff) {
std::vector<std::pair<std::string, std::string>> custom_stats;
void apply_diff(const Stats &diff) {
roots_total_count += diff.roots_total_count;
cells_total_count += diff.cells_total_count;
cells_total_size += diff.cells_total_size;
CHECK(roots_total_count >= 0);
CHECK(cells_total_count >= 0);
CHECK(cells_total_size >= 0);
}
};
virtual void inc(const Ref<Cell> &old_root) = 0;
@ -58,6 +71,9 @@ class DynamicBagOfCellsDb {
virtual td::Status prepare_commit() = 0;
virtual Stats get_stats_diff() = 0;
virtual td::Result<Stats> get_stats() {
return td::Status::Error("Not implemented");
}
virtual td::Status commit(CellStorer &) = 0;
virtual std::shared_ptr<CellDbReader> get_cell_db_reader() = 0;
@ -65,13 +81,24 @@ class DynamicBagOfCellsDb {
virtual td::Status set_loader(std::unique_ptr<CellLoader> loader) = 0;
virtual void set_celldb_compress_depth(td::uint32 value) = 0;
virtual vm::ExtCellCreator& as_ext_cell_creator() = 0;
virtual vm::ExtCellCreator &as_ext_cell_creator() = 0;
static std::unique_ptr<DynamicBagOfCellsDb> create();
struct CreateInMemoryOptions {
size_t extra_threads{std::thread::hardware_concurrency()};
bool verbose{true};
// Allocated DataCels will never be deleted
bool use_arena{false};
// Almost no overhead in memory during creation, but will scan database twice
bool use_less_memory_during_creation{true};
};
static std::unique_ptr<DynamicBagOfCellsDb> create_in_memory(td::KeyValueReader *kv, CreateInMemoryOptions options);
class AsyncExecutor {
public:
virtual ~AsyncExecutor() {}
virtual ~AsyncExecutor() {
}
virtual void execute_async(std::function<void()> f) = 0;
virtual void execute_sync(std::function<void()> f) = 0;
};