Sunday, November 25, 2007

Minus4: Profiling.

I've added the basics to the profiling kit and its really interesting to see memory access at work. With machines being so fast these days I can afford to put in profile access for everything without worrying about it, which is pretty neat in itself. So I can currently profile read, write and execute all seperatly (or accumulate them for a combine profile).

The REALLY cool thing is that I can watch the profile in real time!! When selected a new window pops open and you can sit and watch any area of memory and see what the access is like. This is very very cool, and a tool I wish I had in my day to day development! The piccy on the right shows the profile in action and the bars bump up and down over time as the system hits memory differently. I have a reset option so that I can averate the profile over a little bit of time and clear it. This gives some really cool feed back.

What I really need to do now is allow symbol lookups so you can see where time is being spent. This shouldn't be too hard but will prove to be amazingly cool! I still have most of the editor functions to add, but even now I can see that vast areas of ZeroPage (which is shown) are virtually unused!

Of course, a huge spike does not mean that you HAVE to put something in zero page, as things like my frame sync variable gets hit thousands of times a second, but can be slow as its the end of a frame!But for the most part, if theres a spike in memory access, thats a good variable to move to ZeroPage if you can.

4 comments:

TNT said...

Just lovely! Separate counts makes it way better than just "accessed" count. Do read-modify-write instructions increment both read & write counts?

Mike said...

No...afraid not. Because Minus4 isn't a cycle based emulator, it doesn't have that concept... but any real cycle based one certainly could!

However.... that might just confuse people ;)

TNT said...

No matter if it's cycle based or not, you still could make inc/dec/asl etc to increment both counts. OTOH incrementing just one of them makes it easier to see how many cycles you would save by moving a variable to zero page.

(Yes, I know that RMW instructions do one read and two writes, but for profiling it's better to forget technical accuracy and get readable results ;)

Anonymous said...

Yep...particually as you want to base decisions around number of cycles rather than hits.

For example, a hit to normal memory is only 1 cycle extra, but you may think its REALLY important if its being read/written to twice.

(Mike)