home *** CD-ROM | disk | FTP | other *** search
/ ftp.hitl.washington.edu / ftp.hitl.washington.edu.tar / ftp.hitl.washington.edu / pub / people / habib / kodak / frame_rate.cc < prev    next >
C/C++ Source or Header  |  2000-04-18  |  786b  |  40 lines

  1. #include "frame_rate.h"
  2.  
  3. ClassFrameRate::ClassFrameRate()
  4. {
  5.     counter_time = 0;
  6. }
  7.  
  8. int ClassFrameRate::PrintAverageFR(int marra)
  9. {
  10.     if (counter_time == 0){
  11.         start = clock();
  12.         counter_time++;
  13.     } else
  14.     if (counter_time == marra) {
  15.         finish = clock();
  16.     frame_rate = (double) marra * (double) CLOCKS_PER_SEC / (double) (finish-start);
  17.         cout << "Frame Rate = " << frame_rate  << endl;
  18.         counter_time = 0;
  19.     } else 
  20.         counter_time++;
  21.   return frame_rate;
  22. }
  23. float ClassFrameRate::GetElapsedTime(int marra, float time)
  24. {
  25.     if (counter_time2 == 0){
  26.         start2 = clock();
  27.         counter_time2++;
  28.     } else
  29.     if (counter_time2 == marra) {
  30.         finish2 = clock();
  31.         counter_time2 = 0;
  32.         return (float) ((finish2-start2)/(float) CLOCKS_PER_SEC)/(float) marra;
  33.         
  34.     } else 
  35.         counter_time2++;
  36.     return time;
  37. }
  38.  
  39.  
  40.