Eric Anastas
Eric Anastas

Reputation: 22233

Is it possible to profile part of a method with Eqatec Profiler through its API?

I'm using Equatec profiler to diagnose a slow process of my application. I figured out which method is slow, but I want to know specifically which part of the method is slow. Aside from breaking up the method into multiple methods is there a way through the Eqatec Profiler API to mark specific sections of a method to be profiled separately from the entire method?

Upvotes: 0

Views: 268

Answers (2)

Richard Flamsholt
Richard Flamsholt

Reputation: 693

As of the current version 3.8.14: No, that's not possible. It would be a wonderful refinement, but it's not on EQATEC's immediate roadmap.

Upvotes: 0

Mike Dunlavey
Mike Dunlavey

Reputation: 40707

Equatec is a good profiler, but in my experience here's what happens in a good-size .net app.

You may find a routine that's active a good percent of the time, like 20%, and you might even find a particular "hot" line inside it, but you can look at it and not really know what to do about it, because as far as you can tell, it's necessary.

At the same time, there could be something bigger than that lurking in the code that doesn't really show up very well in the profiler, because it's not confined to one routine.

If I can just give one example, I've seen an app that spends roughly 50% of it's startup time 20-30 levels deep in the call stack getting strings from resources just so it can display them to the user to let them know what's taking so long. If it found another way to do that it would start up twice as fast! The ANTS profiler (another good one) gave no clue as to what was happening.

How did I find it? The old-time method, same way it's done here, and is explained here.

The following graph shows, if you manually sample the stack N times, by pausing the program, and on two of those samples you see it doing something you could replace with something much faster, the amount of time you can expect to save, and the corresponding speedup ratio.

For example, the red curve (2/5) means if you take five stack samples, and you see what you could improve on two of them, you don't know precisely how much you will save. However, the most likely value is 2/5(40%, speedup 67%), the average is 3/7(43%, speedup 75%), and it would be somewhere in the range roughly between 10% (speedup 11%) and 70% (speedup 3.33x). That's in case you're thinking you can't trust small numbers of samples. Not a bad gamble. If you want more certainty, take more samples.

Beta distribution of cost for seeing something on S samples out of N total samples.

(Plot of Beta distribution X ~ Be( number of hits + 1, number of misses + 1 ) and Speedup = 1/(1-X).)

Upvotes: 1

Related Questions