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

getactorstats query for validator-engine-console

This commit is contained in:
birydrad 2024-09-03 11:24:59 +02:00
parent e55c132178
commit 420029b056
39 changed files with 1223 additions and 51 deletions

View file

@ -142,6 +142,7 @@ void CellDbIn::load_cell(RootHash hash, td::Promise<td::Ref<vm::DataCell>> promi
}
void CellDbIn::store_cell(BlockIdExt block_id, td::Ref<vm::Cell> cell, td::Promise<td::Ref<vm::DataCell>> promise) {
TD_PERF_COUNTER(celldb_store_cell);
td::PerfWarningTimer timer{"storecell", 0.1};
auto key_hash = get_key_hash(block_id);
auto R = get_block(key_hash);
@ -284,6 +285,7 @@ void CellDbIn::gc_cont(BlockHandle handle) {
}
void CellDbIn::gc_cont2(BlockHandle handle) {
TD_PERF_COUNTER(celldb_gc_cell);
td::PerfWarningTimer timer{"gccell", 0.1};
auto key_hash = get_key_hash(handle->id());

View file

@ -230,6 +230,7 @@ void WaitBlockState::got_block_data(td::Ref<BlockData> data) {
}
void WaitBlockState::apply() {
TD_PERF_COUNTER(apply_block_to_state);
td::PerfWarningTimer t{"applyblocktostate", 0.1};
auto S = prev_state_.write().apply_block(handle_->id(), block_);
if (S.is_error()) {

View file

@ -290,6 +290,7 @@ td::Result<std::pair<td::Ref<ShardState>, td::Ref<ShardState>>> ShardStateQ::spl
}
td::Result<td::BufferSlice> ShardStateQ::serialize() const {
TD_PERF_COUNTER(serialize_state);
td::PerfWarningTimer perf_timer_{"serializestate", 0.1};
if (!data.is_null()) {
return data.clone();
@ -314,6 +315,7 @@ td::Result<td::BufferSlice> ShardStateQ::serialize() const {
}
td::Status ShardStateQ::serialize_to_file(td::FileFd& fd) const {
TD_PERF_COUNTER(serialize_state_to_file);
td::PerfWarningTimer perf_timer_{"serializestate", 0.1};
if (!data.is_null()) {
auto cur_data = data.clone();

View file

@ -370,6 +370,10 @@ class ValidatorManagerImpl : public ValidatorManager {
UNREACHABLE();
}
void prepare_actor_stats(td::Promise<std::string> promise) override {
UNREACHABLE();
}
void prepare_perf_timer_stats(td::Promise<std::vector<PerfTimerStats>> promise) override {
UNREACHABLE();
}

View file

@ -432,6 +432,10 @@ class ValidatorManagerImpl : public ValidatorManager {
UNREACHABLE();
}
void prepare_actor_stats(td::Promise<std::string> promise) override {
UNREACHABLE();
}
void prepare_perf_timer_stats(td::Promise<std::vector<PerfTimerStats>> promise) override {
UNREACHABLE();
}

View file

@ -1622,6 +1622,7 @@ void ValidatorManagerImpl::send_block_broadcast(BlockBroadcast broadcast, bool c
void ValidatorManagerImpl::start_up() {
db_ = create_db_actor(actor_id(this), db_root_, opts_);
actor_stats_ = td::actor::create_actor<td::actor::ActorStats>("actor_stats");
lite_server_cache_ = create_liteserver_cache_actor(actor_id(this), db_root_);
token_manager_ = td::actor::create_actor<TokenManager>("tokenmanager");
td::mkdir(db_root_ + "/tmp/").ensure();
@ -2771,6 +2772,10 @@ void ValidatorManagerImpl::send_peek_key_block_request() {
send_get_next_key_blocks_request(last_known_key_block_handle_->id(), 1, std::move(P));
}
void ValidatorManagerImpl::prepare_actor_stats(td::Promise<std::string> promise) {
send_closure(actor_stats_, &td::actor::ActorStats::prepare_stats, std::move(promise));
}
void ValidatorManagerImpl::prepare_stats(td::Promise<std::vector<std::pair<std::string, std::string>>> promise) {
auto merger = StatsMerger::create(std::move(promise));

View file

@ -21,6 +21,7 @@
#include "common/refcnt.hpp"
#include "interfaces/validator-manager.h"
#include "interfaces/db.h"
#include "td/actor/ActorStats.h"
#include "td/actor/PromiseFuture.h"
#include "td/utils/SharedSlice.h"
#include "td/utils/buffer.h"
@ -582,6 +583,8 @@ class ValidatorManagerImpl : public ValidatorManager {
void prepare_stats(td::Promise<std::vector<std::pair<std::string, std::string>>> promise) override;
void prepare_actor_stats(td::Promise<std::string> promise) override;
void prepare_perf_timer_stats(td::Promise<std::vector<PerfTimerStats>> promise) override;
void add_perf_timer_stat(std::string name, double duration) override;
@ -678,6 +681,7 @@ class ValidatorManagerImpl : public ValidatorManager {
private:
std::unique_ptr<Callback> callback_;
td::actor::ActorOwn<Db> db_;
td::actor::ActorOwn<td::actor::ActorStats> actor_stats_;
bool started_ = false;
bool allow_validate_ = false;

View file

@ -275,6 +275,7 @@ class ValidatorManagerInterface : public td::actor::Actor {
virtual void run_ext_query(td::BufferSlice data, td::Promise<td::BufferSlice> promise) = 0;
virtual void prepare_stats(td::Promise<std::vector<std::pair<std::string, std::string>>> promise) = 0;
virtual void prepare_actor_stats(td::Promise<std::string> promise) = 0;
virtual void prepare_perf_timer_stats(td::Promise<std::vector<PerfTimerStats>> promise) = 0;
virtual void add_perf_timer_stat(std::string name, double duration) = 0;