Skip to content

Commit

Permalink
i#6745: Fix timestamp gap in -trace_after_instrs
Browse files Browse the repository at this point in the history
Fixes a timestamp gap between the first and second timestamps in the trace
caused when -trace_after_instrs is used.

Fixes: #6745
  • Loading branch information
abhinav92003 committed Mar 29, 2024
1 parent e698fa3 commit 14e306a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions clients/drcachesim/tracer/instr_counter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ hit_instr_count_threshold(app_pc next_pc)
return;
}
if (op_trace_after_instrs.get_value() > 0 &&
!reached_trace_after_instrs.load(std::memory_order_acquire))
!reached_trace_after_instrs.load(std::memory_order_acquire)) {
NOTIFY(0, "Hit delay threshold: enabling tracing.\n");
else {
retrace_start_timestamp.store(instru_t::get_timestamp());
} else {
NOTIFY(0, "Hit retrace threshold: enabling tracing for window #%zd.\n",
tracing_window.load(std::memory_order_acquire));
retrace_start_timestamp.store(instru_t::get_timestamp());
Expand Down
2 changes: 1 addition & 1 deletion clients/drcachesim/tracer/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ process_and_output_buffer(void *drcontext, bool skip_size_cap)
instru->clamp_unit_header_timestamp(data->buf_base + stamp_offs, min_timestamp);
}

if (has_tracing_windows()) {
if (has_tracing_windows() || op_trace_after_instrs.get_value() > 0) {
min_timestamp = retrace_start_timestamp.load(std::memory_order_acquire);
instru->clamp_unit_header_timestamp(data->buf_base + stamp_offs, min_timestamp);
}
Expand Down

0 comments on commit 14e306a

Please sign in to comment.