From fdf255a7a3922cffa2f35915455e4622eca0ee26 Mon Sep 17 00:00:00 2001 From: Pedro Pinto Date: Tue, 29 Jan 2019 14:58:13 -0500 Subject: [PATCH] Improved md performance logs. --- src/lib/orderman/actors/MDSource.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/lib/orderman/actors/MDSource.h b/src/lib/orderman/actors/MDSource.h index 60abc6990..a92b795fb 100644 --- a/src/lib/orderman/actors/MDSource.h +++ b/src/lib/orderman/actors/MDSource.h @@ -14,6 +14,7 @@ #include "lib/tracing/PerfLog.h" #include "lib/tracing/bts_trace.h" #include "lib/utils/TimeStamp.h" +#include "lib/domain_model/Security.h" #include @@ -107,6 +108,8 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { book._security_key = SecurityKey(handle.key()); trace::CorID trace{h.external_event_channel, handle.sequence()}; _perf_log.log(trace, h.last, "md", handle.key()); + _perf_log.log(trace, "md_r", h.last, h.symbol->c_str(), + handle.key()); publish(_book_update, book, trace); } } @@ -123,7 +126,7 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { if (trade.key() == per_sec_ev.key().value()) { trade_count++; per_sec_ev.trades.emplace_back(TickerUpdateEvent::Trade{ - datetime::utc_ll_to_timepoint(trade.time()), + datetime::utc_ll_to_timepoint(trade.time()), Price(md::IntPrice(trade.mantissa(), (int8_t)trade.exponent()) .price()), @@ -162,7 +165,9 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { auto handle = _md_consumer.get_handle(k); _handles.push_back({utils::TimeStamp(), handle, - get_external_event_channel(handle.get_usersymbol())}); + get_external_event_channel(handle.get_usersymbol()), + std::make_unique(securities::descriptor( + handle.get_normalized_security()))}); if (handle.is_synthetic()) synthetic_count_metric.increment(); } @@ -203,10 +208,11 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { "key: {}", user_symbol.to_string(), sk.value()); -// We do not want to get old trades so we drain the trades buffer at -// this point. This makes the first subscription to a channel -// consistent with subsquent ones in terms of late join semantics. - ChannelRecord c {0, _md_consumer.get_channel(user_symbol), {}, user_symbol} ; + // We do not want to get old trades so we drain the trades buffer at + // this point. This makes the first subscription to a channel + // consistent with subsquent ones in terms of late join semantics. + ChannelRecord c{ + 0, _md_consumer.get_channel(user_symbol), {}, user_symbol}; _trades_buffer.Clear(); c.cursor = c.channel.read_trades(_trades_buffer, c.cursor); c.securities.push_back(sk); @@ -216,6 +222,7 @@ class MDSource : public mercury::Actor, public mercury::IPollableActor { utils::TimeStamp last; md::MDConsumerHandle handle; const char *external_event_channel; + std::unique_ptr symbol; }; boost::container::small_vector _handles;