예제 #1
0
/**
 *  타임 스탬프 카운터를 읽음  
 */
void kReadTimeStampCounter( const char* pcParameterBuffer )
{
    QWORD qwTSC;
    
    qwTSC = kReadTSC();
    kPrintf( "Time Stamp Counter = %q\n", qwTSC );
}
예제 #2
0
/**
 *  프로세서의 속도를 측정
 */
static void kMeasureProcessorSpeed( const char* pcParameterBuffer )
{
    int i;
    QWORD qwLastTSC, qwTotalTSC = 0;
        
    kPrintf( "Now Measuring." );
    
    // 10초 동안 변화한 타임 스탬프 카운터를 이용하여 프로세서의 속도를 간접적으로 측정
    kDisableInterrupt();    
    for( i = 0 ; i < 200 ; i++ )
    {
        qwLastTSC = kReadTSC();
        kWaitUsingDirectPIT( MSTOCOUNT( 50 ) );
        qwTotalTSC += kReadTSC() - qwLastTSC;

        kPrintf( "." );
    }
    // 타이머 복원
    kInitializePIT( MSTOCOUNT( 1 ), TRUE );
    kEnableInterrupt();
    
    kPrintf( "\nCPU Speed = %d MHz\n", qwTotalTSC / 10 / 1000 / 1000 );
}
예제 #3
0
// Measure the speed of processor
void kMeasureProcessorSpeed( const char * pcParameterBuffer )
{
	int i;
	QWORD qwLastTSC, qwTotalTSC = 0;
	
	kPrintf( "Now Measuring." );
	
	// For 10 seconds, calculate processor speed by measuring the change of time stamp
	kDisableInterrupt();
	for ( i = 0 ; i < 200 ; i++ )
	{
		qwLastTSC = kReadTSC();
		kWaitUsingDirectPIT( MSTOCOUNT( 50 ) );
		qwTotalTSC += kReadTSC() - qwLastTSC;
		
		kPrintf( "." );
	}

	// Restore timer 
	kInitializePIT( MSTOCOUNT( 1 ), TRUE );
	kEnableInterrupt();
	
	kPrintf( "\nCPU Speed = %d MHz\n", qwTotalTSC / 10 / 1000 / 1000 );
}