mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
Merge branch 'testnet' into block-generation
# Conflicts: # overlay/overlay-fec-broadcast.cpp # overlay/overlay.hpp # tl/generate/scheme/ton_api.tl # tl/generate/scheme/ton_api.tlo # validator-engine-console/validator-engine-console-query.cpp # validator-engine-console/validator-engine-console-query.h # validator-engine-console/validator-engine-console.cpp # validator-engine/validator-engine.cpp # validator-engine/validator-engine.hpp # validator/downloaders/wait-block-state.hpp # validator/impl/validate-query.cpp # validator/validator.h
This commit is contained in:
commit
636348ffc2
110 changed files with 3822 additions and 696 deletions
|
|
@ -60,12 +60,12 @@ StringBuilder &operator<<(StringBuilder &string_builder, const Timer &timer) {
|
|||
return string_builder << format::as_time(timer.elapsed());
|
||||
}
|
||||
|
||||
PerfWarningTimer::PerfWarningTimer(string name, double max_duration)
|
||||
: name_(std::move(name)), start_at_(Time::now()), max_duration_(max_duration) {
|
||||
PerfWarningTimer::PerfWarningTimer(string name, double max_duration, std::function<void(double)>&& callback)
|
||||
: name_(std::move(name)), start_at_(Time::now()), max_duration_(max_duration), callback_(std::move(callback)) {
|
||||
}
|
||||
|
||||
PerfWarningTimer::PerfWarningTimer(PerfWarningTimer &&other)
|
||||
: name_(std::move(other.name_)), start_at_(other.start_at_), max_duration_(other.max_duration_) {
|
||||
: name_(std::move(other.name_)), start_at_(other.start_at_), max_duration_(other.max_duration_), callback_(std::move(other.callback_)) {
|
||||
other.start_at_ = 0;
|
||||
}
|
||||
|
||||
|
|
@ -78,8 +78,9 @@ void PerfWarningTimer::reset() {
|
|||
return;
|
||||
}
|
||||
double duration = Time::now() - start_at_;
|
||||
LOG_IF(WARNING, duration > max_duration_)
|
||||
<< "SLOW: " << tag("name", name_) << tag("duration", format::as_time(duration));
|
||||
//LOG_IF(WARNING, duration > max_duration_)
|
||||
//<< "SLOW: " << tag("name", name_) << tag("duration", format::as_time(duration));
|
||||
callback_(duration);
|
||||
start_at_ = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "td/utils/StringBuilder.h"
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace td {
|
||||
|
||||
class Timer {
|
||||
|
|
@ -44,7 +46,7 @@ class Timer {
|
|||
|
||||
class PerfWarningTimer {
|
||||
public:
|
||||
explicit PerfWarningTimer(string name, double max_duration = 0.1);
|
||||
explicit PerfWarningTimer(string name, double max_duration = 0.1, std::function<void(double)>&& callback = [] (double) {});
|
||||
PerfWarningTimer(const PerfWarningTimer &) = delete;
|
||||
PerfWarningTimer &operator=(const PerfWarningTimer &) = delete;
|
||||
PerfWarningTimer(PerfWarningTimer &&other);
|
||||
|
|
@ -56,6 +58,7 @@ class PerfWarningTimer {
|
|||
string name_;
|
||||
double start_at_{0};
|
||||
double max_duration_{0};
|
||||
std::function<void(double)> callback_;
|
||||
};
|
||||
|
||||
} // namespace td
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#define TD_EVENTFD_BSD 1
|
||||
#elif TD_EMSCRIPTEN
|
||||
#define TD_POLL_POLL 1
|
||||
#define TD_EVENTFD_UNSUPPORTED 1
|
||||
// #define TD_EVENTFD_UNSUPPORTED 1
|
||||
#elif TD_DARWIN
|
||||
#define TD_POLL_KQUEUE 1
|
||||
#define TD_EVENTFD_BSD 1
|
||||
|
|
@ -51,7 +51,11 @@
|
|||
#endif
|
||||
|
||||
#if TD_EMSCRIPTEN
|
||||
#define TD_THREAD_UNSUPPORTED 1
|
||||
// #define TD_THREAD_UNSUPPORTED 1
|
||||
#define TD_POLL_EPOLL 1
|
||||
#define TD_EVENTFD_UNSUPPORTED 0
|
||||
#define TD_THREAD_PTHREAD 1
|
||||
#define TD_EVENTFD_LINUX 1
|
||||
#elif TD_TIZEN || TD_LINUX || TD_DARWIN
|
||||
#define TD_THREAD_PTHREAD 1
|
||||
#else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue