Add a simple program to benchmark SGTimeStamp::stamp()
This commit is contained in:
21
simgear/timing/testtimestamp.cxx
Executable file
21
simgear/timing/testtimestamp.cxx
Executable file
@@ -0,0 +1,21 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <simgear/timing/timestamp.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main()
|
||||
{
|
||||
cout << "About to benchmark SGTimeStamp for 5 seconds. Press ENTER when ready." << endl;
|
||||
int c = cin.get();
|
||||
long nb = 0;
|
||||
SGTimeStamp start, now;
|
||||
start.stamp();
|
||||
do {
|
||||
nb += 1;
|
||||
now.stamp();
|
||||
} while ( ( now - start ) < 5000000 );
|
||||
|
||||
cout << ( nb / 5 ) << " iterations per seconds. Press ENTER to quit." << endl;
|
||||
c = cin.get();
|
||||
}
|
||||
Reference in New Issue
Block a user