Merged in AdditionalTracing-MinimumInterval (pull request #191)
RTM: cut down on tracing load by supplying a minimum interval
This commit is contained in:
commit
b2f3d093d2
7 files changed
+52
-20
No files matched your search
@@ -298,7 +298,7 @@ void ExecutionGateway::dispatch_incoming_fix_messages() {
|
||||
|
||||
void ExecutionGateway::send_fix(jetfix::OutFIXPtr const &fix,
|
||||
trace::CorID trace) {
|
||||
trace::ScopedPerfLogEntry scoped_log (me->perf_log,trace,"ExecutionGateway::send_fix");
|
||||
auto scoped_log = trace::log_scope(me->perf_log,trace,"ExecutionGateway::send_fix");
|
||||
me->gw.send(fix,trace);
|
||||
me->gw.dispatch_events();
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor {
|
||||
private:
|
||||
void on_poll(trace::PerfLog& log) override {
|
||||
|
||||
auto scoped_do_work = trace::log_scope(log, {}, "MDSource::on_poll");
|
||||
auto scoped_do_work = trace::log_scope(log, {}, "MDSource::on_poll", utils::TimeStamp::Interval::from_microseconds(2));
|
||||
|
||||
// Book Updates
|
||||
Book book;
|
||||
|
||||
@@ -458,7 +458,7 @@ void OrderManager::reload_fix_buffer(SessionServicesData &osd) {
|
||||
}
|
||||
|
||||
void OrderManager::on_poll(trace::PerfLog& log) {
|
||||
auto scoped_do_work = trace::log_scope(log, {}, "OrderManager::dispatch_incoming_fix_messages");
|
||||
auto scoped_do_work = trace::log_scope(log, {}, "OrderManager::dispatch_incoming_fix_messages", utils::TimeStamp::Interval::from_microseconds(2));
|
||||
for (auto &osd : me->services_data.sessions)
|
||||
osd->gw.dispatch_incoming_fix_messages();
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ class OrderServices {
|
||||
uint64_t uint64_1 = 0,
|
||||
const char *txt_1 = "",
|
||||
uint32_t uint32_1 = 0) {
|
||||
return trace::ScopedPerfLogEntry(_data->log, cid, entry_kind, uint64_1,
|
||||
return trace::log_scope(_data->log, cid, entry_kind, uint64_1,
|
||||
txt_1, uint32_1);
|
||||
}
|
||||
|
||||
|
||||
@@ -280,8 +280,6 @@ bool NativeOrder::_on_activate(log::Level reject_level,
|
||||
log::Level transition_level, Price p, Quantity q,
|
||||
bts::orderman::OrderServices &services,
|
||||
trace::CorID const &trace) {
|
||||
auto scoped_log =
|
||||
services.log_scope(trace, "NativeOrder::on_activate", key().value());
|
||||
|
||||
me->state.set_price(p.value());
|
||||
me->state.set_quantity(q.value());
|
||||
@@ -414,12 +412,14 @@ void NativeOrder::warm_up_activate(OrderServicesData &data,
|
||||
void NativeOrder::on_activate(Price p, Quantity q,
|
||||
bts::orderman::OrderServices &services,
|
||||
trace::CorID const &trace) {
|
||||
|
||||
bts_assert(!me->services);
|
||||
me->services = &services;
|
||||
|
||||
switch (me->state.status()) {
|
||||
|
||||
case ORDER_STATUS_INACTIVE:
|
||||
case ORDER_STATUS_INACTIVE: {
|
||||
auto scoped_log =
|
||||
services.log_scope(trace, "NativeOrder::on_activate", key().value());
|
||||
// this is a brand new order
|
||||
if (_on_activate(Warn, Info, p, q, services, trace)) {
|
||||
me->services->queue_fix(*me->session_services,
|
||||
@@ -433,7 +433,7 @@ void NativeOrder::on_activate(Price p, Quantity q,
|
||||
key().value());
|
||||
// early return so we skip the expensive report_state() call
|
||||
return;
|
||||
}
|
||||
}}
|
||||
break;
|
||||
|
||||
// all cases below are for orders recovered from disk
|
||||
|
||||
+35
-11
@@ -85,6 +85,7 @@ class ScopedPerfLogEntry {
|
||||
ScopedPerfLogEntry() : _log(nullptr) { _begin.entry_kind = nullptr; }
|
||||
|
||||
ScopedPerfLogEntry(PerfLog &l, CorID cid, const char *entry_kind,
|
||||
utils::TimeStamp::Interval threshhold,
|
||||
uint64_t uint64_1 = 0, const char *txt_1 = "",
|
||||
uint32_t uint32_1 = 0)
|
||||
: _log(&l), _begin{utils::TimeStamp::now(),
|
||||
@@ -95,24 +96,36 @@ class ScopedPerfLogEntry {
|
||||
pthread_self(),
|
||||
utils::TimeStamp(),
|
||||
cid.sn,
|
||||
uint32_1} {
|
||||
|
||||
if (_begin.entry_kind) {
|
||||
_log->log(_begin);
|
||||
}
|
||||
uint32_1}, _min(threshhold) {
|
||||
if (_min.zero()) {
|
||||
if (_begin.entry_kind) {
|
||||
_log->log(_begin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScopedPerfLogEntry(ScopedPerfLogEntry &&src)
|
||||
: _log(src._log), _begin(src._begin) {
|
||||
: _log(src._log), _begin(src._begin), _min(src._min) {
|
||||
src._begin.entry_kind = nullptr;
|
||||
}
|
||||
|
||||
void finish() {
|
||||
if (_begin.entry_kind) {
|
||||
// _log->log(_begin);
|
||||
_begin.cor_event = _begin.ts;
|
||||
_begin.ts = utils::TimeStamp::now();
|
||||
_log->log(_begin);
|
||||
bool is_trivial = false;
|
||||
auto ts = utils::TimeStamp::now();
|
||||
if (!_min.zero()) {
|
||||
if ((ts - _begin.ts) >= _min) {
|
||||
_log->log(_begin);
|
||||
}
|
||||
else {
|
||||
is_trivial = true;
|
||||
}
|
||||
}
|
||||
if (!is_trivial) {
|
||||
_begin.cor_event = _begin.ts;
|
||||
_begin.ts = ts;
|
||||
_log->log(_begin);
|
||||
}
|
||||
discard();
|
||||
}
|
||||
}
|
||||
@@ -124,6 +137,7 @@ class ScopedPerfLogEntry {
|
||||
private:
|
||||
PerfLog *_log;
|
||||
PerfLogEntry _begin;
|
||||
utils::TimeStamp::Interval _min;
|
||||
}; // ScopedPerfLogEntry
|
||||
|
||||
inline ScopedPerfLogEntry log_scope(PerfLog& log,
|
||||
@@ -131,7 +145,17 @@ inline ScopedPerfLogEntry log_scope(PerfLog& log,
|
||||
uint64_t uint64_1 = 0,
|
||||
const char *txt_1 = "",
|
||||
uint32_t uint32_1 = 0) {
|
||||
return ScopedPerfLogEntry(log, cid, entry_kind, uint64_1,
|
||||
return ScopedPerfLogEntry(log, cid, entry_kind, utils::TimeStamp::Interval::from_microseconds(0), uint64_1,
|
||||
txt_1, uint32_1);
|
||||
}
|
||||
|
||||
inline ScopedPerfLogEntry log_scope(PerfLog& log,
|
||||
trace::CorID cid, const char *entry_kind,
|
||||
utils::TimeStamp::Interval minimum_relavant,
|
||||
uint64_t uint64_1 = 0,
|
||||
const char *txt_1 = "",
|
||||
uint32_t uint32_1 = 0) {
|
||||
return ScopedPerfLogEntry(log, cid, entry_kind, minimum_relavant, uint64_1,
|
||||
txt_1, uint32_1);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
int64_t microseconds() const;
|
||||
int64_t milliseconds() const;
|
||||
int64_t nanoseconds() const;
|
||||
bool zero() const;
|
||||
|
||||
friend class bts::utils::TimeStamp;
|
||||
friend Interval operator-( const TimeStamp& t1, const TimeStamp& t2);
|
||||
@@ -43,6 +44,10 @@ public:
|
||||
}
|
||||
Interval& operator+=(const Interval& other) { _val += other._val; return *this; }
|
||||
Interval& operator-=(const Interval& other) { _val -= other._val; return *this; }
|
||||
bool operator > (const Interval& other) const { return _val > other._val; }
|
||||
bool operator < (const Interval& other) const { return _val < other._val; }
|
||||
bool operator >= (const Interval& other) const { return _val >= other._val; }
|
||||
bool operator <= (const Interval& other) const { return _val <= other._val; }
|
||||
static Interval from_microseconds(uint64_t microseconds);
|
||||
|
||||
private:
|
||||
@@ -137,6 +142,9 @@ inline int64_t TimeStamp::Interval::nanoseconds() const {
|
||||
return _val ;
|
||||
#endif
|
||||
}
|
||||
inline bool TimeStamp::Interval::zero() const {
|
||||
return _val == 0;
|
||||
}
|
||||
|
||||
inline int64_t TimeStamp::Interval::milliseconds() const {
|
||||
return microseconds() / 1000;
|
||||
|
||||
Reference in new issue
Block a user