Page 1 of 1

Harbour 3.2 con Profiler para Borland 32 bits

Posted: Tue Mar 13, 2018 8:33 am
by Antonio Linares
1. We download the Harbour source code:

git.exe clone --progress -v "https://github.com/harbour/core.git" "C:\harbour"

2. We build it this way:

go.bat

Code: Select all

set path=c:\bcc7\bin
set HB_WITH_OPENSSL=c:\OpenSSL-Win32\include
set HB_WITH_CURL=c:\curl\include
set HB_USER_CFLAGS=-DHB_USE_PROFILER
win-make.exe
3. Download it from here already built:
https://bitbucket.org/fivetech/harbour- ... ofiler.zip

Re: Harbour 3.2 con Profiler para Borland 32 bits

Posted: Tue Mar 13, 2018 9:09 am
by Antonio Linares
How to use the Harbour Profiler:

1. Install the provided Harbour with profiler

2. At the beginning of your app call this:

__SetProfiler( .T. )

3. Before exiting your app call this:

ShowProfiler()

4. Add this code to your main PRG:

Code: Select all

#include "xbrowse.ch"

Code: Select all

function ShowProfiler()

   local aValues := {}, n

   for n := 1 TO __dynsCount()
      if __dynsIsFun( n )
         AAdd( aValues, { __dynsGetName( n ), __dynsGetPrf( n )[ 1 ], __dynsGetPrf( n )[ 2 ] } )
      endif
   next

   XBROWSER ASort( aValues,,, { | x, y | x[ 1 ] < y[ 1 ] } ) ;
      TITLE "Profiler results" ;
      SETUP BrwSetup( oBrw, "Name" ) AUTOSORT

   aValues = {}

   for n = 0 to __opCount() - 1
      AAdd( avalues, { n, __opGetPrf( n )[ 1 ], __opGetPrf( n )[ 1 ] } )
   next      

   XBROWSER ASort( aValues,,, { | x, y | x[ 1 ] < y[ 1 ] } ) ;
      TITLE "Profiler opcodes results" ;
      SETUP BrwSetup( oBrw, "opcode" ) AUTOSORT

return nil 

function BrwSetup( oBrw, cType )

   oBrw:aCols[ 1 ]:cHeader = cType
   oBrw:aCols[ 2 ]:cHeader = "Times"
   oBrw:aCols[ 3 ]:cHeader = "Time"
   
return nil  

Re: Harbour 3.2 con Profiler para Borland 32 bits

Posted: Tue Mar 13, 2018 2:07 pm
by Horizon
Hi Antonio,

What is harbour profiler? :oops:

Re: Harbour 3.2 con Profiler para Borland 32 bits

Posted: Tue Mar 13, 2018 4:24 pm
by Antonio Linares
Hakan,

https://en.wikipedia.org/wiki/Profiling ... ogramming)
Provides measurements of application performance. The better ones isolate methods that:

1. Consume the most amount of time
2. Have the most amount of calls

Re: Harbour 3.2 con Profiler para Borland 32 bits

Posted: Tue Mar 13, 2018 4:33 pm
by Antonio Linares
Image

Image

Image

Re: Harbour 3.2 con Profiler para Borland 32 bits

Posted: Thu Mar 15, 2018 8:38 pm
by Lailton
Hi Antonio,

Very interesting.

One question, the "__SetProfiler( .t. )" is one procedure of FiveWin or Harbour?

Thanks for share!

Re: Harbour 3.2 con Profiler para Borland 32 bits

Posted: Fri Mar 16, 2018 7:26 am
by Antonio Linares
Lailton,

It belongs to Harbour

Re: Harbour 3.2 con Profiler para Borland 32 bits

Posted: Fri Mar 16, 2018 8:52 pm
by Lailton
Thank you :)

Re: Harbour 3.2 con Profiler para Borland 32 bits

Posted: Thu Mar 29, 2018 8:15 am
by marzio
i have added IF aScan( aValues, { | x | x[ 2 ] > 0 } ) > 0 to avoid opening of the 2 empty tables if the code is compiled without profiler or __SetProfiler( .f. )

Code: Select all

function ShowProfiler()

   local aValues := {}, n

   for n := 1 TO __dynsCount()
      if __dynsIsFun( n )
         AAdd( aValues, { __dynsGetName( n ), __dynsGetPrf( n )[ 1 ], __dynsGetPrf( n )[ 2 ] } )
      endif
   next

   IF aScan( aValues, { | x | x[ 2 ] > 0 } ) > 0
      XBROWSER ASort( aValues,,, { | x, y | x[ 1 ] < y[ 1 ] } ) ;
         TITLE "Profiler results" ;
         SETUP BrwSetup( oBrw, "Name" ) AUTOSORT

      aValues = {}

      for n = 0 to __opCount() - 1
         AAdd( avalues, { n, __opGetPrf( n )[ 1 ], __opGetPrf( n )[ 1 ] } )
      next      

      XBROWSER ASort( aValues,,, { | x, y | x[ 1 ] < y[ 1 ] } ) ;
         TITLE "Profiler opcodes results" ;
         SETUP BrwSetup( oBrw, "opcode" ) AUTOSORT
   ENDIF

return nil

function BrwSetup( oBrw, cType )

   oBrw:aCols[ 1 ]:cHeader = cType
   oBrw:aCols[ 2 ]:cHeader = "Times"
   oBrw:aCols[ 3 ]:cHeader = "Time"
   
return nil