C/ASM profiling tools?

Since we do not have native C compilers on the Oric, this forum will be mostly be used by people using CC65 or the OSDK. But any general C related post will be welcome !
User avatar
NekoNoNiaow
Flight Lieutenant
Posts: 272
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

C/ASM profiling tools?

Post by NekoNoNiaow »

Hello kittens!

Does anyone know which profiling tools are available for Oric programs aside from the reliable but quite basic OSDK clock() function?
A cursory search in the forums and well as on the web did not reveal anything and it does not look like the OSDK C/ASM compiler/assembler support some kind of profiling output.

I guess some emulators which are able to load debug symbols might also offer that kind of tools but there as well I was not able to find anything.

Note that my needs are quite rudimentary at the moment and satisfied by the clock() function but I am naturally curious. ;)
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: C/ASM profiling tools?

Post by Dbug »

It's my profiler:
http://miniserve.defence-force.org/svn/ ... /Profiler/

Maybe I should make it easy to add to OSDK projects and document how to use it...

Regarding emulators, Oricutron has an internal cycle counter that you can reset:
http://www.osdk.org/index.php?page=docu ... =oricutron

So just set it to zero, step in your routine, look at the value when exiting.
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: C/ASM profiling tools?

Post by iss »

Just small addition for Oricutron's internal cycle counter - you can control it with breakpoints too.
For more info see my post here and the ReadMe.txt.
User avatar
Chema
Game master
Posts: 3013
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: C/ASM profiling tools?

Post by Chema »

It is a pity that nobody jumped into the expansion I proposed to Oricutron. My idea was adding support for external tools, at least, receive commands and send data back to an external application (using a socket or any other method). I suggested this to the author of a spectrum emulator and the results were incredible.

You can send all the debugger commands but also you inspect/modify memory in real time, or do profiling by getting the cycles used from one point to another as many time as you wish in a full run and run statistics over the results... even in real time.

That sort of things that would be invaluable for programmers like me :)
User avatar
NekoNoNiaow
Flight Lieutenant
Posts: 272
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Re: C/ASM profiling tools?

Post by NekoNoNiaow »

Dbug wrote: Tue Oct 30, 2018 7:58 am It's my profiler:
http://miniserve.defence-force.org/svn/ ... /Profiler/
Maybe I should make it easy to add to OSDK projects and document how to use it...
Thanks! For a start this is indeed useful and yup, this looks like this would belong as a part of the OSDK library.

Obviously, it would be even better if we could have scope-profiling by simply defining profiling class instances but this would require a c++ compiler and I guess we are not there yet. ;)

For those who are curious, this would look like this:

Code: Select all

void my_function(int a, int b)
{
   PROFILE(my_function);  // <- a macro, actually translates to -> ScopeProfiler profiler_L122_my_function("my_function")
   
   while ( whatever)
   {
   	PROFILE(loop);		// translates to -> ScopeProfiler profiler_L126_loop("loop")
   	// ...
   }
}
Chema wrote: Tue Oct 30, 2018 2:41 pm It is a pity that nobody jumped into the expansion I proposed to Oricutron. My idea was adding support for external tools, at least, receive commands and send data back to an external application (using a socket or any other method). I suggested this to the author of a spectrum emulator and the results were incredible.
Actually, DBug did and suggested a GDB extension for Oricutron, which is kinda the generalization of your suggestion, and which I find absolutely great.
The advantage of the GDB standard is that it is supported by many IDEs (Visual Studio for example), so this would allow to debug Oric applications from our preferred IDE.

Maybe we should create an official issue/request on the GitHub page and vote it up? ;)
iss wrote: Tue Oct 30, 2018 9:01 am Just small addition for Oricutron's internal cycle counter - you can control it with breakpoints too.
For more info see my post here and the ReadMe.txt.
I see, thanks!
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: C/ASM profiling tools?

Post by Dbug »

Since the topic has gotten some attention, I decided to spend a bit of time writing a blog post about it:
http://osdk.org/index.php?page=articles&ref=ART11

If you are interested, the code of the "racing game" prototype with the integrated profiler is on the SVN depot:
http://miniserve.defence-force.org/svn/ ... ames/Road/
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: C/ASM profiling tools?

Post by iss »

Very interesting information. I have to try the example (on multi CPU platform :lol:)!
User avatar
NekoNoNiaow
Flight Lieutenant
Posts: 272
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Re: C/ASM profiling tools?

Post by NekoNoNiaow »

Great article!
Thanks for putting in the effort.

I will be using these routines/macros veryyyyy soon. ;)
User avatar
Dbug
Site Admin
Posts: 4437
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: C/ASM profiling tools?

Post by Dbug »

I've posted a follow up article on the same topic, with some concrete example of how to optimize code:
http://www.osdk.org/index.php?page=articles&ref=ART12
User avatar
NekoNoNiaow
Flight Lieutenant
Posts: 272
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Re: C/ASM profiling tools?

Post by NekoNoNiaow »

Dbug wrote: Fri Nov 16, 2018 8:42 pm I've posted a follow up article on the same topic, with some concrete example of how to optimize code:
http://www.osdk.org/index.php?page=articles&ref=ART12
Very nice article by the way!
It gave me a few ideas for further optimizations of that vertical scroll routine but I must concentrate on my stuff now or I will never advance. ;)
Post Reply