Introduction
When optimizing my programs, I usually had the question: 'Which of my functions needs most of the time?'. Searching the web, I did not find any remarkable solution for my issue. So I had to resolve it by myself, I wrote a small DLL to be called from any of my .NET programs.
It measures the time needed inside the actual function and writes the result to a disk file, averaging (maximizing, minimizing etc.) the time used to process the function.
The DLL is rather simple, the source code consists of 160 lines (including comment lines).
Using the code
To use pscProfilEx, you must:
- Reference '
pscProfilEx
'.
- Define '
Public <myProfile> As New pscProfilEx.CProfilEx
'.
- At the start of your application, insert
<myProfile>.profileOpen("<logFileName>")
.
- At the start of the function to be profiled, insert
<myProfile>.profileStart("<function name>")
.
- At the end of this function, insert
<myProfile>.profileEnd()
.
- When leaving your application, insert
<myProfile>.profileClose()
.
Maybe you want to avoid an 'endless' profiling inside a program running in a loop. Then, e.g., following a timer, counter or other criterion, you may insert:
<myProfile>.profileClose()
<myProfile>.profileOpen(<newLogFileName>)
wherever you want (and if applicable). This will close the current log file and create a new one.
History
2005-Jan-31 - First release - 2.0.0.