Files
AK2-ARMv7lab/fibb/sec_ccnt.c
T
2020-06-22 17:31:00 +02:00

36 行
515 B
C

#include <stdio.h>
#include <time.h>
// Jan Potocki 2020
unsigned long timestamp();
int main()
{
unsigned long tstamp1, tstamp2;
tstamp1 = timestamp();
// Tego z jakiegos powodu nie mozna zrobic za pomoca sleep(1)...
// ...cykle nie sa zliczane prawidlowo - wiec goraca petla
clock_t t;
do
{
t = clock();
}
while(t < CLOCKS_PER_SEC);
tstamp2 = timestamp();
if(tstamp2 > tstamp1)
{
printf("Cycles: %lu\n", tstamp2-tstamp1);
}
else
{
printf("Cycles: invalid measure\n");
}
return 0;
}