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