Skip to content

Trace by symbol instead of instruction count.#670

Merged
ngober merged 5 commits intoChampSim:developfrom
Easyoakland:develop
Dec 18, 2025
Merged

Trace by symbol instead of instruction count.#670
ngober merged 5 commits intoChampSim:developfrom
Easyoakland:develop

Conversation

@Easyoakland
Copy link
Copy Markdown

@Easyoakland Easyoakland commented Nov 28, 2025

Feature

Adds two new command line options to the pin tracer: start_symbol and stop_symbol.

These allow precisely controlling when tracing occurs. When the start_symbol is reached tracing is enabled, and when the stop_symbol is reached tracing is disabled. This can be used on existing binaries (possibly by using objdump -d -j .text or similar to find the symbol) or by purposefully creating an unmangled function and inserting it into the binary which is intended on being traced.

If the new arguments are unspecified, behavior is the same as before the feature except that:

This pr also changes the tracer so that after the number of instructions specified by -t have been traced, the pin tool terminates the traced program, since there is no reason to continue execution.

Misc

From what I can see prs are expected to pull request into the develop branch. Let me know if I'm mistaken.
I wrote this because I found it useful. If inclusion is unwanted, let me know and I'll close the pr.

Copy link
Copy Markdown
Collaborator

@ngober ngober left a comment

Choose a reason for hiding this comment

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

I like this change, I anticipate it will be very useful for people writing benchmarks. Thanks for the patch!

Comment thread tracer/pin/champsim_tracer.cpp Outdated
@Easyoakland Easyoakland requested a review from ngober December 4, 2025 19:03
@Easyoakland
Copy link
Copy Markdown
Author

Oh by the way, this should close #455

@ngober
Copy link
Copy Markdown
Collaborator

ngober commented Dec 4, 2025

@joshualmashburn Have you looked any further into #455? Were you able to learn anything about it?

@joshualmashburn
Copy link
Copy Markdown
Contributor

I am unsure if this closes that issue. See my new comments in #455 . We should test this version with a nonzero number to skip, but from what I see, that particular mechanism hasn't changed, so I'm somewhat doubtful.

@ngober
Copy link
Copy Markdown
Collaborator

ngober commented Dec 4, 2025

If this doesn't actually solve #455 as-is, I would rather fix it in a separate patch, rather than trying to work it into this patch. If they can be independent, let's let them be independent.

@joshualmashburn
Copy link
Copy Markdown
Contributor

Separate PR for #455 inbound. Upon a quick skim, it looks orthogonal enough.

@ngober
Copy link
Copy Markdown
Collaborator

ngober commented Dec 4, 2025

As I suspected, the two patches have a merge conflict. @Easyoakland if you can resolve this, we'll get this patch merged.

@Easyoakland
Copy link
Copy Markdown
Author

Easyoakland commented Dec 5, 2025

Why's that PR make the global volatile? It should be atomic like this PR made it. It's not a machine register for performing I/O.

@Easyoakland
Copy link
Copy Markdown
Author

I am unsure if this closes that issue. See my new comments in #455 . We should test this version with a nonzero number to skip, but from what I see, that particular mechanism hasn't changed, so I'm somewhat doubtful.

@joshualmashburn, did you actually test this PR? It stopped tracing for me exactly as expected. (Yes, this includes if you specify -s with a nonzero value)

@joshualmashburn
Copy link
Copy Markdown
Contributor

joshualmashburn commented Dec 5, 2025

@Easyoakland I didn't imply that I did; I am traveling currently. I just tested it and yes it works. Good work. Keep the skip and trace instruction counts global to reduce those function call overheads, but go ahead with your changes, including making instruction count atomic.

Edit: I haven't thoroughly tested the symbol functionality. Boarding a flight now. I'll test it more in a moment.

@joshualmashburn
Copy link
Copy Markdown
Contributor

@Easyoakland could you please document the new feature in the README as well? Please give an example usage of the new options.

@Easyoakland
Copy link
Copy Markdown
Author

Easyoakland commented Dec 18, 2025

@joshualmashburn

Keep the skip and trace instruction counts global to reduce those function call overheads

This doesn't make any sense. The implementation for Knob.Value() is just const TYPE& Value() const { return _value; }. The compiler should easily inline this. There's no reason to make our own copy of an already cached scalar value.

@Easyoakland could you please document the new feature in the README as well? Please give an example usage of the new options.

I've added an example and updated the README.

@ngober

... if you can resolve this, we'll get this patch merged.

Merge conflict resolved.

@ngober ngober merged commit 5765624 into ChampSim:develop Dec 18, 2025
github-actions Bot added a commit that referenced this pull request Dec 18, 2025
Author: Nathan Gober
Committer: GitHub

Merge pull request #670 from Easyoakland/develop

Trace by symbol instead of instruction count.
github-actions Bot added a commit to joshualmashburn/ChampSim that referenced this pull request Dec 31, 2025
Author: Nathan Gober
Committer: GitHub

Merge pull request ChampSim#670 from Easyoakland/develop

Trace by symbol instead of instruction count.
@ngober ngober mentioned this pull request Apr 9, 2026
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.

3 participants