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 >
Text File  |  2000-04-18  |  735b  |  38 lines

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