开发者

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 resourc开发者_运维知识库e.

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?


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 :(


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜