Subject: Userland "cc -pg (gprof) profiling: working well on amd64?
To: None <tech-kern@netbsd.org, port-amd64@netbsd.org>
From: Jonathan Stone <jonathan@dsg.stanford.edu>
List: port-amd64
Date: 03/21/2006 20:16:02
Is profiling of userland code expected to work on amd64?  On either
-current or netbsd-3?

I ask because I've been trying to profile some of my own old code, in
hopes of better understanding a 2:1 difference in user-CPU time (to
NetBSD's disadvantage), between recent Linux distros and NetBSD, on
one of my local apps

I'm consistently seeing the total user time reported by gprof is only
(very coarsely) 30% of the runtime reported by time (csh or
/usr/bin/time); and (after some brute-force adhoc VM tuning),
wall-time and CPU-time for my app are both matching
externally-measured wall-time fairly closely, on an otherwise-idle
machine.

I'm wondering if the gprof data is uniformly missing samples, or the
scaling is buggy, or something else mysterious is going on.
(Stack smashing by the app is one possibility).

The host I'm using is an dual-core socket-939 amd64, with either a
-current as of late February, or NetBSD-3.0 (or RC6, I forget which,
but that's pretty close to 3.0).

Thanks in advance to anyone who shares relevant experiences,
(positive or otherwise).

--Jonathan