  
      auto can_events = event->event.getCan();
      for (const auto &c : can_events) {
        QString id = QString("%1:%2").arg(c.getSrc()).arg(c.getAddress(), 1, 16);
  
        std::lock_guard lk(lock);
        auto &list = received_msgs[id];
        while (list.size() > settings.can_msg_log_size) {
          list.pop_back();
        }
        CanData &data = list.emplace_front();
        data.ts = current_sec;
        data.dat.append((char *)c.getDat().begin(), c.getDat().size());
  
        data.count = ++counters[id];
        if (double delta = (current_sec - counters_begin_sec); delta > 0) {
 
</s> remove   int prev_row_count = messages.size();
 </s> add  </s> remove     messages = can->messages(msg_id);
  }
  int delta = messages.size() - prev_row_count;
  if (delta > 0) {
    beginInsertRows({}, prev_row_count, messages.size() - 1);
    endInsertRows();
  } else if (delta < 0) {
    beginRemoveRows({}, messages.size(), prev_row_count - 1);
    endRemoveRows();
 </s> add     uint64_t last_mono_time = messages.empty() ? 0 : messages.front().mono_time;
    auto new_msgs = fetchData(last_mono_time, (can->currentSec() + can->routeStartTime()) * 1e9);
    if ((has_more_data = !new_msgs.empty())) {
      beginInsertRows({}, 0, new_msgs.size() - 1);
      messages.insert(messages.begin(), std::move_iterator(new_msgs.begin()), std::move_iterator(new_msgs.end()));
      endInsertRows();
    } </s> remove     if (!new_msgs) {
      new_msgs.reset(new QHash<QString, CanData>);
      new_msgs->reserve(1000);
    }

 </s> add 
      CanData &data = (*new_msgs)[id];
  
      auto can_events = event->event.getCan();
      for (const auto &c : can_events) {
        QString id = QString("%1:%2").arg(c.getSrc()).arg(c.getAddress(), 1, 16);
      CanData &data = (*new_msgs)[id];
      CanData &data = (*new_msgs)[id];
      CanData &data = (*new_msgs)[id];
      CanData &data = (*new_msgs)[id];
      CanData &data = (*new_msgs)[id];
      CanData &data = (*new_msgs)[id];
      CanData &data = (*new_msgs)[id];
        data.ts = current_sec;
        data.dat.append((char *)c.getDat().begin(), c.getDat().size());
  
        data.count = ++counters[id];
        if (double delta = (current_sec - counters_begin_sec); delta > 0) {
keep keep keep keep replace replace replace replace replace replace replace keep keep keep keep keep
 Cabana: display all logs in log view (#26659)

* fetch more

* clear log in showevent

* fix wrong time value

* check list size

* fix canmessages::process

* cache all events

* improve segment cache

* cleanup 
tools/cabana/canmessages.cc