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 Expand view RUN
#include "xbrowse.ch"
- Code: Select all Expand view RUN
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