IIS Development

IisDev

>  Home
>  News

 

Articles

>  Code Samples
>  ASP.NET
>  Security

 

Components & Tools

>  Free Components

 

Service

>  Links
>  Contact us

ASP Profiling Component - free

Last updated: 12/11/98, First release, MFC Version


Guessing speed improvements of one piece of code to another is at best lost time. If you can't measure it, it isn't worth the effort. Just take into account database access: which cursor to choose for maximum speed? Or changing the order of For loops - which one is really faster and does it pay off to change it?

Take the guessing out of your decisions: measure the runtime of your code (=profile it!). The component presented in this article helps you by providing functions to do exactly this-with two different methods (one less exact but well-known, one much more exact, however, less known). As there are only four functions, we dive into programming immediately. A small code snippet shows you how to measure the runtime of your code using the component:

<%
Dim xObj, i
Dim timerStart, timerDiff, profileElapsed

Set xObj = Server.CreateObject("Softwing.Profiler")

' has a ten milliseconds resolution; nothing is stored in the object
timerStart = xObj.GetTickCount()
For i = 1 To 10000
Next
timerDiff = xObj.GetTickDifference(CLng(timerStart))

' ProfileStart stores the initial count in the object; just to discourage you
' to make the mistake of using MTS to improve "performance" of this component
xObj.ProfileStart()
For i = 1 To 10000
Next
profileElapsed = xObj.ProfileStop()

' all results are given in milliseconds
Response.Write "Tick Count is (already multiplied): " & timerDiff*10 & "<BR>"
Response.Write "High Resolution: " & profileElapsed & "<BR>"
%>

This script uses the four functions implemented in the component: the GetTickCount / GetTickDifference pair and the other two you are encouraged to use because of the much higher resolution: ProfileStart and ProfileStop (fyi, these use QueryPerformanceCounter). Just to show you the difference in resolution, I have provided the numbers I got from running the component with the above code:

Tick Count is (already multiplied): 150
High Resolution: 137.352882505486

That said, start using the component to profile your scripts now to see if they can (or should) be improved. One last important notice: you are not limited to using this component in ASP only - every other scripting or programming enviroment can be used too (like the MS Office suite).

Before using the component you have to register it using the regsvr32 utility: regsvr32 profiler.dll.

Download Component only (size is approx. 62KB)
The most current version number of the component is 1.1. It is compiled with Visual C++ 6.0 SP1, MFC statically linked. The Visual Basic version is discontinued.

If you do have any questions, please feel free to send mail to Christoph Wille.

 

©1998-2018 Christoph Wille. All rights reserved.
All content and images on this site are copyright. Reuse (even parts) needs our written consent.