Re: performance counter 20% error finding retired instruction count

From: Vince Weaver
Date: Fri Jun 26 2009 - 15:12:51 EST


On Fri, 26 Jun 2009, Vince Weaver wrote:

From the best I can tell digging through the perf sources, the performance counters are set up and started in userspace, but instead of doing an immediate clone/exec, thousands of instructions worth of other stuff is done by perf in between.

and for the curious, wondering how a simple
prctl(COUNTERS_ENABLE);
fork()
execvp()

can cause 6000+ instructions of non-deterministic execution, it turns out that perf is dynamically linked. So it has to spend 5000+ cycles in ld-linux.so resolving the excecvp() symbol before it can actually execvp.

So when trying to get accurate profiles of simple statically linked programs, you still have to put up with the dynamic loader overhead because of the way perf is designed. nice.

Vince
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/