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

Add GetPerfTimerStats (#451)

* Add getperfwarningtimeraverage query for validator-engine-console

* Fix for getperfwarningtimeraverage query

* getperftimerstats

* Add history max size: 1 hour

* PerfWarningTimer: move callback instead of copy

* PerfWarningTimer: fix move constructor bug

* PerfWarningTimer: fix bug: lifetime of the callback was greater than lifetime of the local variable 'manager' captured by reference

* Fix validate-query.cpp: 'manager' used after it was moved

* PerfWarningTimer: remove logs

* getperftimerstats: write to json file

* getperftimerstatsjson

Co-authored-by: legaii <jgates.ardux@gmail.com>
Co-authored-by: Ivan Siomash <106972486+legaii@users.noreply.github.com>
This commit is contained in:
EmelyanenkoK 2022-09-10 12:57:13 +03:00 committed by GitHub
parent 8376c289d7
commit 8329a58994
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 244 additions and 27 deletions

View file

@ -53,7 +53,10 @@ AcceptBlockQuery::AcceptBlockQuery(BlockIdExt id, td::Ref<BlockData> data, std::
, is_fork_(false)
, send_broadcast_(send_broadcast)
, manager_(manager)
, promise_(std::move(promise)) {
, promise_(std::move(promise))
, perf_timer_("acceptblock", 0.1, [manager](double duration) {
send_closure(manager, &ValidatorManager::add_perf_timer_stat, "acceptblock", duration);
}) {
state_keep_old_hash_.clear();
state_old_hash_.clear();
state_hash_.clear();
@ -71,7 +74,10 @@ AcceptBlockQuery::AcceptBlockQuery(AcceptBlockQuery::IsFake fake, BlockIdExt id,
, is_fork_(false)
, send_broadcast_(false)
, manager_(manager)
, promise_(std::move(promise)) {
, promise_(std::move(promise))
, perf_timer_("acceptblock", 0.1, [manager](double duration) {
send_closure(manager, &ValidatorManager::add_perf_timer_stat, "acceptblock", duration);
}) {
state_keep_old_hash_.clear();
state_old_hash_.clear();
state_hash_.clear();
@ -86,7 +92,10 @@ AcceptBlockQuery::AcceptBlockQuery(ForceFork ffork, BlockIdExt id, td::Ref<Block
, is_fork_(true)
, send_broadcast_(false)
, manager_(manager)
, promise_(std::move(promise)) {
, promise_(std::move(promise))
, perf_timer_("acceptblock", 0.1, [manager](double duration) {
send_closure(manager, &ValidatorManager::add_perf_timer_stat, "acceptblock", duration);
}) {
state_keep_old_hash_.clear();
state_old_hash_.clear();
state_hash_.clear();

View file

@ -126,7 +126,7 @@ class AcceptBlockQuery : public td::actor::Actor {
td::BufferSlice top_block_descr_data_;
Ref<ShardTopBlockDescription> top_block_descr_;
td::PerfWarningTimer perf_timer_{"acceptblock", 0.1};
td::PerfWarningTimer perf_timer_;
bool fatal_error(std::string msg, int code = -666);
static bool check_send_error(td::actor::ActorId<AcceptBlockQuery> SelfId, td::Status error);

View file

@ -47,7 +47,10 @@ class CheckProof : public td::actor::Actor {
, manager_(manager)
, timeout_(timeout)
, promise_(std::move(promise))
, skip_check_signatures_(skip_check_signatures) {
, skip_check_signatures_(skip_check_signatures)
, perf_timer_("checkproof", 0.1, [manager](double duration) {
send_closure(manager, &ValidatorManager::add_perf_timer_stat, "checkproof", duration);
}) {
}
CheckProof(BlockIdExt id, td::Ref<Proof> proof, td::actor::ActorId<ValidatorManager> manager, td::Timestamp timeout,
td::Promise<BlockHandle> promise, bool skip_check_signatures, td::Ref<MasterchainState> known_state)
@ -58,7 +61,10 @@ class CheckProof : public td::actor::Actor {
, timeout_(timeout)
, promise_(std::move(promise))
, state_(std::move(known_state))
, skip_check_signatures_(skip_check_signatures) {
, skip_check_signatures_(skip_check_signatures)
, perf_timer_("checkproof", 0.1, [manager](double duration) {
send_closure(manager, &ValidatorManager::add_perf_timer_stat, "checkproof", duration);
}) {
}
CheckProof(BlockIdExt id, td::Ref<ProofLink> proof_link, td::actor::ActorId<ValidatorManager> manager,
td::Timestamp timeout, td::Promise<BlockHandle> promise)
@ -67,7 +73,10 @@ class CheckProof : public td::actor::Actor {
, proof_(std::move(proof_link))
, manager_(manager)
, timeout_(timeout)
, promise_(std::move(promise)) {
, promise_(std::move(promise))
, perf_timer_("checkproof", 0.1, [manager](double duration) {
send_closure(manager, &ValidatorManager::add_perf_timer_stat, "checkproof", duration);
}) {
}
private:
@ -114,7 +123,7 @@ class CheckProof : public td::actor::Actor {
bool skip_check_signatures_{false};
bool sig_ok_{false};
td::PerfWarningTimer perf_timer_{"checkproof", 0.1};
td::PerfWarningTimer perf_timer_;
static bool check_send_error(td::actor::ActorId<CheckProof> SelfId, td::Status error);
template <typename T>

View file

@ -208,7 +208,7 @@ class Collator final : public td::actor::Actor {
std::vector<Ref<vm::Cell>> collated_roots_;
std::unique_ptr<ton::BlockCandidate> block_candidate;
td::PerfWarningTimer perf_timer_{"collate", 0.1};
td::PerfWarningTimer perf_timer_;
//
block::Account* lookup_account(td::ConstBitPtr addr) const;
std::unique_ptr<block::Account> make_account_from(td::ConstBitPtr addr, Ref<vm::CellSlice> account,

View file

@ -67,7 +67,10 @@ Collator::Collator(ShardIdFull shard, bool is_hardfork, UnixTime min_ts, BlockId
, validator_set_(std::move(validator_set))
, manager(manager)
, timeout(timeout)
, main_promise(std::move(promise)) {
, main_promise(std::move(promise))
, perf_timer_("collate", 0.1, [manager](double duration) {
send_closure(manager, &ValidatorManager::add_perf_timer_stat, "collate", duration);
}) {
}
void Collator::start_up() {

View file

@ -59,12 +59,15 @@ ValidateQuery::ValidateQuery(ShardIdFull shard, UnixTime min_ts, BlockIdExt min_
, prev_blocks(std::move(prev))
, block_candidate(std::move(candidate))
, validator_set_(std::move(validator_set))
, manager(std::move(manager))
, manager(manager)
, timeout(timeout)
, main_promise(std::move(promise))
, is_fake_(is_fake)
, shard_pfx_(shard_.shard)
, shard_pfx_len_(ton::shard_prefix_length(shard_)) {
, shard_pfx_len_(ton::shard_prefix_length(shard_))
, perf_timer_("validateblock", 0.1, [manager](double duration) {
send_closure(manager, &ValidatorManager::add_perf_timer_stat, "validateblock", duration);
}) {
proc_hash_.zero();
}

View file

@ -228,7 +228,7 @@ class ValidateQuery : public td::actor::Actor {
std::vector<std::tuple<Bits256, Bits256, bool>> lib_publishers_, lib_publishers2_;
td::PerfWarningTimer perf_timer_{"validateblock", 0.1};
td::PerfWarningTimer perf_timer_;
static constexpr td::uint32 priority() {
return 2;