I'm looking at new CPU History binary monitor instruction. While it provides insight into history, it probably lacks usefulness.
Imagine I have an IDE and would like to track how my app performs. The obstacle is, if I'm not mistaken, limited history length (8192? instructions). Let's say I start recording history - how can I retrieve all the history items as I don't know when the buffer is being overwritten?
So I propose this feature:
Have a history checkpoint which is triggered when buffer is full (optional, of course).
I can imagine my scenario like this:
a) set condition that stops emulator when CPU history buffer is full (my proposal)
b) run app
c) each time buffer is full, retrieve history
d) eventually stop app
e) unset condition that stops emulator when CPU history buffer is full (my proposal)
f) call CPU History instruction and retrieve only the last 0...index history items.
g) analyze complete history programmatically
I might be missing something and there is already a solution for this? But if not, it shouldn't be that hard to add such an addition. FYI I have an IDE and would like to add profiling.
TIA
you can configure the buffer size :)
Other than that:
That should enable you to do what you want
Setting buffer size will only slightly help, will allocate everything upfront (it might be huge) and it's still a fixed buffer size.
Advance instructions might actually do the trick, good idea.
I assume (the docs for IC) mean "How many instructions to execute or to step over based on SO"?
IOW if I set SO to false, it will just execute N instructions whatever they are.
From docs:
SO: 1 byte: Step over subroutines?
Should subroutines count as a single instruction?
IC: 2 bytes: How many instructions to step over.
Thanks for ideas!
Hm, OTOH there is one more issue - the last fetch. When app stops collecting, how does it know how many items to retrieve? It's certainly N<BufferSize, but how would it know?
OTOH OTOH recording 8192 instructions takes roughly half a second (including communication through binary monitor) so stopping only when buffer is full shouldn't mater.
Perhaps one more question.
I'm trying to figure out how to best start profiling right before my app starts.
Here is one plan:
Now, this does not work because autoload with run after load doesn't honor paused state and restarts the emulator.
What would be the proper way to start an autoloaded app (run after load=false)? By setting a PC register to its start location?
TIA