Jump to content
IGNORED

CC65 Profiler


ilmenit

Recommended Posts

Hi,

 

I did a patch for Atari800Win to profile code compiled by CC65.

http://img10.imageshack.us/img10/1729/profilerr.png

 

You can find the binary file, source code and a sample here:

www.alamak0ta.republika.pl/Atari800WinProfiler.zip

 

You can profile a code written in the assembler, because the C sources are not required.

Currently it parses only files generated by CA65, but it can be changed to support XASM or MADS.

 

The GUI viewer on the screenshot is a bit modified GUI of Sleepy profiler:

http://sleepy.sourceforge.net/

 

The profiler has a very simple API and it’s possible to add it to any emulator.

 

Comments are welcome :-)

 

regards,

Jakub

Link to comment
Share on other sites

i still not get it to work with mads... ;)

 

ok. got it with the mandelbrot example... Jesus... the profiler files are saved where the atari800win is located and not where the config file points to... ;)

 

not let me check with Beyond Evil... :)

Edited by Heaven/TQA
Link to comment
Share on other sites

aehm... maybe I am really stupid... but just again following questions...

 

where do I have to place the sprite10.cfg file? into the source code folder or into the folder where atari800winprofiler is located?

 

the config file looks like this:

 

d:\programmieren\teufel\sprite10.lab

d:\programmieren\teufel\sprite10.lst

 

the source is assembled with mads sprite10.asm -t -l

 

then i am drag and drop the sprite10.obx into atari800winprofile entering the monitor and typing pstart sprite10.cfg (which is located in the source code folder not where the atari800win is)

 

after few seconds I am reentering the monitor and typing pend and got the message that the profiler files are generated... now I put them into the same folder where the gui is but it loads the mandelbrot generated files instead?

 

so I checked the text files generated by atari800win and it generates profiles based on the mandelbrot labels etc? but in my beyond evil folder????

 

I really do not get it... which config file is used etc...

Link to comment
Share on other sites

where do I have to place the sprite10.cfg file? into the source code folder or into the folder where atari800winprofiler is located?

 

It doesn't matter where you place sprite10.cfg, but using the pstart command you have to point it as a parameter.

The easiest way is to place it where Atari800WinProfiler.exe is, so you don't have to add any paths, just a file name.

 

the config file looks like this:

d:\programmieren\teufel\sprite10.lab

d:\programmieren\teufel\sprite10.lst

 

the source is assembled with mads sprite10.asm -t -l

 

That's fine.

 

then i am drag and drop the sprite10.obx into atari800winprofile entering the monitor and typing pstart sprite10.cfg (which is located in the source code folder not where the atari800win is)

 

Paths to .lab and .lst files are defined in the config file. But you have to tell the profiler where the .cfg file is!

If you have placed the sprite10.cfg in the other directory, how the profilier could know, that the config file is there?

Place it in the directory where Atari800WinProfiler.exe is or use "pstart d:\programmieren\teufel\sprite10.cfg"

 

after few seconds I am reentering the monitor and typing pend and got the message that the profiler files are generated... now I put them into the same folder where the gui is but it loads the mandelbrot generated files instead?

 

Your previously generated profiler output (IPcounts.txt and ProcCounts.txt of Mandelbrot) was not removed by you or replaced by the new output.

 

I really do not get it... which config file is used etc...

 

1. Path to the .lst and .lab are written in the .cfg file

2. You point the .cfg file as a parameter to pstart command.

That's all. Is that simple enough? :-)

 

Let me know, if it works. Did the profile result was what you have expected? :-)

Link to comment
Share on other sites

Would it be difficult to add support for ATASM?

tjb

 

It wouldn't be difficult, but does anyone still use it, when we have MADS? :-)

 

 

I'm using ATASM and I would use the Profiler on some code there. I use ATASM because I like to work on the "real thing" from time to time, and as far as I know there is no MADS compatible assembler available that runs on A8.

 

Carsten

Link to comment
Share on other sites

I'm using ATASM and I would use the Profiler on some code there. I use ATASM because I like to work on the "real thing" from time to time, and as far as I know there is no MADS compatible assembler available that runs on A8.

 

Fine, I will add ATASM support.

Could you upload somewhere your code samples? ATASM provides only one, very simple program.

 

regards,

Jakub

Link to comment
Share on other sites

I'm using ATASM and I would use the Profiler on some code there. I use ATASM because I like to work on the "real thing" from time to time, and as far as I know there is no MADS compatible assembler available that runs on A8.

 

Fine, I will add ATASM support.

Could you upload somewhere your code samples? ATASM provides only one, very simple program.

 

regards,

Jakub

 

Try X-Forth (5600 LOC)

http://atariwiki.strotmann.de/xwiki/bin/view/Code/XForth

 

the ATASM Source is also downloadable in the "Attachment" section of this Wiki-Article

Link to comment
Share on other sites

the ATASM Source is also downloadable in the "Attachment" section of this Wiki-Article

 

I have an ATASM version compiled, but the output is pretty ugly - ATASM doesn't add label names to the .lst output (-v option).

Before I release this version I would really like to have another code sampel to test it.

Do you have any?

 

regards,

Jakub

Link to comment
Share on other sites

I have an ATASM version compiled, but the output is pretty ugly - ATASM doesn't add label names to the .lst output (-v option).

Before I release this version I would really like to have another code sampel to test it.

Do you have any?

Here are links to some of my projects:

 

http://www.horus.com/~hias/freezer/softwar...ftware-3.02.zip

COM files: "atasm -oflash.com flash.src", "atasm -opatch.com patch.src"

ROM files, in the freezer directory: "atasm -r -f0 BANK1.M65", "atasm -r -f0 BANK2.M65", "atasm -r -f0 BANK3.M65"

 

http://www.horus.com/~hias/tmp/hipatch-090313.zip

an ATR file: "atasm -r -odiag.atr diag.src"

 

so long,

 

Hias

Link to comment
Share on other sites

The test version for the ATASM is done, give it a try before I add it to the official release:

http://www.alamak0ta.republika.pl/atasm.zip

As the whole profiler it works only on the code executed from the main memory bank.

It doesn't trace the bank switching.

 

Hello Jakub,

 

the new ATASM support works for me (tested in Windows 7, will test Linux/Wine later today as I use primary Linux for development).

 

One feature request: would it be possible to calculate the total CPU cycles per subroutine and/or miliseconds spend in the top table in the wxProfiler window?

 

And a questions: what does the red numbers in front of the instructions show exactly? (I have looked on the sleepy webpage, but couldn't find a clue there).

 

The profiler is a great help for me when testing different Forth kernel implementation types.

 

Best regards

 

Carsten Strotmann

Link to comment
Share on other sites

Update testing on Linux with WINE: the emulator works, but the monitor window does not work, so I cannot start/stop profiling there.

 

The WxProfilerGui starts, showing the results of the subroutine count, but it locks up (100% CPU) when selecting any of the subroutines/labels.

 

For the name it seems to be a WxWindows application, might be possible to compile it natively on Linux.

 

However, for me I can live with the Windows version for the time being, is better that having no profiler at all.

 

Carsten

Link to comment
Share on other sites

Update testing on Linux with WINE: the emulator works, but the monitor window does not work, so I cannot start/stop profiling there.

 

This applies to the regular (non-profiling) Atari800WinPlus. Nobody's ever gotten the monitor window to work in Wine... so it's not specifically a problem with the profiler.

Link to comment
Share on other sites

the new ATASM support works for me (tested in Windows 7, will test Linux/Wine later today as I use primary Linux for development).

 

Thanks for testing :-)

 

One feature request: would it be possible to calculate the total CPU cycles per subroutine and/or miliseconds spend in the top table in the wxProfiler window?

 

Every features is possible to add. I have to look how the Atari800Win calculates the CPU cycles and if it's not too complicated, I should add it soon.

 

And a questions: what does the red numbers in front of the instructions show exactly? (I have looked on the sleepy webpage, but couldn't find a clue there).

 

The profiler works on "code hits" - periodically it checks where the instruction pointer is.

Obviously 100% is the total number of code hits during the profiling.

In the top window of wxProfiler is displayed the hit count for each procedure/label and how much percent of total hits it is.

The red numbers in the code view are the percents for each line. The total sum of these red values gives a 100%.

 

Example:

http://www.alamak0ta.republika.pl/mads.png

LOOP label in the DIV procedure takes 60.73% execution time.

All the red values from the DIV.LOOP part of the code (up to DIV.DIV2) sums up to 60.73.

 

The profiler is a great help for me when testing different Forth kernel implementation types.

 

It's a pleasure to help :-)

 

BTW: looking at the picture from the link above I see a potential bug. The first instruction of the procedure/label is ignored in profiling... I will check that.

 

regards,

Jakub

Edited by ilmenit
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...