#include <oski/timer.h>
#include "stat.h"
Go to the source code of this file.
Defines | |
#define | INC_UTIL_TIMING_H |
util/timing.h included. | |
#define | TIMING_LOOP_CORE(CODE, PRE_CODE, POST_CODE, outer_iters, inner_iters, times) |
Generic macro to time an arbitrary piece of C code using the BeBOP Tempo timer (see oski/timer.h). | |
#define | CALC_MIN_ITERS(CODE, PRE_CODE, POST_CODE, min_time, num_iters) |
Compute the minimum number of inner iterations needed to consume some minimum amount of execution time. | |
#define | DUMMY_CODE |
Do nothing code. | |
#define | TIMING_LOOP_BASIC(CODE, num_trials, num_ops, speed) |
Basic timing loop. |
|
Compute the minimum number of inner iterations needed to consume some minimum amount of execution time.
|
|
Value: { \ double* outer_times_; \ size_t min_inner_; \ \ outer_times_ = oski_Malloc( double, (num_trials) ); \ ABORT( outer_times_ == NULL, TIMING_LOOP_BASIC, ERR_OUT_OF_MEMORY ); \ \ CALC_MIN_ITERS( CODE, DUMMY_CODE, DUMMY_CODE, .2, min_inner_ ); \ TIMING_LOOP_CORE( CODE, DUMMY_CODE, DUMMY_CODE, \ (num_trials), min_inner_, outer_times_ ); \ (speed) = \ (double)(num_ops) / stat_CalcMin(outer_times_, num_trials); \ \ oski_Free( outer_times_ ); \ }
|
|
Generic macro to time an arbitrary piece of C code using the BeBOP Tempo timer (see oski/timer.h). The timing loop is actually a doubly-nested loop: an 'outer' loop, and an 'inner' loop structured roughly as follows: FOR i = 1 to outer_iters DO EXECUTE caller's PRE_CODE. Start_timer(); FOR j = 1 to inner_iters DO EXECUTE CODE. END Stop_timer(); EXECUTE caller's POST_CODE. t = Read_elapsed_time(); times[i] = t / inner_iters; END
|