// Author: Doug Moore. Feb. 17, 2000. For CS 475. // Purpose: illustrate use of stopwatch class for measuring // process execution times. #include "stopwatch.h" #include using namespace std; long i; long j=0; float test; int main() { // Create instance of class stopWatch Loop1; // Get CPU time for this process up till now Loop1.set_start(); // Do something which will take some CPU time for(long i=0;i<100000000;i++) { j=j+i; } // Get cummulative CPU time till now, then elapsed time. Loop1.set_stop(); test=Loop1.get_elapsed(); // Report cout << "The Loop (Loop1) took " << test << " seconds to complete" << endl; return 0; }