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

@ -19,6 +19,7 @@
#pragma once
#include "td/actor/core/Actor.h"
#include "td/actor/core/ActorSignals.h"
#include "td/actor/core/ActorTypeStat.h"
#include "td/actor/core/SchedulerId.h"
#include "td/actor/core/SchedulerContext.h"
#include "td/actor/core/Scheduler.h"
@ -68,7 +69,7 @@ using core::set_debug;
struct Debug {
public:
Debug() = default;
Debug(std::shared_ptr<core::SchedulerGroupInfo> group_info) : group_info_(std::move(group_info)) {
Debug(core::SchedulerGroupInfo *group_info) : group_info_(group_info) {
}
template <class F>
void for_each(F &&f) {
@ -80,18 +81,29 @@ struct Debug {
}
}
void dump() {
for_each([](core::Debug &debug) {
void dump(td::StringBuilder &sb) {
sb << "list of active actors with names:\n";
for_each([&](core::Debug &debug) {
core::DebugInfo info;
debug.read(info);
if (info.is_active) {
LOG(ERROR) << info.name << " " << td::format::as_time(Time::now() - info.start_at);
sb << "\t\"" << info.name << "\" is active for " << Time::now() - info.start_at << "s\n";
}
});
sb << "\nsizes of cpu local queues:\n";
for (auto &scheduler : group_info_->schedulers) {
for (size_t i = 0; i < scheduler.cpu_threads_count; i++) {
auto size = scheduler.cpu_local_queue[i].size();
if (size != 0) {
sb << "\tcpu#" << i << " queue.size() = " << size << "\n";
}
}
}
sb << "\n";
}
private:
std::shared_ptr<core::SchedulerGroupInfo> group_info_;
core::SchedulerGroupInfo *group_info_;
};
class Scheduler {
@ -142,7 +154,7 @@ class Scheduler {
}
Debug get_debug() {
return Debug{group_info_};
return Debug{group_info_.get()};
}
bool run() {
@ -200,6 +212,10 @@ class Scheduler {
}
};
using core::ActorTypeStat;
using core::ActorTypeStatManager;
using core::ActorTypeStats;
// Some helper functions. Not part of public interface and not part
// of namespace core
namespace detail {
@ -324,7 +340,7 @@ void send_closure_impl(ActorRef actor_ref, ClosureT &&closure) {
}
template <class... ArgsT>
void send_closure(ActorRef actor_ref, ArgsT &&... args) {
void send_closure(ActorRef actor_ref, ArgsT &&...args) {
send_closure_impl(actor_ref, create_immediate_closure(std::forward<ArgsT>(args)...));
}
@ -365,7 +381,7 @@ void send_closure_with_promise_later(ActorRef actor_ref, ClosureT &&closure, Pro
}
template <class... ArgsT>
void send_closure_later(ActorRef actor_ref, ArgsT &&... args) {
void send_closure_later(ActorRef actor_ref, ArgsT &&...args) {
send_closure_later_impl(actor_ref, create_delayed_closure(std::forward<ArgsT>(args)...));
}
@ -396,15 +412,17 @@ inline void send_signals_later(ActorRef actor_ref, ActorSignals signals) {
inline void register_actor_info_ptr(core::ActorInfoPtr actor_info_ptr) {
auto state = actor_info_ptr->state().get_flags_unsafe();
actor_info_ptr->on_add_to_queue();
core::SchedulerContext::get()->add_to_queue(std::move(actor_info_ptr), state.get_scheduler_id(), !state.is_shared());
}
template <class T, class... ArgsT>
core::ActorInfoPtr create_actor(core::ActorOptions &options, ArgsT &&... args) noexcept {
core::ActorInfoPtr create_actor(core::ActorOptions &options, ArgsT &&...args) noexcept {
auto *scheduler_context = core::SchedulerContext::get();
if (!options.has_scheduler()) {
options.on_scheduler(scheduler_context->get_scheduler_id());
}
options.with_actor_stat_id(core::ActorTypeStatImpl::get_unique_id<T>());
auto res =
scheduler_context->get_actor_info_creator().create(std::make_unique<T>(std::forward<ArgsT>(args)...), options);
register_actor_info_ptr(res);