I'm not passing any flags related to code generation, I don't think.
 
$HC -H64m -O -Rghc-timing -package array -H32m -hisuf hi -O1 -rtsopts -c Main.hs -o Main.o
 
So that'd just be the native code generator, right?.
 
$ uname -a
Linux cam-05-unx 3.2.0-35-generic #55-Ubuntu SMP Wed Dec 5 17:42:16 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
 
Is there a objdump-ish way to directly look for these .size directives?
 
Thanks Johan.


On Fri, Feb 15, 2013 at 6:18 PM, Johan Tibell <johan.tibell@gmail.com> wrote:
On Fri, Feb 15, 2013 at 10:05 AM, Nicolas Frisby <nicolas.frisby@gmail.com> wrote:
I'm way below my depth here, but I'd like to use the perf tool to see where a program is spending its time.
 
Unfortunately, the recipe here
 
 
isn't working for me. I get output like this instead
 
90.20%  drbg_test  drbg_test          [.] 0x2515ef
  5.71%  drbg_test  [kernel.kallsyms]  [k] 0xffffffff8103e0ca
  1.53%  drbg_test  libc-2.15.so       [.] bsearch
  1.02%  drbg_test  libc-2.15.so       [.] 0x9194c
  0.43%  drbg_test  libgmp.so.10.0.2   [.] __gmpz_mul_2exp
  0.27%  drbg_test  libgmp.so.10.0.2   [.] __gmpz_add
  0.16%  drbg_test  [vdso]             [.] 0x7fffd3d25983
  0.16%  drbg_test  libgmp.so.10.0.2   [.] __gmpn_lshift
  0.10%  drbg_test  libgmp.so.10.0.2   [.] 0x13565
  0.05%  drbg_test  libgmp.so.10.0.2   [.] __gmpz_init
  0.05%  drbg_test  libc-2.15.so       [.] __select
  0.05%  drbg_test  libgmp.so.10.0.2   [.] __gmpn_modexact_1_odd
  0.05%  drbg_test  libgmp.so.10.0.2   [.] __gmpz_realloc
  0.05%  drbg_test  libc-2.15.so       [.] __errno_location
  0.05%  drbg_test  drbg_test          [.] __gmpz_init@plt
  0.05%  drbg_test  librt-2.15.so      [.] clock_gettime
  0.05%  drbg_test  libgmp.so.10.0.2   [.] __gmpn_add_n
 
Again --- below my depth here --- but I don't know how to investigate what 0x2515ef indicates. Does anyone have any pointers?
 
I was hoping that the address would be a nice RTS-ish symbol, like in the Wiki's examples.

I thought I fixed this issue (at least in the native backend). What was missing before was .size assembler directives that would let tools like perf know where a function started and ended. See this commit https://github.com/ghc/ghc/commit/32f24ddfd9549010dd345733c6f46f67196cacf6

Perhaps it broke at some point? Are you using the x86 backend?