Skip to content
Armando Faz edited this page Jul 22, 2016 · 1 revision

#Benchmarking Scripts for C-language This set of scripts is intended for measuring the amount of clock cycles spent in a computation. Functions that take only few milliseconds result difficult to compare, instead measuring clock cycles is a better approach. Additionally, comparing between different computers allows to isolate the effects of different clock frequencies.

BENCH Variable

This is a unsigned variable that must be defined before measuring.

unsigned long long BENCH = 1000;

CLOCKS Function

The clocks function measures the clock cycles of a specified function. Measuring is taken right before and after the function is called.

CLOCKS(RANDOM,FUNCTION)

FUNCTION is called BENCH x BENCH times, every BENCH times the RANDOM function is called.

oper_second Function

This function measures time, operations per second and clock cycles. It can be used to measure throughput of a function.

oper_second(RANDOM, FUNCTION)

FUNCTION is called 10^6 times.


Clone this wiki locally