12 #include "../../clock.hpp" 19 const uavcan::dynamic_node_id_server::TraceCode
code;
24 , argument(arg_argument)
28 const std::string
id_;
45 std::cout <<
"EVENT [" << id_ <<
"]\t" << ts.
toString() <<
"\t" 46 <<
int(code) <<
"\t" << getEventName(code) <<
"\t" << argument << std::endl;
53 for (std::list<EventLogEntry>::const_iterator it = event_log_.begin(); it != event_log_.end(); ++it)
55 count += (it->code ==
code) ? 1U : 0U;
62 for (std::list<EventLogEntry>::const_reverse_iterator it = event_log_.rbegin(); it != event_log_.rend(); ++it)
70 std::cout <<
"No such event in the event log, code " <<
int(code) <<
", log length " << event_log_.size()
73 throw std::runtime_error(
"EventTracer::getLastEventArgumentOrFail()");
76 unsigned getNumEvents()
const {
return static_cast<unsigned>(event_log_.size()); }
virtual void onEvent(uavcan::dynamic_node_id_server::TraceCode code, uavcan::int64_t argument)
virtual uavcan::MonotonicTime getMonotonic() const
unsigned countEvents(const uavcan::dynamic_node_id_server::TraceCode code) const
const uavcan::dynamic_node_id_server::TraceCode code
uavcan::MonotonicTime getMonotonic()
void toString(char buf[StringBufSize]) const
Prints time in seconds with microsecond resolution.
EventLogEntry(uavcan::dynamic_node_id_server::TraceCode arg_code, uavcan::int64_t arg_argument)
uavcan::int64_t getLastEventArgumentOrFail(const uavcan::dynamic_node_id_server::TraceCode code) const
const uavcan::MonotonicTime startup_ts_
unsigned getNumEvents() const
const uavcan::int64_t argument
std::list< EventLogEntry > event_log_
EventTracer(const std::string &id)