Profiling code execution on amd64?

Fabien Thomas fabien.thomas at
Mon Jan 17 09:01:13 UTC 2011

Last time i've used it it was working but I dont think it is really useful now (from my POV) because
you cant have a global view of the system with it and all other reports overlap.

With the current state you have:
- top mode for fast lookup
- text output (replace gprof for me)
- kcachegrind (calltree) for in depth analysis
- gprof 


> On Fri, Jan 14, 2011 at 10:10 PM, Steve Kargl
> <sgk at> wrote:
>> On Fri, Jan 14, 2011 at 03:40:46PM -0500, George Neville-Neil wrote:
>>> On Jan 13, 2011, at 23:05 , Steve Kargl wrote:
>>>> On Thu, Jan 13, 2011 at 10:08:30PM -0500, Ryan Stone wrote:
>>>>> I would suggest using hwpmc for profiling:
>>>>> # kldload hwpmc
>>>>> # pmcstat -S unhalted-cycles -O /tmp/samples.out ../penetration
>>>>> # pmcstat -R /tmp/samples.out -G /tmp/penetration.txt
>>>>> You can also get pmcstat to generate gprof-compatible output with -g,
>>>>> but I never use the mode so I'm really not sure what it gives you.  I
>>>>> think that you have to run gprof on the output or something, but don't
>>>>> hold me to that.
>>>> Thanks.  I'll give it a try, but my initial attempt seems to
>>>> indicate that one needs to be root to use hwpmc.
>>>> laptop:kargl[210] pmcstat -S unhalted-cycles -O /tmp/samples.out ../penetration
>>>> pmcstat: ERROR: Cannot allocate system-mode pmc with specification
>>>> "unhalted-cycles": Operation not permitted
>>> You only need to be root to profile the kernel or someone else's process.
>>> This tutorial might help:
>> Thanks.  I'll look at the tutorial.  Meanwhile, should gprof
>> be removed from the base system because it appears broken?
> Instead of just removing things, why not determine why things are
> broken and try to fix them?
> -Garrett
> _______________________________________________
> freebsd-current at mailing list
> To unsubscribe, send any mail to "freebsd-current-unsubscribe at"

More information about the freebsd-current mailing list