replay: Improve the performance of the log parser (#28495)

old-commit-hash: 3a3e38e425
beeps
Dean Lee 2 years ago committed by GitHub
parent 22882d740c
commit 5ea1a3f778
  1. 14
      tools/replay/logreader.cc

@ -68,20 +68,16 @@ bool LogReader::parse(const std::set<cereal::Event::Which> &allow, std::atomic<b
try { try {
kj::ArrayPtr<const capnp::word> words((const capnp::word *)raw_.data(), raw_.size() / sizeof(capnp::word)); kj::ArrayPtr<const capnp::word> words((const capnp::word *)raw_.data(), raw_.size() / sizeof(capnp::word));
while (words.size() > 0 && !(abort && *abort)) { while (words.size() > 0 && !(abort && *abort)) {
if (!allow.empty()) {
capnp::FlatArrayMessageReader reader(words);
auto which = reader.getRoot<cereal::Event>().which();
if (allow.find(which) == allow.end()) {
words = kj::arrayPtr(reader.getEnd(), words.end());
continue;
}
}
#ifdef HAS_MEMORY_RESOURCE #ifdef HAS_MEMORY_RESOURCE
Event *evt = new (mbr_) Event(words); Event *evt = new (mbr_) Event(words);
#else #else
Event *evt = new Event(words); Event *evt = new Event(words);
#endif #endif
if (!allow.empty() && allow.find(evt->which) == allow.end()) {
delete evt;
words = kj::arrayPtr(evt->reader.getEnd(), words.end());
continue;
}
// Add encodeIdx packet again as a frame packet for the video stream // Add encodeIdx packet again as a frame packet for the video stream
if (evt->which == cereal::Event::ROAD_ENCODE_IDX || if (evt->which == cereal::Event::ROAD_ENCODE_IDX ||

Loading…
Cancel
Save