Quote:
Originally Posted by nushki
...it outputs 0 all the time.
|
That's because your process is using basically no processor time, since it's not doing anything. Try doing something like this (with
out enabling any optimization):
Code:
#include <stdio.h>
#include <time.h>
int main(void)
{
clock_t end, start;
start = clock();
int i;
printf("initial %d\n", (int) start);
for (i = 0; i < 20; i++) {
end = clock();
printf("Time elapsed: %d\n", (int) end);
int p, q, r;
for (p = 0 ; p < 1000 ; p++)
for (q = 0 ; q < 1000 ; q++)
for (r = 0 ; r < 1000 ; r++)
printf("");
}
}