The compiler destroyed your for loop probably, because nothing useful is
inside.
Try to turn the optimizations off.
Omikron
Dne 11.9.2015 v 20:38 Daniel J napsal(a):
Hi all,
I want to measure the number of cpu cycles between two operations in a
c program. I am running a BBB rev C.1 on Debian (3.8.13-bone70). My
code is pretty simple:
|#include<stdio.h>
#include <time.h>
int main(void) {
clock_t start,stop;|
|start=clock();
int j;
for(j=0;j<12345;j++){
; // burn time
}
stop=clock();
printf("used cycles: %f\n",(long)(stop-start));
return (0);
}
|
The output is not satisfiing
|root@beaglebone:/home/debian# ./getCycles
used cycles:0.000000|
This is the way I always did that in the past as far as I remember.
Did I miss something? Maybe like additional support packages? Thank
you in advance!
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google
Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups "BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.