From 0dc9de81ae9d8fc64a4683ab82e9f1eca9398e1e Mon Sep 17 00:00:00 2001 From: fredb Date: Sat, 2 Sep 2006 11:21:22 +0000 Subject: [PATCH] Add a simple program to benchmark SGTimeStamp::stamp() --- simgear/timing/testtimestamp.cxx | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 simgear/timing/testtimestamp.cxx diff --git a/simgear/timing/testtimestamp.cxx b/simgear/timing/testtimestamp.cxx new file mode 100755 index 00000000..88abc504 --- /dev/null +++ b/simgear/timing/testtimestamp.cxx @@ -0,0 +1,21 @@ + +#include +#include + +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(); +} -- 2.39.5