Ignore:
Timestamp:
09/27/07 23:53:07 (12 years ago)
Author:
art
Message:
  • rdtscTimerSource plugin added
  • NOTE: Be carefull on systems with dynamicly changeable frequencies, since the rdtsc instruction may produce wrong results
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Plugins/rdtscTimeSource/TimeSource.cpp

    r1 r55  
    3030{ 
    3131        mCpu = cpu; 
    32          
     32    _isSupported = false; 
     33         
    3334        // check whenever we have got the high performance counter support 
    3435        if (mCpu->isRDTSC()) 
     
    3637                NR_Log(Log::LOG_PLUGIN, "rdtscTimeSource: It seems your CPU supports the \"rdtsc\" instruction"); 
    3738                NR_Log(Log::LOG_PLUGIN, "rdtscTimeSource: High perfromance time counter will be used!"); 
     39        _isSupported = true;       
    3840        } 
    3941} 
     
    5052{ 
    5153        // get current time 
    52         if (mCpu->isRDTSC()){ 
    53                  
     54        if (mCpu->isRDTSC()) 
     55    { 
    5456                // retrive current ticks number 
    5557                uint64 now = _startTimeRT; 
     
    6365                                 
    6466                // calculate current time in seconds 
    65                 _currentTime = (0.001 * float64(b)) / float64(mCpu->getSpeed()) + _syncTime; 
     67                _currentTime = (0.001 * float64(b)) / float64(mCpu->getSpeed()) + _resetTime + _syncTime; 
    6668        } 
    6769         
     
    7173 
    7274//------------------------------------------------------------------------ 
    73 void rdtscTimeSource::reset() 
     75void rdtscTimeSource::reset(float64 startValue) 
    7476{ 
    7577        // check whenever we have got the RDTSC support 
     
    7779                mCpu->rdtsc(_startTimeRT); 
    7880        } 
    79          
     81        _resetTime = startValue; 
    8082} 
    8183 
Note: See TracChangeset for help on using the changeset viewer.