示例#1
0
void DumpSystemToLog() {
    CPUInfo cpu;   
    WCHAR wszTime[9], wszDate[9];
    _wstrtime_s(wszTime, 9);
    _wstrdate_s(wszDate, 9);
    LOG_INFO(" --     System To Log     --");
#if defined(DEBUG) || defined(_DEBUG)
    LOG_INFO("RUNNING -DEBUG- BUILD AT: " << wszDate << " -- " << wszTime );
#else
    LOG_INFO("RUNNING -RELEASE- BUILD AT: " << wszDate << " -- " << wszTime );
#endif    
    LOG_INFO("");
    LOG_INFO(DXUTGetWindowTitle());
    LOG_INFO("Processor Speed: " << cpu.GetProcessorClockFrequency() << "MHz");
    LOG_INFO("Processors: " << cpu.GetLogicalProcessorsPerPhysical());
    LOG_INFO("Processor: " << cpu.GetExtendedProcessorName());
    LOG_INFO(DXUTGetFrameStats(false));
    LOG_INFO(DXUTGetDeviceStats());
    LOG_INFO("");

    dprintf("Processor Speed: %dMHz\n", cpu.GetProcessorClockFrequency());
    dprintf("Processors: %d\n", cpu.GetLogicalProcessorsPerPhysical());
    dprintf("Processor: %s\n", cpu.GetExtendedProcessorName());    

    char pszDest[256];
    WCharStringToCharString(DXUTGetFrameStats(false), pszDest, 255);
    dprintf("STATS:\n%s\n", pszDest);
    WCharStringToCharString(DXUTGetDeviceStats(), pszDest, 255);
    dprintf("%s\n", pszDest);
    dprintf("\n\n");
}
示例#2
0
文件: main.cpp 项目: elua/moonlight
static void get_cpu_cores( char* dest )
{
  sprintf( dest, "%d\n", cpu_info.GetLogicalProcessorsPerPhysical() );
}
示例#3
0
DWORD WINAPI GetProcessorInformation (LPVOID lpParameter)
{
	PPROCESSORINFO pProcessorInfo = (PPROCESSORINFO) lpParameter;
	CPUInfo * CPU = new CPUInfo ();
				
	if (!CPU->DoesCPUSupportCPUID ()) 
	{			
		delete CPU;			
		return 0;
	}
		
	//the processor serial number.
	if (CPU->DoesCPUSupportFeature (SERIALNUMBER_FEATURE)) 
	{
		sprintf_s(pProcessorInfo->szSerialNumber, CPU->GetProcessorSerialNumber());
	}
			
	// Add the hardware specification node.		
	// State the APIC ID if one is present.
	if (CPU->DoesCPUSupportFeature (APIC_FEATURE)) 
	{				
		pProcessorInfo->bAPICPresent = true;		
		// Attempt to display the ID of the APIC.
		pProcessorInfo->APICID = CPU->GetProcessorAPICID ();
	}

	// State if the processor supports the Advanced Configuration and Power Interface [ACPI].
	if (CPU->DoesCPUSupportFeature (ACPI_FEATURE)) 
	{
		pProcessorInfo->bACPICapable = true;
	}
			
	// State if the processor supports a thermal monitor.
	if (CPU->DoesCPUSupportFeature (THERMALMONITOR_FEATURE))
	{
		pProcessorInfo->bOnChipThermalMonitor = true;
	}

	
	if (CPU->DoesCPUSupportFeature (L1CACHE_FEATURE)) 
	{
		pProcessorInfo->bL1Cache = true;
		pProcessorInfo->L1CacheSize = CPU->GetProcessorCacheXSize (L1CACHE_FEATURE);
	}

	// State the size of the L2 cache if present.
	if (CPU->DoesCPUSupportFeature (L2CACHE_FEATURE)) 
	{
		pProcessorInfo->bL2Cache = true;
		pProcessorInfo->L2CacheSize = CPU->GetProcessorCacheXSize (L2CACHE_FEATURE);
	}

	// State the size of the L3 cache if present.
	if (CPU->DoesCPUSupportFeature (L3CACHE_FEATURE)) 
	{
		pProcessorInfo->bL3Cache = true;
		pProcessorInfo->L3CacheSize = CPU->GetProcessorCacheXSize (L3CACHE_FEATURE);
	}
							
	// State if a temperature sensing diode is present.
	if (CPU->DoesCPUSupportFeature (TEMPSENSEDIODE_FEATURE)) 
	{
		pProcessorInfo->bTemperatureSensingDiode = true;
	}

	// State if a frequency ID control is present.
	if (CPU->DoesCPUSupportFeature (FREQUENCYID_FEATURE)) 
	{				
		pProcessorInfo->bFrequencyIDControl = true;	
	}

	// State if a voltage ID control is present.
	if (CPU->DoesCPUSupportFeature (VOLTAGEID_FREQUENCY)) 
	{
		pProcessorInfo->bVoltageIDControl = true;
	}
	
//Supported Features
	
	// State if CMOV instructions are present.
	if (CPU->DoesCPUSupportFeature (CMOV_FEATURE)) 
	{
		pProcessorInfo->bCMOVInstructions = true;
	}

	// State if MTRR instructions are present.
	if (CPU->DoesCPUSupportFeature (MTRR_FEATURE)) 
	{	
		pProcessorInfo->bMTRRInstructions = true;
	}

	// State if MMX instructions are present.
	if (CPU->DoesCPUSupportFeature (MMX_FEATURE)) 
	{
		pProcessorInfo->bMMXInstructions = true;
	}

	// State if MMX+ instructions are present.
	if (CPU->DoesCPUSupportFeature (MMX_PLUS_FEATURE)) 
	{		
		pProcessorInfo->bMMXPlusInstructions = true;
	}

	// State if SSE instructions are present.
	if (CPU->DoesCPUSupportFeature (SSE_FEATURE)) 
	{
		pProcessorInfo->bSSEInstructions = true;
	}

	// State if SSE FP instructions are present.
	if (CPU->DoesCPUSupportFeature (SSE_FP_FEATURE)) 
	{
		pProcessorInfo->bSSEFPInstructions = true;
	}

	// State if SSE MMX instructions are present.
	if (CPU->DoesCPUSupportFeature (SSE_MMX_FEATURE)) 
	{
		pProcessorInfo->bMMXInstructions = true;
	}

	// State if SSE2 instructions are present.
	if (CPU->DoesCPUSupportFeature (SSE2_FEATURE)) 
	{
		pProcessorInfo->bSSE2Instructions = true;
	}

	// State if 3DNow! instructions are present.
	if (CPU->DoesCPUSupportFeature (AMD_3DNOW_FEATURE)) 
	{
		pProcessorInfo->bAMD3DNowInstructions = true;
	}

	// State if 3DNow!+ instructions are present.
	if (CPU->DoesCPUSupportFeature (AMD_3DNOW_PLUS_FEATURE)) 
	{
		pProcessorInfo->bAMD3DNowPlusInstructions = true;
	}

	// State if Hyperthreading instructions are present.
	if (CPU->DoesCPUSupportFeature (HYPERTHREAD_FEATURE)) 
	{
		pProcessorInfo->bHyperthreadingInstructions = true;
		pProcessorInfo->LogicalProcessorsPerPhysical = CPU->GetLogicalProcessorsPerPhysical ();
	}

	// State if the processor is MP capable.
	if (CPU->DoesCPUSupportFeature (MP_CAPABLE)) 
	{
		pProcessorInfo->bMultiprocessorCapable = true;
	}

	// State if IA64 instructions are present.
	if (CPU->DoesCPUSupportFeature (IA64_FEATURE)) 
	{
		pProcessorInfo->bIA64Instructions = true;
	}	
	
	delete CPU;

	return 0;	
}