@@ -1710,12 +1710,12 @@ bool Transaction::run_precompiled_contract(const ComputePhaseConfig& cfg, precom
17101710 ComputePhase& cp = *compute_phase;
17111711 CHECK (cp.precompiled_gas_usage );
17121712 td::uint64 gas_usage = cp.precompiled_gas_usage .value ();
1713- td::Timer timer;
1713+ td::RealCpuTimer timer;
17141714 auto result =
17151715 impl.run (my_addr, now, start_lt, balance, new_data, *in_msg_body, in_msg, msg_balance_remaining, in_msg_extern,
17161716 compute_vm_libraries (cfg), cfg.global_version , cfg.max_vm_data_depth , new_code,
17171717 cfg.unpacked_config_tuple , due_payment.not_null () ? due_payment : td::zero_refint (), gas_usage);
1718- double elapsed = timer.elapsed ();
1718+ time_tvm = timer.elapsed_both ();
17191719 cp.vm_init_state_hash = td::Bits256::zero ();
17201720 cp.exit_code = result.exit_code ;
17211721 cp.out_of_gas = false ;
@@ -1726,15 +1726,15 @@ bool Transaction::run_precompiled_contract(const ComputePhaseConfig& cfg, precom
17261726 cp.success = (cp.accepted && result.committed );
17271727 LOG (INFO) << " Running precompiled smart contract " << impl.get_name () << " : exit_code=" << result.exit_code
17281728 << " accepted=" << result.accepted << " success=" << cp.success << " gas_used=" << gas_usage
1729- << " time=" << elapsed << " s" ;
1729+ << " time=" << time_tvm. real << " s cpu_time= " << time_tvm. cpu ;
17301730 if (cp.accepted & use_msg_state) {
17311731 was_activated = true ;
17321732 acc_status = Account::acc_active;
17331733 }
17341734 if (cfg.with_vm_log ) {
17351735 cp.vm_log = PSTRING () << " Running precompiled smart contract " << impl.get_name ()
17361736 << " : exit_code=" << result.exit_code << " accepted=" << result.accepted
1737- << " success=" << cp.success << " gas_used=" << gas_usage << " time=" << elapsed << " s" ;
1737+ << " success=" << cp.success << " gas_used=" << gas_usage << " time=" << time_tvm. real << " s" ;
17381738 }
17391739 if (cp.success ) {
17401740 cp.new_data = impl.get_c4 ();
@@ -1943,9 +1943,9 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
19431943
19441944 LOG (DEBUG) << " starting VM" ;
19451945 cp.vm_init_state_hash = vm.get_state_hash ();
1946- td::Timer timer;
1946+ td::RealCpuTimer timer;
19471947 cp.exit_code = ~vm.run ();
1948- double elapsed = timer.elapsed ();
1948+ time_tvm = timer.elapsed_both ();
19491949 LOG (DEBUG) << " VM terminated with exit code " << cp.exit_code ;
19501950 cp.out_of_gas = (cp.exit_code == ~(int )vm::Excno::out_of_gas);
19511951 cp.vm_final_state_hash = vm.get_final_state_hash (cp.exit_code );
@@ -1971,7 +1971,7 @@ bool Transaction::prepare_compute_phase(const ComputePhaseConfig& cfg) {
19711971 LOG (INFO) << " steps: " << vm.get_steps_count () << " gas: used=" << gas.gas_consumed () << " , max=" << gas.gas_max
19721972 << " , limit=" << gas.gas_limit << " , credit=" << gas.gas_credit ;
19731973 LOG (INFO) << " out_of_gas=" << cp.out_of_gas << " , accepted=" << cp.accepted << " , success=" << cp.success
1974- << " , time=" << elapsed << " s" ;
1974+ << " , time=" << time_tvm. real << " s, cpu_time= " << time_tvm. cpu ;
19751975 if (logger != nullptr ) {
19761976 cp.vm_log = logger->get_log ();
19771977 }
@@ -3196,7 +3196,13 @@ td::Status Transaction::check_state_limits(const SizeLimitsConfig& size_limits,
31963196 }
31973197 {
31983198 TD_PERF_COUNTER (transaction_storage_stat_a);
3199- td::Timer timer;
3199+ td::RealCpuTimer timer;
3200+ SCOPE_EXIT {
3201+ LOG_IF (INFO, timer.elapsed_real () > 0.1 ) << " Compute used storage (1) took " << timer.elapsed_real () << " s" ;
3202+ if (is_account_stat) {
3203+ time_storage_stat += timer.elapsed_both ();
3204+ }
3205+ };
32003206 if (is_account_stat && compute_phase) {
32013207 storage_stat.add_hint (compute_phase->vm_loaded_cells );
32023208 }
@@ -3208,9 +3214,6 @@ td::Status Transaction::check_state_limits(const SizeLimitsConfig& size_limits,
32083214 storage_stat_updates.push_back (new_library);
32093215 }
32103216 TRY_STATUS (storage_stat.replace_roots ({new_code, new_data, new_library}, /* check_merkle_depth = */ true ));
3211- if (timer.elapsed () > 0.1 ) {
3212- LOG (INFO) << " Compute used storage (1) took " << timer.elapsed () << " s" ;
3213- }
32143217 }
32153218
32163219 if (storage_stat.get_total_cells () > size_limits.max_acc_state_cells ||
@@ -3511,9 +3514,11 @@ bool Transaction::compute_state(const SerializeConfig& cfg) {
35113514 auto roots = new_storage_for_stat->prefetch_all_refs ();
35123515 storage_stat_updates.insert (storage_stat_updates.end (), roots.begin (), roots.end ());
35133516 {
3517+ td::RealCpuTimer timer;
35143518 StorageStatCalculationContext context{true };
35153519 StorageStatCalculationContext::Guard guard{&context};
35163520 td::Status S = stats.replace_roots (roots);
3521+ time_storage_stat += timer.elapsed_both ();
35173522 if (S.is_error ()) {
35183523 LOG (ERROR) << " Cannot recompute storage stats for account " << account.addr .to_hex () << " : " << S.move_as_error ();
35193524 return false ;
0 commit comments