16

I am developing some software for the Commodore 64, and I am concerned about its runspeed.

Is there an emulator that can report, after running my code, where exactly it spent most of its time? I'm happy to write some callback or something if that's what's needed.

  • 12
    Back in the old days (mid 1980s), we used the vic interrupt and changed the background colour starting on a particular raster line, ran the code, then changed the colour back. Then you get a visual representation of how long something took. – Neil Jun 15 at 13:31
  • 2
    I'd agree with @Neil, this is by far the most easy, practical quick-peek at performance, and even without the interrupt for stability it's still instructive. And beyond just the old days... we were still using the border color for quick performance insights on PlayStation 3 in the mid-2000's. – Luxocrates Jun 16 at 23:35
15

Something approaching what you want could be VICE PDB monitor for the VICE commodore 64 emulator.

From https://csdb.dk/forums/?roomid=11&topicid=134927:

Currently VICE PDB Monitor uses Vice's mmzap and mmshow between executions or breakpoints to gather execution information and generate a heat map. It's not entirely exact since Vice doesn't trap multiple executions from the same address.

So if you know where your program is installed, the "heat map" (understand: where the program counter executes the most instructions) will help you find where the program is very often running instructions from.

This isn't going to provide the timings or the function names (since it's not a symbolic tool), but if you see a routine/part of code being called very frequently, you know that you have to work on that one rather than on another one.

It's not using symbols, so you have to make address translation yourself, but it can be used on programs you don't have source code for too.

| improve this answer | |
  • It looks like Windows specific software, is this correct? – OmarL Jun 14 at 21:23
  • the emulator is multi-platform but the extension seems to be windows only – Jean-François Fabre Jun 14 at 21:44
  • 2
    Depending on your system, you might like to try to run the Windows version of the emulator with Wine. – the busybee Jun 15 at 7:41
  • 1
    Wine would not be optimal but at least it has a chance to work, and this is something you really need to do so it's worth it. Problem is this tool has a GUI (hello MFC...), which explains that it's not portable. But the source is available on github. – Jean-François Fabre Jun 15 at 8:00
9

I wrote an emulator recently that was designed for tinkering and visualizing what the target software's doing. It doesn't quite have the monitoring you're looking for, but its realtime RAM usage scope comes a little close, and adding a heatmap to it would be trivial.

If you're curious... https://github.com/luxocrates/viciious

Writing more scopes for it's kinda fun, so if you have any requests for what you'd like it to show, I'm all ears...

| improve this answer | |
  • That looks interesting! ... Since you invite me to make a request: Are you able to rig some kind of profiling heatmap together? What Jean-François describes sounds perfect, but for the fact it's Windows only. – OmarL Jun 15 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.