Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#6745: Fix timestamp gap in delayed tracing #6746

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

abhinav92003
Copy link
Contributor

@abhinav92003 abhinav92003 commented Mar 29, 2024

Fixes a timestamp gap between the first and second timestamps in the trace caused when -trace_after_instrs is used.

Adds a unit test that reuses the existing window_test.cpp to reproduce the bug and fails without the fix.

Fixes: #6745

Fixes a timestamp gap between the first and second timestamps in the trace
caused when -trace_after_instrs is used.

Fixes: #6745
@abhinav92003 abhinav92003 marked this pull request as draft March 29, 2024 20:10
@abhinav92003
Copy link
Contributor Author

Using manual runs verified that the diff between the first and second timestamps is much reduced:

$ grep timestamp /tmp/view_before.txt | head -n 5
           6           0:     1966582 <marker: timestamp 13356217102311828>
       12485        9005:     1966582 <marker: timestamp 13356217103778957>
       12487        9005:     1966582 <marker: timestamp 13356217103779295>
       15494       11278:     1966582 <marker: timestamp 13356217103968370>
       15497       11278:     1966582 <marker: timestamp 13356217103968684>
$ grep timestamp /tmp/view_after.txt | head -n 5
           6           0:     1964040 <marker: timestamp 13356217068353707>
       12485        9005:     1964040 <marker: timestamp 13356217068363931>
       12487        9005:     1964040 <marker: timestamp 13356217068364279>
       15494       11278:     1964040 <marker: timestamp 13356217068536871>
       15497       11278:     1964040 <marker: timestamp 13356217068537158>

@abhinav92003 abhinav92003 marked this pull request as ready for review April 1, 2024 19:50
@abhinav92003
Copy link
Contributor Author

@derekbruening I know we solved some timestamp gap related issues before. Do we have a unit test for it that I can add to? If not, do we want one now?

@derekbruening
Copy link
Contributor

@derekbruening I know we solved some timestamp gap related issues before. Do we have a unit test for it that I can add to? If not, do we want one now?

Look at the PR's for the issues I linked in #6745: I see @bete0 added a unit test in PR #6165 or at least the description claims so

@abhinav92003 abhinav92003 changed the title i#6745: Fix timestamp gap in -trace_after_instrs i#6745: Fix timestamp gap in delayed tracing Apr 2, 2024
@abhinav92003
Copy link
Contributor Author

I found two failures for the new test: on win64 and x86-32. Still debugging.

@abhinav92003
Copy link
Contributor Author

x86-32 tool.drcachesim.opcode_mix failure is #6303

@abhinav92003
Copy link
Contributor Author

@derekbruening This is ready for review. PTAL.

@@ -159,7 +158,7 @@ test_main(int argc, const char *argv[])
assert(status == scheduler_t::STATUS_OK);
if (memref.marker.type == TRACE_TYPE_MARKER &&
memref.marker.marker_type == TRACE_MARKER_TYPE_TIMESTAMP) {
// Looks at the gap between the current and the previous timestamps
// Looks at the gap between the first and second timestamps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, should it check all of them (i.e., remove the break)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That equates to checking that there's no sleep between any two trace timestamps, which is not true.

OTOH there could be a sleep between the first two trace timestamps too. I feel this test is inherently brittle and may be working only because the -trace_after_instrs/-retrace_every_instrs/-trace_for_instrs settings are amenable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

drmemtrace -trace_after_instrs introduces gap between first and second timestamps
2 participants