Skip to content

Instantly share code, notes, and snippets.

View junjie1475's full-sized avatar

junjie1475

  • Johor Bahru, Malaysia
  • 22:21 (UTC +08:00)
View GitHub Profile
@junjie1475
junjie1475 / m3_explore.md
Last active December 3, 2024 13:52
m3_explore

Note: This is for my own educational purpose only(WIP)

Many people have already posted different kinds of microbenchmarking method for testing the size limits of various structures(e.g ROB, PRF). I recommend you to look at Henry Wong's blog post and also Maynard Handley's PDFs first. I got my idea from them and many others!

I found a slightly different variant based on them

Get the tools ready

Testing on Apple platform is always a hassle, and for my method we have to have a way to access the Performance counters directly in our microbenchmark. Dougall made a Kext for this purpose, basically what it does is to provide access to the configuration registers and so we can set the PMCs available for userspace access. And to make my life easier, I made a kext to pin the microbenchmark to

@junjie1475
junjie1475 / A17 pro PMC event key.txt
Last active October 13, 2023 23:42
A17 pro Performance counter key
0000000000000000 NONE
0000000000000001 RETIRE_UOP
0000000000000002 CORE_ACTIVE_CYCLE
0000000000000084 FLUSH_RESTART_OTHER_NONSPEC
000000000000008c INST_ALL
000000000000008d INST_BRANCH
000000000000008e INST_BRANCH_CALL
000000000000008f INST_BRANCH_RET
0000000000000090 INST_BRANCH_TAKEN
0000000000000093 INST_BRANCH_INDIR