Skip to content

Instantly share code, notes, and snippets.

@awreece
Created January 12, 2013 02:38
Show Gist options
  • Save awreece/4515768 to your computer and use it in GitHub Desktop.
Save awreece/4515768 to your computer and use it in GitHub Desktop.
% pprof --disas=thread_scan a.out a.out.prof
Using local file a.out.
Using local file a.out.prof.
Removing _L_unlock_16 from all stack traces.
ROUTINE ====================== thread_scan
199 1087 samples (flat, cumulative) 103.4% of total
-------------------- .../andrew.cmu.edu/usr9/areece/15-418/profiling/try_perf.c
. . 60: void* thread_scan(void* void_arg) {
. . 400869: push %rbp
. . 40086a: mov %rsp,%rbp
. . 40086d: sub $0x28,%rsp
. . 400871: mov %rdi,-0x28(%rbp)
. . 62: thread_arg_t* args = (thread_arg_t*) void_arg;
. . 400875: mov -0x28(%rbp),%rax
. . 400879: mov %rax,-0x10(%rbp)
. 7 65: for (i = 0; i < args->size; i++) {
. . 40087d: movq $0x0,-0x8(%rbp)
. 7 400885: jmp 4008c9 <thread_scan+0x60>
41 80 66: uint32_t val = args->input[i];
7 7 400887: mov -0x10(%rbp),%rax
. 2 40088b: mov (%rax),%rax
2 2 40088e: mov -0x8(%rbp),%rdx
. 3 400892: shl $0x2,%rdx
3 4 400896: add %rdx,%rax
1 29 400899: mov (%rax),%eax
28 33 40089b: mov %eax,-0x14(%rbp)
26 744 67: uint32_t sqrt = integer_square_root(val);
5 17 40089e: mov -0x14(%rbp),%eax
12 14 4008a1: mov %eax,%edi
2 698 4008a3: callq 40080c <integer_square_root>
7 15 4008a8: mov %eax,-0x18(%rbp)
39 74 68: if (sqrt * sqrt == val) {
8 21 4008ab: mov -0x18(%rbp),%eax
13 31 4008ae: imul -0x18(%rbp),%eax
18 18 4008b2: cmp -0x14(%rbp),%eax
. 4 4008b5: jne 4008c4 <thread_scan+0x5b>
10 90 69: __sync_fetch_and_add(args->num_perfect_squares, 1);
4 7 4008b7: mov -0x10(%rbp),%rax
3 6 4008bb: mov 0x10(%rax),%rax
3 77 4008bf: lock addq $0x1,(%rax)
83 92 65: for (i = 0; i < args->size; i++) {
74 76 4008c4: addq $0x1,-0x8(%rbp)
2 2 4008c9: mov -0x10(%rbp),%rax
. 7 4008cd: mov 0x8(%rax),%rax
7 7 4008d1: cmp -0x8(%rbp),%rax
. . 4008d5: ja 400887 <thread_scan+0x1e>
. . 72: }
. . 4008d7: leaveq
. . 4008d8: retq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment