[futurebasic] Statement Profiler

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2000 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Thu, 23 Nov 2000 09:29:17 +1300
I have posted a beta version of a small programming utility at futurebasic.org:

<ftp://ftp.futurebasic.org/futurebasic/dropbox/Statement%20Profiler.sit>

Statement Profiler lets you see how many times each statement in a program
was executed, by providing a listing of your program with the counts shown
at left. The listing looks like this small extract:

         local fn CombSort( array(_maxDim) as long, n as long )
         // Put array(0:n-1) in order.
         dim as unsigned long    gap, switch, j, k
      5  if ( n <= 1 ) then exit fn
      5  dec( n )
      5  gap = n
      5  do
    170  gap = gap/1.3 // special number
    170  if ( gap < 1 ) then gap = 1
    170  switch = 0
    170  for j = 0 to n - gap
1993695  k = j + gap
1993695  long if ( array(j) > array(k) )
 162612  swap array(j), array(k)
 162612  switch = _zTrue
         end if
1993695  next
    170  until ( switch == _false ) and ( gap == 1 )
         end fn

A statement profile gives you insight into the detailed working of your
program, which is useful for both debugging and optimisation.

The beta version has several limitations, which are described in its ReadMe
file, but I thought it worthwhile to release it so as to get feedback on
bugs, suggested enhancements, etc. The download is about 120K.

Robert P.