Created
January 12, 2013 02:30
-
-
Save awreece/4515742 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% pprof --list=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 in /afs/andrew.cmu.edu/usr9/areece/15-418/profiling/try_perf.c | |
199 1087 Total samples (flat / cumulative) | |
. . 55: size_t size; | |
. . 56: size_t* num_perfect_squares; | |
. . 57: mutex_t * num_perfect_squares_lock; | |
. . 58: } thread_arg_t; | |
. . 59: | |
--- | |
. . 60: void* thread_scan(void* void_arg) { | |
. . 61: // TODO(awreece) Copy locally so dont interfere with each other. | |
. . 62: thread_arg_t* args = (thread_arg_t*) void_arg; | |
. . 63: size_t i; | |
. . 64: | |
83 99 65: for (i = 0; i < args->size; i++) { | |
41 80 66: uint32_t val = args->input[i]; | |
26 744 67: uint32_t sqrt = integer_square_root(val); | |
39 74 68: if (sqrt * sqrt == val) { | |
10 90 69: __sync_fetch_and_add(args->num_perfect_squares, 1); | |
. . 70: } | |
. . 71: } | |
. . 72: } | |
--- | |
. . 73: | |
. . 74: int main(int argc, char** argv) { | |
. . 75: size_t size = 1<<27; | |
. . 76: uint32_t* inarray = (uint32_t*) malloc(size * sizeof(uint32_t)); | |
. . 77: size_t i; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment