Jorge Córdoba
Jorge Córdoba

Reputation: 52123

Profiling Library for .NET

Edit: I'm NOT asking for a way to implement a profiling library, I'm asking if there's one (preferably free) out there.

Although there are a lot of commercial and free profilers for the .NET platform they all analyses (better or worse) your application code in a way that let's you see what method call or even line is consuming a lot of resource.

While that might be useful in a lot of quick optimization situations I was interested in a more direct "library" approach. Basically I have in mind something that lets me define scenarios with checkpoints so that I can profile and compare between versions any two given scenarios.

I want to be able to define something like:

Mon.StartScenario("ClientReportsTime");
// Get All clients
//...
Mon.CheckPoint(); // You should be able to see memory ussage 
                 //and time taken to reach this point.
// Extract information
//..
Mon.CheckPoint();
// Finished!!
Mon.StopScenario("ClientReportsTime");

So that an scenario has a given time that can be precisely identified. It's a relatively simple piece of functionality and I was about to implement it as a library when I thought that might be out there somewhere. Do you know about some existing library like that?

Upvotes: 0

Views: 324

Answers (3)

Mike Dunlavey
Mike Dunlavey

Reputation: 40649

If you had a choice between

  1. Something that would give you precise timing of problems but only imprecisely locate them, or

  2. Something that would give you precise location of problems but only imprecisely time them,

which would you prefer?

This method does the latter.

Upvotes: 1

Schmuli
Schmuli

Reputation: 743

What about using Performance Counters? That would work, as you define a Performance Counter for the scenario, and then use the available methods (such as Increment, IncrementBy, etc.) to record the checkpoints. For more info see: http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter(lightweight).aspx.

Upvotes: 1

leppie
leppie

Reputation: 117220

You could look at the Process info for your own app, and perhaps record more info from WMI.

Unfortunately, it does not really give you much to go on :(

Upvotes: 1

Related Questions