Function Profiling Library (Frame Work)

Started by kevin, January 22, 2015, 09:49:32 PM

Previous topic - Next topic

kevin


Function Profiling Library (Frame Work)

   This is a little library that you can drop into your existing program to get some idea of how certain functions/fragments are performing over time. 

 


PlayBASIC Code: [Select]
   breakkey off

do
cls

UserFunction1()

print "Running program - ESC to exit"

print GetProfile$(1)

sync
loop esckey()


#if pbdebug>0
DumpAllProfilesToConsole()
#break
#endif





Function UserFunction1()

// begin profiling this function
static ProfileIndex=ProfileBegin(ProfileIndex)

print "Running some for/next loop for something to time"

for lp =0 to 100000
a++
next

print a


// end profiling this function
ProfileEND(ProfileIndex)
EndFunction






monkeybot


kevin

#2
 PlayBASIC - Profiling Pre - Processor Tool


       This program takes the input PlayBASIC project file (PBP file), loads  the source code from the project then insert (for want of a better word) profiling code into the functions & psubs, appends some setup code and  dumps the results out to disc.  

        The code that's inserted is basically what the library above does with a few more per-calculations added, such as function name and the ability to get rid of the some of the setup code .    You can actually replace the profiling code with whatever you like and or update the parser to add more abilities.   Which requires no more knowledge that some simple INSTRING and REPLACE$() usage..    


       To use the program you'll need to give it the location of PlayBASIC project file (the PBP file) as well as the save location of the resulting merged source code.    Beyond that, you're on your own !


  Related Articles

      * PayBASIC (CLASSIC) Project Loader / Source Merger Functions
   

  Download

       Attached bellow