views:

348

answers:

2

I want to find profiler like vtune or oprofile on FreeBSD. Do you know any similar?

+1  A: 

Well, if you're trying to find a performance problem, it doesn't use a profiler, but this works.

Mike Dunlavey
This method can only find big performance problem. If the problem is not a single bottleneck, profiler is prefered because it gives statistics measure.
kcwu
@kcwu: You might assume that, but in fact it is as effective, or more effective, than any profiler. Unfortunately, profilers are based on faulty assumptions. I'll be glad to explain in depth if you like, but that link is a pretty good explanation.
Mike Dunlavey
hmm, I think this method is more effective for non sample-based profiler than for sample-based profiler. To some extend, this method samples just few times manually and sample-based profiler could sample thousands or more times automatically.
kcwu
@kcwu: You might be interested in this commentary: http://stackoverflow.com/questions/847876/is-there-any-performance-difference-between-for-and-while/855945#855945
Mike Dunlavey
... The method can be automated. Anyway, among the faulty assumptions is that statistical precision matters, and that precision of problem location does not. The method of sampling the call stack reverses those priorities. When it is iterated, it works very well at finding every single way in which the program can be optimized. This is evident to those who have tried it. Anyway, good luck.
Mike Dunlavey
... another link: http://stackoverflow.com/questions/368831/how-to-write-a-profiler/738647#738647
Mike Dunlavey
... and another link: http://stackoverflow.com/questions/368831/how-to-write-a-profiler/874632#874632
Mike Dunlavey
+2  A: 

The equivalent of oprofile on FreeBSD is hwpmc. It can do both system and process profiling; as of FreeBSD 7.2 it has callchain capture. There's lots of information about it at http://wiki.freebsd.org/PmcTools and the pmcstat man page contains instructions for profiling applications too.

BruceCran