class TimeCount
{
public:
TimeCount(void);
~TimeCount(void);
void StartCount();
void EndCount(OUT double * seconds = NULL, IN bool print=false);
private:
clock_t m_start;
clock_t m_end;
};
TimeCount::TimeCount(void)
{
}
TimeCount::~TimeCount(void)
{
}
void TimeCount::StartCount()
{
m_start = clock();
}
void TimeCount::EndCount( OUT double * seconds /*= NULL*/, IN bool print )
{
m_end = clock();
double z_seconds = ((double)(m_end-m_start))/CLOCKS_PER_SEC;
if (seconds!=NULL)
{
*seconds = z_seconds;
}
if (print)
{
printf("<>函数执行了%f秒<> \n", z_seconds );
}
}