user1811367
user1811367

Reputation: 297

How code profilers can be incorrect

I've read and experienced performance profilers be incorrect some times. Sometimes they generate incorrect run times for certain functions, and display call graphs that don't really exist. I'm wondering how these errors generally occur and what are the main causes for these errors?

Upvotes: 1

Views: 48

Answers (1)

Mike Dunlavey
Mike Dunlavey

Reputation: 40669

The question is broad because many things are called profilers, measuring different things, from memory allocation to pipeline flushes.

Part of the problem is conceptual. For example you (and others) say "incorrect run times for certain functions". That term "run time" needs a definition. Does it mean "total run time summed over all invocations", or "average run time per invocation"? Does it include called functions? Does it mean just CPU time, or wall-clock elapsed time? That's just one example of fuzzy thinking.

There's a deeper conceptual problem many people have. They think they are looking for "slow functions". I don't know where they get that idea, possibly from somebody at the head of a class. Opportunities for speedup do not confine themselves to particular functions, and you can't ignore the ones that don't, if speed is the objective.

Also, they think as long as they are measuring, the accuracy of those measurements is important. It does not help find speed bugs.

IMHO, rather than try to diagnose the shortcomings of profilers, one should 1) un-learn all the myths around the subject, and 2) accentuate the positive and learn about what does work.

Upvotes: 1

Related Questions