FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour ¿Como se usa "profiler" con xharbour en vez de Harbour?
Posts: 33
Joined: Wed Apr 16, 2008 06:24 PM
¿Como se usa "profiler" con xharbour en vez de Harbour?
Posted: Thu Oct 24, 2013 05:28 PM

Hola a todos.

Me gustaría optimizar el funcionamiento de mis aplicaciones y he visto en el foro algunos temas sobre el uso de Profiler.
He colocado las funciones oportunas siguiendo algunos ejemplos, pero no se como poder ver la información generada una vez terminada la captura de la zona del programa a analizar.

¿ Alguien podría mostrarme algún ejemplo de como hacerlo para xharbour+FWH 1301?

Muchas gracias.

Uso :
WINDOWS 7 Professional
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 9656)
FWH 1301
RECURSOS CON PELLES C ( archivo del tipo "res")

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ¿Como se usa "profiler" con xharbour en vez de Harbour?
Posted: Fri Oct 25, 2013 08:37 AM
Ricardo,

Este ejemplo funciona bien con ambos Harbour y xHarbour:

profiler.prg
Code (fw): Select all Collapse
#include "FiveWin.ch" 
#include "xbrowse.ch"

function main() 

   local aValues := {}, n

   __SetProfiler( .T. )

   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 ) AUTOSORT

return nil 

function BrwSetup( oBrw )

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


El Harbour ó xHarbour que se use tiene que haber sido construido con soporte de profiler, ó los resultados apareceran todos ceros.

Tambien se pueden analizar los opcode más usados de la máquina virtual...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ¿Como se usa &quot;profiler&quot; con xharbour en vez de Harbour?
Posted: Fri Oct 25, 2013 08:50 AM
Esta versión analiza tambien los opcodes de la máquina virtual:

profiler.prg
Code (fw): Select all Collapse
#include "FiveWin.ch" 
#include "xbrowse.ch"

function main() 

   local aValues := {}, n

   __SetProfiler( .T. )

   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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: ¿Como se usa &quot;profiler&quot; con xharbour en vez de Harbour?
Posted: Fri Oct 25, 2013 10:01 AM
Para poder usar el profiler hay que construir la librería hbvm.lib de Harbour con el siguiente flag:

-DHB_USE_PROFILER

Construir Harbour usando este go.bat
Code (fw): Select all Collapse
set path=c:\bcc582\bin
set HB_USER_CFLAGS=-DHB_USE_PROFILER
win-make.exe
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 33
Joined: Wed Apr 16, 2008 06:24 PM
Re: ¿Como se usa &quot;profiler&quot; con xharbour en vez de Harbour?
Posted: Fri Oct 25, 2013 05:21 PM

Muchas gracias, Antonio.

Me pongo manos a la obra.

Un afectuoso saludo.

Continue the discussion