Skip to content

Commit 0512333

Browse files
committed
fix: Improve time window handling in traceAnalyzer
* Updated the time window index validation to issue a warning instead of an error when data is not strictly ordered by time. * Adjusted the current time window index and next time window timestamp accordingly to ensure continued processing without interruption.
1 parent 6ab9727 commit 0512333

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

libCacheSim/traceAnalyzer/analyzer.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,16 +108,17 @@ void traceAnalyzer::TraceAnalyzer::run() {
108108
next_time_window_ts += time_window_;
109109
}
110110

111-
if (curr_time_window_idx != time_to_window_idx(req->clock_time)) {
112-
ERROR(
113-
"The data is not ordered by time, please sort the trace first!"
111+
int32_t correct_time_window_idx = time_to_window_idx(req->clock_time);
112+
if (curr_time_window_idx != correct_time_window_idx) {
113+
WARN_ONCE(
114+
"The data is not strictly ordered by time; continuing anyway. "
114115
"Current time %ld requested object %lu, obj size %lu\n",
115116
(long)(req->clock_time + start_ts_), (unsigned long)req->obj_id,
116117
(long)req->obj_size);
118+
curr_time_window_idx = correct_time_window_idx;
119+
next_time_window_ts = (curr_time_window_idx + 1) * time_window_;
117120
}
118121

119-
DEBUG_ASSERT(curr_time_window_idx == time_to_window_idx(req->clock_time));
120-
121122
n_req_ += 1;
122123
sum_obj_size_req += req->obj_size;
123124

0 commit comments

Comments
 (0)