RMOL Logo Get Revenue Management Optimisation Library at SourceForge.net. Fast, secure and Free Open Source software downloads

timer.cpp

Go to the documentation of this file.
00001 #include <itpp/itbase.h>
00002 
00003 using namespace itpp;
00004 
00005 //These lines are needed for use of cout and endl
00006 using std::cout;
00007 using std::endl;
00008 
00009 int main()
00010 {
00011   //Declare the scalars used:
00012   long i, sum, N;
00013 
00014   //Declare tt as an instance of the timer class:
00015   Real_Timer tt;
00016 
00017   //Initiate the variables:
00018   N = 1000000;
00019   sum = 0;
00020 
00021   //Start and reset the timer:
00022   tt.tic();
00023 
00024   //Do some processing
00025   for (i=0; i<N; i++) {
00026     sum += i;
00027   }
00028 
00029   // Print the elapsed time
00030   tt.toc_print();
00031 
00032   //Print the result of the processing:
00033   cout << "The sum of all integers from 0 to " << N-1 << " equals " << sum << endl;
00034 
00035   //Exit program:
00036   return 0;
00037 
00038 }
SourceForge Logo

Generated on Sat Sep 26 13:13:51 2009 for RMOL by Doxygen 1.6.1