[fpc-pascal] Profiling in windows

2024-01-03 Thread James Richters via fpc-pascal
I have a freepascal project for Windows that works really well, but as soon
as I start it, I have high CPU usage, and it stays high, it constantly uses
10% CPU 
while my program is running, even when it's idle waiting for me to make a
selection from its menu.  
 
The main program loop does a few minor things like update the time on the
screen, checks some timers, checks for a keypress, then sleeps until it's
time to do the loop again.
I'm wondering if its getting stuck in some inefficient routine that's
causing all this processor activity.
 
This program only runs under Windows so I'm trying to get a profiler to work
with a windows program.  I came across FPProfiler:
https://wiki.freepascal.org/FPProfiler
 
I'm trying to figure out how it's supposed to work but I haven't made it
very far.  The instructions say to use Lazarus to build the following:
 
.\fpp\fpp.lpi
.\fpp\fppinsert.lpi
.\fpp\fppremove.lpi
.\fppview\fppview.lpi
 
But only .\fpp\fpp.lpi and .\fppview\fppview.lpi  exist, so I compiled those
with Lazarus.
 
I am using the repository at:
http://github.com/graemeg/fpprofiler
 
The svn link doesn't work for me:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/fpprofiler/?root=fpcprojects
 
Also, the instructions say," to compile your project, you pass the same
parameters to FPP as you would to FPC."
I don't use FPC from the command line, I use the FPC textmode IDE. Which I
have set up the way I like it years ago.
Is there some way to know what parameters the text mode IDE is using?  Or
What would the command line be to compile the same way as the IDE?
 
Any advice on how to get this to work, or recommendations on another way I
can profile my program under Windows is greatly appreciated.
 
James
 
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Profiling ARM targets

2014-01-13 Thread Bruce Tulloch
Thanks, I will give them a go. -b


On Fri, Jan 10, 2014 at 10:36 PM, Jonas Maebe wrote:

>
> On 10 Jan 2014, at 01:13, Bruce Tulloch wrote:
>
>  What is the recommended way to profile FPC applications run on ARM targets
>>
>
> Callgrind and cachegrind (both part of Valgrind) are probably the best
> options.
>
>
> Jonas
> ___
> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Profiling ARM targets

2014-01-10 Thread Jonas Maebe


On 10 Jan 2014, at 01:13, Bruce Tulloch wrote:

What is the recommended way to profile FPC applications run on ARM  
targets


Callgrind and cachegrind (both part of Valgrind) are probably the best  
options.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


[fpc-pascal] Profiling ARM targets

2014-01-09 Thread Bruce Tulloch
What is the recommended way to profile FPC applications run on ARM targets
in light of the error message:

Fatal: Option "-pg" is not, or not yet, supported on the current target
platform

when I try to compile for the ARM target?

Regards, Bruce.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Profiling

2009-01-27 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said:
> > If there is no bug report about it, it's very likely that it will be 
> > forgotten
> > over time (as in this case, apparently -- I indeed seem to remember that at
> > one point I knew about this).
> 
> There is indeed a problem. I submitted a bugreport with a test program.
> 
> The program does not execute correctly when compiled with -pg.

Has it worked at all for 64-bit ? Otherwise maybe the title of the bugreport
should be corrected.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Profiling

2009-01-27 Thread Jonas Maebe


On 27 Jan 2009, at 11:30, Mattias Gärtner wrote:


Zitat von Jonas Maebe :


I've used qprof successfully in the past (not for FPC programs, but
for other things). It's a sampling-based profiler, so it shouldn't
slow down things too much.


Yes, that's why I prefer gprof and used it a lot in the past.


Note that I was talking about qprof (http://www.hpl.hp.com/research/linux/qprof/ 
), not gprof. As opposed to qprof (and Shark on Mac OS X), gprof is  
not a sampling-based profiler (gprof traces the entire execution).



Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Profiling

2009-01-27 Thread Mattias Gärtner
Zitat von Jonas Maebe :

>
> On 26 Jan 2009, at 22:49, Mattias Gaertner wrote:
>
> > I need to profile lazarus applications under linux.
> > I tried gprof, but it is broken since years and shows no record.
>
> Neither does the bug repository show any record of open bugs against -
> pg on Linux.

Sorry. I thought the problem is known and the fpc team prefers valgrind.
I saw that Michael created a bug report, with major urgent priority - wow.


> > I found the following page, but it does not help here:
> > http://wiki.lazarus.freepascal.org/Profiling
> >
> > How can I profile under linux?
>
> I've used qprof successfully in the past (not for FPC programs, but
> for other things). It's a sampling-based profiler, so it shouldn't
> slow down things too much.

Yes, that's why I prefer gprof and used it a lot in the past.

Mattias

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Profiling

2009-01-27 Thread Michael Van Canneyt


On Tue, 27 Jan 2009, Jonas Maebe wrote:

> 
> On 27 Jan 2009, at 10:49, Graeme Geldenhuys wrote:
> 
> >I can confirm with Mattias. I tried over a year ago to do profiling
> >using gprof. It always generated a empty (0 byte) file. Nothing else.
> >I posted messages to the mailing list and was told to try valgrind
> >instead. It issues with gprof was known at the time.
> 
> If there is no bug report about it, it's very likely that it will be forgotten
> over time (as in this case, apparently -- I indeed seem to remember that at
> one point I knew about this).

There is indeed a problem. I submitted a bugreport with a test program.

The program does not execute correctly when compiled with -pg.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Profiling

2009-01-27 Thread Jonas Maebe


On 27 Jan 2009, at 10:49, Graeme Geldenhuys wrote:


I can confirm with Mattias. I tried over a year ago to do profiling
using gprof. It always generated a empty (0 byte) file. Nothing else.
I posted messages to the mailing list and was told to try valgrind
instead. It issues with gprof was known at the time.


If there is no bug report about it, it's very likely that it will be  
forgotten over time (as in this case, apparently -- I indeed seem to  
remember that at one point I knew about this).



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Profiling

2009-01-27 Thread Graeme Geldenhuys
On Tue, Jan 27, 2009 at 10:15 AM, Jonas Maebe  wrote:
>
> On 26 Jan 2009, at 22:49, Mattias Gaertner wrote:
>
>> I need to profile lazarus applications under linux.
>> I tried gprof, but it is broken since years and shows no record.
>
> Neither does the bug repository show any record of open bugs against -pg on
> Linux.

I can confirm with Mattias. I tried over a year ago to do profiling
using gprof. It always generated a empty (0 byte) file. Nothing else.
I posted messages to the mailing list and was told to try valgrind
instead. It issues with gprof was known at the time.


Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Profiling

2009-01-27 Thread Jonas Maebe


On 26 Jan 2009, at 22:49, Mattias Gaertner wrote:


I need to profile lazarus applications under linux.
I tried gprof, but it is broken since years and shows no record.


Neither does the bug repository show any record of open bugs against - 
pg on Linux.



I found the following page, but it does not help here:
http://wiki.lazarus.freepascal.org/Profiling

How can I profile under linux?


I've used qprof successfully in the past (not for FPC programs, but  
for other things). It's a sampling-based profiler, so it shouldn't  
slow down things too much.



Jonas
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Profiling

2009-01-26 Thread Mattias Gaertner
I need to profile lazarus applications under linux.
I tried gprof, but it is broken since years and shows no record.
I tried valgrind (callgrind), but it slows down the execution by factor
80, making it unusable.

I found the following page, but it does not help here:
http://wiki.lazarus.freepascal.org/Profiling

How can I profile under linux?


Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]profiling sampling rate

2004-06-03 Thread Vincent Snijders
Hi,

If I compile a program with -pg I can get profiling information with gprof. The 
sampling rate is 100 Hz, which means that the profiler looks 100 times each second in 
which procedure the progam is (if I describe it correctly).

Is there a way to make the sampling rate higher, because on computers with processors 
running GHz, each centisecond millions of instructions are handled and this low 
sampling rate gives a very poor view of where the time is spent. (I think it might 
have been OK for processor running at 4 MHz, back when gprof was designed)

Regards,
Vincent Snijders.

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling FPC executables

2003-11-26 Thread Alan Mead
Thanks Peter and Marco!  This is very helpful.

-Alan

> For the moment only gprof. Maybe in the future also
> valgrind/cachegrind
> 
> Compile your program with -pg
> Start your program (this will generate a gmon.out)
> Run gprof 
> 
> 
> 
> ___
> fpc-pascal maillist  -  [EMAIL PROTECTED]
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal


__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling FPC executables

2003-11-26 Thread Marco van de Voort
> I'm writing a simulation that will take hours or days to run.  I've
> never used formal profiling tools but this seems like a good
> opportunity.  I'm working on Linux and I'm still using FPC 1.0.10. 
> What tools are available to me?

gprof. Recompile everything with -pg, there should be a paragraph about
profiling in the manual somewhere.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling FPC executables

2003-11-26 Thread Peter Vreman
> I'm writing a simulation that will take hours or days to run.  I've
> never used formal profiling tools but this seems like a good
> opportunity.  I'm working on Linux and I'm still using FPC 1.0.10.
> What tools are available to me?

For the moment only gprof. Maybe in the future also valgrind/cachegrind

Compile your program with -pg
Start your program (this will generate a gmon.out)
Run gprof 



___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]Profiling FPC executables

2003-11-26 Thread Alan Mead
I'm writing a simulation that will take hours or days to run.  I've
never used formal profiling tools but this seems like a good
opportunity.  I'm working on Linux and I'm still using FPC 1.0.10. 
What tools are available to me?

Thanks!

-Alan

__
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/

___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling and classes

2003-03-30 Thread Marco van de Voort
> >> routines, which was also the case (the non-OO routines uses 10 sec for a
> >> 500x500 matrix inversion, while the OO routines uses 110 secs (!) for the
> >> same).
> >
> > Which compiler did you use? Which OO model did you use?
> >
> > If the answers are 1.0.6 and class then you should try the 1.1 compiler and
> > add {$implicitexceptions off}
> 
> OK, I have just tried it. The result is:
> 
> 104 secs for fpc 1.1 with implicitexceptions off
> 108 secs for fpc 1.0.6
> 
> So this didn't help much. However I'm quite sure that it has to with the
> OO-methods for accessing array-elements (this will of course be slower than
> accessing the elements directly :-)). So I will just (maybe) have to not use
> these methods in descendant classes if I want better performance...

If you mean properties implemented with methods compared to accessing a real array,
this is very probably the case ;-)
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling and classes

2003-03-30 Thread Preben Mikael Bohn
 Peter Vreman wrote:
>> I expected my OO routines to be somewhat slower than my equivalent non-OO
>> routines, which was also the case (the non-OO routines uses 10 sec for a
>> 500x500 matrix inversion, while the OO routines uses 110 secs (!) for the
>> same).
>
> Which compiler did you use? Which OO model did you use?
>
> If the answers are 1.0.6 and class then you should try the 1.1 compiler and
> add {$implicitexceptions off}

OK, I have just tried it. The result is:

104 secs for fpc 1.1 with implicitexceptions off
108 secs for fpc 1.0.6

So this didn't help much. However I'm quite sure that it has to with the
OO-methods for accessing array-elements (this will of course be slower than
accessing the elements directly :-)). So I will just (maybe) have to not use
these methods in descendant classes if I want better performance...

Best regards Preben



___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling and classes

2003-03-30 Thread Peter Vreman
>  Peter Vreman wrote:
>> Which compiler did you use? Which OO model did you use?
>> If the answers are 1.0.6 and class
>
> Right answer... :-)
>
>> then you should try the 1.1 compiler and
>> add {$implicitexceptions off}
>
> OK, I'll try the 1.1. What does the {$implicitexceptions off} do (I guess
> it
> turns implicit exceptions off, but... :-))? I couldn't find anything about
> it...
>

It's very new, so it's not documented yet. It was created to speed up the
compiler, the result was about 15%.

What it does it removes the expection frames from constructors. The result
is that implicit initialized local variables are not freed when there is
an unhandled expection in the constructor.



___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling and classes

2003-03-30 Thread Preben Mikael Bohn
 Peter Vreman wrote:
> Which compiler did you use? Which OO model did you use?
> If the answers are 1.0.6 and class

Right answer... :-)

> then you should try the 1.1 compiler and
> add {$implicitexceptions off}

OK, I'll try the 1.1. What does the {$implicitexceptions off} do (I guess it
turns implicit exceptions off, but... :-))? I couldn't find anything about
it...

> gprof does not know any difference between your own routines or FPC
> routines. If you want to know the profile results of the internal routines
> you have to rebuild the RTL with -pg as option. "make OPT=-pg" in the rtl/
> subdir.

Hmm, I might do that... :-) But first I'll try the two other suggestions...

Best regards Preben



___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling and classes

2003-03-30 Thread Peter Vreman
> Hi all, I am trying to write a basic object-oriented matrix library, but
> have
> run into a problem.
>
> I expected my OO routines to be somewhat slower than my equivalent non-OO
> routines, which was also the case (the non-OO routines uses 10 sec for a
> 500x500 matrix inversion, while the OO routines uses 110 secs (!) for the
> same).

Which compiler did you use? Which OO model did you use?

If the answers are 1.0.6 and class then you should try the 1.1 compiler
and add {$implicitexceptions off}


> Each sample counts as 0.01 seconds.
>   %   cumulative   self  self total
>  time   seconds   secondscalls   s/call   s/call  name
>  40.63 14.1314.13 249874780 0.00 0.00  _SIMPLE..
> [snip - a lot of lines]
>   0.00 34.78 0.001 0.0034.75  program_init
>
> Here the cumulative seconds only shows 34.78 seconds, even though the
> output
> from "time" gives 110 seconds...
>
> Can anyone tell me what is going on? I guess it means that it uses a lot
> of
> time (~70%) in some internal FPC routines I have no control over?

gprof does not know any difference between your own routines or FPC
routines. If you want to know the profile results of the internal routines
you have to rebuild the RTL with -pg as option. "make OPT=-pg" in the rtl/
subdir.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal]Profiling and classes

2003-03-30 Thread Preben Mikael Bohn
Hi all, I am trying to write a basic object-oriented matrix library, but have
run into a problem.

I expected my OO routines to be somewhat slower than my equivalent non-OO
routines, which was also the case (the non-OO routines uses 10 sec for a
500x500 matrix inversion, while the OO routines uses 110 secs (!) for the
same).

To analyse where the problem is I have used the -pg option to make output for
use in the GNU profiler, gprof. In the non-OO program I get the following:

Each sample counts as 0.01 seconds.
  %   cumulative   self  self total
 time   seconds   secondscalls   s/call   s/call  name
 41.27  4.42 4.42  501 0.01 0.01  _FORWARDSUBS...
 30.44  7.68 3.26  501 0.01 0.01  _BACKWARDSUBS..
 28.20 10.70 3.022 1.51 1.51  _LUDECOMPOSITION$TAR
  0.09 10.71 0.011 0.0110.71  program_init

As you can see the cumulative seconds are equal to the time I measured (using
"time" on the command line).

However when I run the OO program I get something like:

Each sample counts as 0.01 seconds.
  %   cumulative   self  self total
 time   seconds   secondscalls   s/call   s/call  name
 40.63 14.1314.13 249874780 0.00 0.00  _SIMPLE..
[snip - a lot of lines]
  0.00 34.78 0.001 0.0034.75  program_init

Here the cumulative seconds only shows 34.78 seconds, even though the output
from "time" gives 110 seconds...

Can anyone tell me what is going on? I guess it means that it uses a lot of
time (~70%) in some internal FPC routines I have no control over?

Best regards Preben

PS: It should be mentioned that in both cases the computer had nothing else to
do, and that the "time" command estimated the CPU usage to be 99%.


___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal]Profiling and memory leaks

2003-02-08 Thread Marco van de Voort
> Do you know of any tools I can use to check for memory leaks on my code?
> 
> I'm using FPC 1.1 snapshots under Win2k.

Compile using -gh, and check the output after termination. It will give the unitname 
and line
where the memory was allocated.

There are only a few gotcha's (sometimes memory allocated in the RTL startup is not 
released
when the memorychecker terminates. So if you have mem leaks at the "start" of the 
program,
ignore them)
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal



[fpc-pascal]Profiling and memory leaks

2003-02-08 Thread Iván Montes
Hi,

Do you know of any tools I can use to check for memory leaks on my code?

I'm using FPC 1.1 snapshots under Win2k.

cheers, Ivan
___
fpc-pascal maillist  -  [EMAIL PROTECTED]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal