From c98c63f0d37ca61c5c23ea3e7194f2b2ce16b320 Mon Sep 17 00:00:00 2001 From: Antonio Linares Date: Sat, 30 Jun 2001 08:26:43 +0000 Subject: [PATCH] New profiler support functions added --- harbour/source/vm/dynsym.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/harbour/source/vm/dynsym.c b/harbour/source/vm/dynsym.c index cf45dbe7fe..b4d33fe7a8 100644 --- a/harbour/source/vm/dynsym.c +++ b/harbour/source/vm/dynsym.c @@ -350,5 +350,35 @@ HB_FUNC( __DYNSGETINDEX ) /* Gimme index number of symbol: dsIndex = __dynsymGet hb_retnl( 0L ); } -#endif +HB_FUNC( __DYNSISFUN ) /* returns .t. if a symbol has a function/procedure pointer, + given its symbol index */ +{ + long lIndex = hb_parnl( 1 ); /* NOTE: This will return zero if the parameter is not numeric */ + if( lIndex >= 1 && lIndex <= s_uiDynSymbols ) + hb_retl( s_pDynItems[ lIndex - 1 ].pDynSym->pFunPtr != NULL ); + else + hb_retl( FALSE ); +} + +HB_FUNC( __DYNSGETPRF ) /* profiler: It returns an array with a function or procedure + called and consumed times { nTimes, nTime } + , given the dynamic symbol index */ +{ + long lIndex = hb_parnl( 1 ); /* NOTE: This will return zero if the parameter is not numeric */ + + hb_reta( 2 ); + hb_stornl( 0, -1, 1 ); + hb_stornl( 0, -1, 2 ); + + if( lIndex >= 1 && lIndex <= s_uiDynSymbols ) + { + if( s_pDynItems[ lIndex - 1 ].pDynSym->pFunPtr ) /* it is a function or procedure */ + { + hb_stornl( s_pDynItems[ lIndex - 1 ].pDynSym->ulCalls, -1, 1 ); + hb_stornl( s_pDynItems[ lIndex - 1 ].pDynSym->ulTime, -1, 2 ); + } + } +} + +#endif \ No newline at end of file