Click here to Skip to main content
13,007,145 members (61,360 online)
Click here to Skip to main content
Add your own
alternative version


31 bookmarked
Posted 3 Feb 2005

A simple .NET Profiler

, 10 Apr 2006
Rate this:
Please Sign up or sign in to vote.
A DLL helping to measure process time in your applications.


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:


wherever you want (and if applicable). This will close the current log file and create a new one.


2005-Jan-31 - First release - 2.0.0.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Peter Schlang
Web Developer
Germany Germany
Peter Schlang, working with computers since 1974
Developing mainly for newspapers since 1981, first as employee of ATEX
Freelancer since 1987
Preferred language is VB: Starting with VB 1.0 and VBDOS, up to VB.NET

You may also be interested in...

Comments and Discussions

Generalplenty of existing products Pin
Kuno Meyer22-Aug-08 5:02
memberKuno Meyer22-Aug-08 5:02 
GeneralVery nice Pin
dwaterfield21-Apr-06 9:26
memberdwaterfield21-Apr-06 9:26 
GeneralDoes not work ... Pin
neil young19-Apr-06 11:08
memberneil young19-Apr-06 11:08 
GeneralRe: Does not work ... Pin
Peter Schlang20-Apr-06 6:52
memberPeter Schlang20-Apr-06 6:52 
GeneralTwo articles Pin
Vladimir Afanasyev3-Feb-05 23:32
memberVladimir Afanasyev3-Feb-05 23:32 
GeneralRe: Two articles Pin
psc_exec3-Feb-05 23:41
memberpsc_exec3-Feb-05 23:41 
GeneralRe: Two articles Pin
Vladimir Afanasyev4-Feb-05 0:01
memberVladimir Afanasyev4-Feb-05 0:01 
GeneralReadable data Pin
Klapouchy3-Feb-05 22:29
memberKlapouchy3-Feb-05 22:29 
GeneralRe: Readable data Pin
psc_exec3-Feb-05 22:56
memberpsc_exec3-Feb-05 22:56 
GeneralRe: Readable data Pin
Klapouchy3-Feb-05 23:18
memberKlapouchy3-Feb-05 23:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170628.1 | Last Updated 10 Apr 2006
Article Copyright 2005 by Peter Schlang
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid