im having trouble timing my loop,
note, this is just part of my main file
#include <iostream>
#include<sys/time.h>
struct timeval tv1, tv2;
struct timezone tz1,tz2;
long totalT;
int const times = 500;
gettimeofday(&tv1, &tz1);
for ( int i = 0; i times; i++)
{
//do something,
}
gettimeofday(&tv2, &tz2);
totalT = (tv2.tv_sec - tv1.tv_sec) * 1000000
+ (tv2.tv_usec - tv1.tv_usec);
cout << "the time it took was: " << totalT << "us" << endl;
when i do my loop for 400 times it does seem to work correctly, but when i do it for more than 500 times it doesnt give me anything, any help on solving this?