Thursday, December 02, 2010

Brute force pbtrace.log processing (take 3)

More recent versions of PowerBuilder store out the timing information differently, so the method references in earlier blog posts needs to be updated.



The trace file timestamp entries are now in the form of:

DBPARM=TimeStamp=0 (0.000 MS / 39.950 MS)

Where the first number of milliseconds is for the current call and the second one is the cumlative time for the run.

Set up the spreadsheet as indicated in the previous blog posts.  However, the formulas need to be adjusted.

For the 1st column, use the following formula now:

=IF(ISERROR(SEARCH("MS /",D1)),0,SEARCH("MS /",D1))

For the 2nd column, use the Excel VBA function (FindRev) indicated in the earlier post.

Public Function FindRev(sFind_Text As String, sWithin_Text As String) As Integer
FindRev = InStrRev(sWithin_Text, sFind_Text, -1, vbTextCompare)
End Function

In more recent versions of Excel, make sure you do an Insert Module in the VBA editor before adding the function.  The forumla for the second column then is still:

=IF(A1>0,FindRev("(",D1),0)

And the 3rd column's formula is still:

=IF(A1>0,VALUE(MID(D1,B1+1,A1-B1-2)),0)

You might then add Conditional Formatting to the 3rd column (perhaps the red, yellow, green one) to make the problematic statements stand out.

No comments: