Updated timing script

release/4.3a0
Frank Dellaert 2019-06-15 14:45:10 -04:00 committed by Fan Jiang
parent f5b57ce59f
commit a573658ba4
1 changed files with 18 additions and 18 deletions

View File

@ -26,16 +26,16 @@ using namespace gtsam;
#define TEST(TITLE, STATEMENT) \
cout << endl << TITLE << endl; \
timeLog = clock(); \
for(int i = 0; i < n; i++)\
STATEMENT;\
for (int i = 0; i < n; i++) STATEMENT; \
timeLog2 = clock(); \
seconds = (double)(timeLog2-timeLog)/CLOCKS_PER_SEC;\
cout << seconds << " seconds" << endl;\
cout << ((double)n/seconds) << " calls/second" << endl;
seconds = static_cast<double>(timeLog2 - timeLog) / CLOCKS_PER_SEC; \
cout << 1000 * seconds << " milliseconds" << endl; \
cout << (1e9 * seconds / static_cast<double>(n)) << " nanosecs/call" << endl;
int main()
{
int n = 100000; long timeLog, timeLog2; double seconds;
int main() {
int n = 100000;
clock_t timeLog, timeLog2;
double seconds;
// create a random direction:
double norm = sqrt(1.0 + 16.0 + 4.0);
double x = 1.0 / norm, y = 4.0 / norm, z = 2.0 / norm;