Improved md performance logs.

This commit is contained in:
Pedro Pinto committed 2019-01-29 14:58:13 -05:00
1 parent 995be6cfd0
commit fdf255a7a3
1 file changed
+13 -6
+13 -6
View File
@@ -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 <date/date.h>
@@ -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<std::string>(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<std::string> symbol;
};
boost::container::small_vector<HandleRecord, 100> _handles;