Enable migration for ocperf into an installable script#534
Merged
andikleen merged 2 commits intoandikleen:masterfrom Jun 8, 2025
Merged
Enable migration for ocperf into an installable script#534andikleen merged 2 commits intoandikleen:masterfrom
andikleen merged 2 commits intoandikleen:masterfrom
Conversation
Test Plan:
Instead of adding pmu tools to my path:
1. I created a venv
2. pip install .
3. went to a directory not containing ocperf and then ran the following commands
```
which ocperf
/home/snihalani/pmu-tools/venv/bin/ocperf
cat /home/snihalani/pmu-tools/venv/bin/ocperf
import re
import sys
from ocperf import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main())
ocperf record ls
perf record ls
perf.data test_file
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.015 MB perf.data (11 samples) ]
((venv) )
ocperf script
perf script
perf-exec 3591082 238954.632897: 1 cycles:P: ffffffff8aec5ad6 native_write_msr+0x6 ([kern>
ls 3591082 238954.633037: 12191 cycles:P: ffffffff8b003e70 hrtimer_forward+0x0 ([kerne>
ls 3591082 238954.633052: 13368 cycles:P: ffffffff8aec5ad6 native_write_msr+0x6 ([kern>
ls 3591082 238954.633066: 40787 cycles:P: ffffffff8af68e1b __update_blocked_fair+0xcb >
ls 3591082 238954.633089: 121077 cycles:P: ffffffff8bf91e36 copy_page_regs+0x26 ([kerne>
ls 3591082 238954.633136: 274901 cycles:P: 76701bccbf48 init_cpu_features.constprop>
ls 3591082 238954.633235: 422672 cycles:P: ffffffff8b261ae7 kmem_cache_free+0x117 ([ker>
ls 3591082 238954.633386: 503787 cycles:P: ffffffff8bf7ca3d mas_preallocate+0x2d ([kern>
ls 3591082 238954.633565: 545088 cycles:P: 76701bcc303b _dl_relocate_object+0x2db (>
ls 3591082 238954.633758: 571942 cycles:P: ffffffff8bf79a0f mas_split.isra.0+0x4cf ([ke>
ls 3591082 238954.633966: 593169 cycles:P: ffffffff8bd76067 genlmsg_put+0x17 ([kernel.k
```
Owner
|
Thanks. I had hoped there was some way to directly copy or symlink, but apparently there isn't? I fear it will be messier for toplev though, it has complex name space issues with the top levels. |
Contributor
Author
|
there isn't a way to copy or symlink yet. I'll play with toplev and figure out how to migrate it. I'll also update README.md in an upcoming PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a proof of concept that enables me to use ocperf for PGO while using pmu-tools as an installable artifact (https://gcc.gnu.org/wiki/AutoFDO/Tutorial).
Test Plan:
Instead of adding pmu tools to my path: