Beispiel #1
0
/* Stop the process of time measure and obtain the sampling time in seconds */
Ipp64f vm_time_stop(vm_time_handle handle, vm_time *m)
{
   Ipp64f speed_sec;
   Ipp64s end;
   Ipp32s freq_mhz;

   if (handle > 0) {
       Ipp32u startHigh, startLow;
       startLow   = ioctl(handle, GET_TSC_LOW, 0);
       startHigh  = ioctl(handle, GET_TSC_HIGH, 0);
       end = ((Ipp64u)startHigh << 32) + (Ipp64u)startLow;
   }
   else {
       end = vm_time_get_tick();
   }
   m->diff += (end - m->start);

   if (handle > 0) {
      if((m->freq == 0) || (m->freq == VM_TIME_MHZ)) {
         ippGetCpuFreqMhz(&freq_mhz);
         m->freq = (Ipp64s)freq_mhz;
      }
      speed_sec = (Ipp64f)m->diff/1000000.0/(Ipp64f)m->freq;
   } else {
      if(m->freq == 0) m->freq = vm_time_get_frequency();
      speed_sec = (Ipp64f)m->diff/(Ipp64f)m->freq;
   }

   return speed_sec;

} /* Ipp64f vm_time_stop(vm_time_handle handle, vm_time *m) */
Beispiel #2
0
void CTimer::Init(void)
{
#ifdef _WIN32
    QueryPerformanceFrequency(&m_freq);
#else
    if(m_ifreq == 0)
        ippGetCpuFreqMhz(&m_ifreq);
#endif
    return;
} // CTimer::Init()