Files
csapp2025/perflab/poly/fcyc.h
2025-04-12 10:18:45 +08:00

53 lines
1.3 KiB
C

/* Fcyc measures the speed of any "test function." Such a function
is passed a list of integer parameters, which it may interpret
in any way it chooses.
*/
typedef void (*test_funct)(long int *);
/* Compute number of cycles used by function f on given set of parameters */
double fcyc(test_funct f, int* params);
/***********************************************************/
/* Set the various parameters used by measurement routines */
/* When set, will run code to clear cache before each measurement
Default = 0
*/
void set_fcyc_clear_cache(long int clear);
/* Set size of cache to use when clearing cache
Default = 1<<19 (512KB)
*/
void set_fcyc_cache_size(long int bytes);
/* Set size of cache block
Default = 32
*/
void set_fcyc_cache_block(long int bytes);
/* When set, will attempt to compensate for timer interrupt overhead
Default = 0
*/
void set_fcyc_compensate(long int compensate);
/* Value of K in K-best
Default = 3
*/
void set_fcyc_k(long int k);
/* Maximum number of samples attempting to find K-best within some tolerance.
When exceeded, just return best sample found.
Default = 20
*/
void set_fcyc_maxsamples(long int maxsamples);
/* Tolerance required for K-best
Default = 0.01
*/
void set_fcyc_epsilon(double epsilon);