Recent

Author Topic: Small profiler for Windows projects  (Read 14423 times)

danquantum

  • New Member
  • *
  • Posts: 11
    • bitnova
Small profiler for Windows projects
« on: November 29, 2009, 03:45:38 pm »
First of all, I want to congratulate the entire FPC and Lazarus community for its great job with this project. I have used Lazarus for some time and I think is a great development environment.

I've just started work on a small tool in order to profile my applications, called cAtomProfiler, for projects compiled on the windows platform. Later, the porting to others will be dealt. The purpose is not only to extract timings for method calls, but also to build analyzer graphs. I am really interested in other's opinion about the usefullness of a project like this.

No published work yet (very soon anyway), but my intend is to make it an open source project and invite everyone to use/improve it. I need to know what are the necessary step in creation of an open source project (I mean, is it sufficient in placing the license copy in the source code package, or do I have to make a registration somewhere). I know this might be a stupid question, but anyway, I would apreciate any insight. Thank you.

I will try to answer any other questions posted prior to the initial publish of the project.

TurboRascal

  • Hero Member
  • *****
  • Posts: 672
  • "Good sysadmin. Bad programmer."™
Re: Small profiler for Windows projects
« Reply #1 on: November 29, 2009, 05:28:32 pm »
I need to know what are the necessary step in creation of an open source project (I mean, is it sufficient in placing the license copy in the source code package, or do I have to make a registration somewhere).

It is sufficient. Your program becomes open source as soon as you publish it with an open source licence. To be more specific, to become "Open Source" in the Open Source Initiative meaning, the license should be one that is approved by the Initiative (Like GPL, BSD lic., etc.)...

In the wider meaning, it is enough to publish it with any kind of licence that permits modification and redistribution of the source code...
Regards, ArNy the Turbo Rascal
-
"The secret is to give them what they need, not what they want." - Scotty, STTNG:Relics

danquantum

  • New Member
  • *
  • Posts: 11
    • bitnova
Re: Small profiler for Windows projects
« Reply #2 on: November 29, 2009, 11:27:25 pm »
So no legal issues here... thank you

I will get with a new announcement regarding the first release and details on how you may download the tool in a very short time (including the catomprofiler.sourceforge.net already started). This will not be a fully working release and especially not an optimized one, but my hope is to get the attention and help of others.

In the meantime, I will try to answer to any posted questions here, if any.

Paul Ishenin

  • Sr. Member
  • ****
  • Posts: 274
Re: Small profiler for Windows projects
« Reply #3 on: November 30, 2009, 03:39:20 am »
It would be really nice to have a good profiler for fpc applications on windows. But instead of building the new project you maybe can cooperate with the http://delphitools.info/samplingprofiler/ ?

In any case I'm very interesting in this work.

danquantum

  • New Member
  • *
  • Posts: 11
    • bitnova
Re: Small profiler for Windows projects
« Reply #4 on: November 30, 2009, 04:11:42 am »
It would be really nice to have a good profiler for fpc applications on windows. But instead of building the new project you maybe can cooperate with the http://delphitools.info/samplingprofiler/ ?

In any case I'm very interesting in this work.

I see only one good reason in developing a new project under fpc/lazarus: to help grow the range of fpc/lazarus applications and community even more. Actually is a matter of personal choice, as one may think I would reject the idea of contributing to a project developed under Delphi, which is not true. And this certainly does not exclude the ideea of cooperation with the project in the future.

The cAtomProfiler is an instrumental one, working through injection of the source code with profiler methods calls like
Code: [Select]
{$ASMMODE intel}asm call cAtom_EnterProc end; Still, many things are to be further put in place, as I want it to be capable of determining as automatically as possible not only the entries and exits in procedures, but also the point of calls to permit code branch discrimination (if loops or decision branching).

dblaszijk

  • New Member
  • *
  • Posts: 15
Re: Small profiler for Windows projects
« Reply #5 on: November 30, 2009, 06:43:00 pm »
A long time ago I already started work on a platform independent profiler for FPC. See: http://svn2.freepascal.org:8060/browse/FPCProjects/fpprofiler

Afaik this profiler was working rather fine and incorporated different backends (graphviz and plain ascii). The pascal tokenizer needed some still some work before release though.

danquantum

  • New Member
  • *
  • Posts: 11
    • bitnova
Re: Small profiler for Windows projects
« Reply #6 on: November 30, 2009, 11:55:55 pm »
A long time ago I already started work on a platform independent profiler for FPC. See: http://svn2.freepascal.org:8060/browse/FPCProjects/fpprofiler

Afaik this profiler was working rather fine and incorporated different backends (graphviz and plain ascii). The pascal tokenizer needed some still some work before release though.

I was going to ask you bring this into the topic after our short email exchange. I've promised to have a look over it and I also think others should do the same. I am inviting anyone who had or has some experience with fpprofiler to share their knowledge. I've already seen there is a lot of work done on the code injection.

First of all I will admit I am a beginner in this matter but I wouldn't expect it to be otherwise. I am not yet sure if what I want in the end from the profiler I've started is already implemented in the fpprofiler or if there is the case where an adaptation is in order, and I am still laying down directions that I want to follow while I'm preparing a first timid attempt of release (with the work already done). I would like to emphasize on diversity first, before canceling the idea that started these discussions. And the reason is very simple: I call this a research project for the moment which might bring some useful insights for any further development of a such needed native lazarus/fpc profiler.

Later on I will be able to form a list of requirements necessary for a profiler, including things like:
  • whether having it integrated in a compiler or as an external/include based;
  • to be able in using already generated symbols like gprof or valgrind, or just to use the usual symbol table of the binary or the .stab section in case of COFF format
  • combining it with the capacity of sampling the code while running the program in order to highlight the methods to be further analyzed;
  • ways to sample both entry/exit points in procedures and calling points with as little injection as possible (something that bothers me right now);
  • work with a graphical analyzer tool and format of data exchange to be employed (for my little project I chose the xml format for its hierarchical structure);

Based on such a list I think, and with the input of others interested, we should draw the future directions of development. I would call this a little manifest ;).

Cheers...

dblaszijk

  • New Member
  • *
  • Posts: 15
Re: Small profiler for Windows projects
« Reply #7 on: December 02, 2009, 09:40:52 am »
Integration of a native profiler in the compiler is a can of worms, and I would not suggest it until you have built a "stand alone" version first.

About having a graphical analyzer; well that's why I made the backend pluggable in the first place. It's just a matter of writing a new one that's integrated with Lazarus or even stand alone. Up to you.

I suggest you create a page on the freepascal wiki and collect any ideas and information.

danquantum

  • New Member
  • *
  • Posts: 11
    • bitnova
Re: Small profiler for Windows projects
« Reply #8 on: January 06, 2010, 05:39:02 am »
A first release of the cAtomProfiler source code has been made. It is available for download on http://www.sourceforge.net/projects/catomprofiler and a wiki page has been created on http://www.bitnova.ro/wiki/index.php/FPC/Lazarus_cAtom_Profiler, although there is no information posted there yet.

At this point, I called it a pre-alpha version 0.10. It has included a Symbol Table debugger unit for the PECOFF exe format and cAtomDebugUnit which is responsible for the actual profiling. The analyzer is in its very initial state, and the current focus in development is on getting a basic algorithm detection inside the profiler.

Although not having at this point a fully design worth in defending to the death, I'm confident that practical results will become clear in the future deployments. Who is interested to take a look, join or give a consultant and constructive opinion, is welcomed to visit the links above.

Thank you.

 

TinyPortal © 2005-2018