#include <dispatch/base.h>
Go to the source code of this file.
Functions | |
uint64_t | dispatch_benchmark (size_t count, void(^block)(void)) |
Count the average number of cycles a given block takes to execute. | |
uint64_t | dispatch_benchmark_f (size_t count, void *ctxt, void(*func)(void *)) |
uint64_t dispatch_benchmark | ( | size_t | count, |
void(^)(void) | block | ||
) |
Count the average number of cycles a given block takes to execute.
This function is for debugging and performance analysis work. For the best results, pass a high count value to dispatch_benchmark(). When benchmarking concurrent code, please compare the serial version of the code against the concurrent version, and compare the concurrent version on different classes of hardware. Please look for inflection points with various data sets and keep the following facts in mind:
1) Code bound by computational bandwidth may be inferred by proportional changes in performance as concurrency is increased. 2) Code bound by memory bandwidth may be inferred by negligible changes in performance as concurrency is increased. 3) Code bound by critical sections may be inferred by retrograde changes in performance as concurrency is increased. 3a) Intentional: locks, mutexes, and condition variables. 3b) Accidental: unrelated and frequently modified data on the same cache-line.
count | The number of times to serially execute the given block. |
block | The block to execute. |
uint64_t dispatch_benchmark_f | ( | size_t | count, |
void * | ctxt, | ||
void(*)(void *) | func | ||
) |