Skip to content

Commit ea55f49

Browse files
authored
i#7725 Negative time: Allow 4us negative time in drmemtraces (#7853)
Increases the allowed negative time delta from 2us to 4us to handle observed 4us decreases from kernel timestamp anomalies. Updates the unit test. Issue #7725
1 parent 67736ec commit ea55f49

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

clients/drcachesim/tests/raw2trace_unit_tests.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4002,9 +4002,9 @@ test_negative_timestamps(void *drcontext)
40024002
instrlist_t *ilist = instrlist_create(drcontext);
40034003
constexpr uint64_t TIME_A = 100;
40044004
constexpr uint64_t TIME_B = 110;
4005-
constexpr uint64_t TIME_C = 107; // Negative but beyond threshold.
4005+
constexpr uint64_t TIME_C = 105; // Negative but beyond threshold.
40064006
constexpr uint64_t TIME_D = 111;
4007-
constexpr uint64_t TIME_E = 109; // Negative and under threshold.
4007+
constexpr uint64_t TIME_E = 107; // Negative and under threshold.
40084008

40094009
std::vector<offline_entry_t> raw;
40104010
raw.push_back(make_header());

clients/drcachesim/tracer/raw2trace.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ raw2trace_t::process_marker(raw2trace_thread_data_t *tdata,
504504
// If a subclass overrides process_marker() and acts before us, they'll
505505
// see the old one, but the difference is minimal and if it really matters
506506
// they'll have to arrange to run after our code.
507-
constexpr int64 NEGATIVE_TIME_CORRECT_THREHSOLD_US = 2;
507+
constexpr int64 NEGATIVE_TIME_CORRECT_THREHSOLD_US = 4;
508508
if (tdata->last_timestamp_ - stamp <= NEGATIVE_TIME_CORRECT_THREHSOLD_US) {
509509
stamp = tdata->last_timestamp_;
510510
marker_val = static_cast<uintptr_t>(stamp);

0 commit comments

Comments
 (0)