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 >
Wrap
C/C++ Source or Header
|
2000-04-18
|
786b
|
40 lines
#include "frame_rate.h"
ClassFrameRate::ClassFrameRate()
{
counter_time = 0;
}
int ClassFrameRate::PrintAverageFR(int marra)
{
if (counter_time == 0){
start = clock();
counter_time++;
} else
if (counter_time == marra) {
finish = clock();
frame_rate = (double) marra * (double) CLOCKS_PER_SEC / (double) (finish-start);
cout << "Frame Rate = " << frame_rate << endl;
counter_time = 0;
} else
counter_time++;
return frame_rate;
}
float ClassFrameRate::GetElapsedTime(int marra, float time)
{
if (counter_time2 == 0){
start2 = clock();
counter_time2++;
} else
if (counter_time2 == marra) {
finish2 = clock();
counter_time2 = 0;
return (float) ((finish2-start2)/(float) CLOCKS_PER_SEC)/(float) marra;
} else
counter_time2++;
return time;
}