亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? speed.c

?? 一個取得 CPU 信息的程序源碼 可以獲取16位和32位CPU的信息
?? C
?? 第 1 頁 / 共 2 頁
字號:
/***************************************************************
* C file:  Speed.c... for cpuinf16 DLL
*
*       This program has been developed by Intel Corporation.  
*		You have Intel's permission to incorporate this code 
*       into your product, royalty free.  Intel has various 
*	    intellectual property rights which it may assert under
*       certain circumstances, such as if another manufacturer's
*       processor mis-identifies itself as being "GenuineIntel"
*		when the CPUID instruction is executed.
*
*       Intel specifically disclaims all warranties, express or
*       implied, and all liability, including consequential and
*		other indirect damages, for the use of this code, 
*		including liability for infringement of any proprietary
*		rights, and including the warranties of merchantability
*		and fitness for a particular purpose.  Intel does not 
*		assume any responsibility for any errors which may 
*		appear in this code nor any responsibility to update it.
*
*  * Other brands and names are the property of their respective
*    owners.
*
*  Copyright (c) 1995, Intel Corporation.  All rights reserved.
***************************************************************/
  
#include <windows.h> 
#include <math.h>
#include <stdio.h>
#include <mmsystem.h>
#include <limits.h>    
#include <memory.h>

#include "speed.h"
#include "cpuid.h"

// Tabs set at 4
#define ROUND_THRESHOLD		6

// Tabs set at 4
static struct FREQ_INFO GetCmosCpuSpeed();
static struct FREQ_INFO GetRDTSCCpuSpeed();
static struct FREQ_INFO GetBSFCpuSpeed(ulong cycles);
static unsigned long diffTime64(unsigned long t1Hi, unsigned long t1Low, 
						 unsigned long t2Hi, unsigned long t2Low, 
 					 	 unsigned long *tHi, unsigned long *tLow );

// extern in ASM file
ushort Time_Processor_bsf(void);

/***************************************************************
* LibMain() -- Windows entry procedure for DLLSs
* 
***************************************************************/
int FAR PASCAL _export LibMain(HANDLE hI, WORD wDS, WORD cbHS, LPSTR lpszCL) {
	if (cbHS != 0) 
	
		UnlockData(0);
	
	return 1;
} // LibMain()



/***************************************************************
* WEP() -- Windows exit procedure for the DLLs.
*
***************************************************************/
int FAR PASCAL _export WEP(int nParam) {
	return 1;
} // WEP()



/***************************************************************
* CpurawSpeed() -- Return the raw clock rate of the host CPU.
*
* Inputs:
*	clocks:		0: Use default value for number of cycles
*				   per BSF instruction.
*               -1: Use CMos timer to get cpu speed (DOES NOT WORK FOR WINNT).
*   			Positive Integer: Use clocks value for number
*				   of cycles per BSF instruction.
*
* Returns:
*		If error then return all zeroes in FREQ_INFO structure
*		Else return FREQ_INFO structure containing calculated 
*       clock frequency, normalized clock frequency, number of 
*       clock cycles during test sampling, and the number of 
*       microseconds elapsed during the sampling.
***************************************************************/

unsigned long FAR PASCAL cpurawspeed(int clocks)
{
	struct FREQ_INFO cpu_speed;

	cpu_speed = cpuspeed(clocks);
	return cpu_speed.raw_freq;
}

/***************************************************************
* CpunormSpeed() -- Return the raw clock rate of the host CPU.
*
* Inputs:
*	clocks:		0: Use default value for number of cycles
*				   per BSF instruction.
*               -1: Use CMos timer to get cpu speed.
*   			Positive Integer: Use clocks value for number
*				   of cycles per BSF instruction.
*
* Returns:
*		If error then return all zeroes in FREQ_INFO structure
*		Else return FREQ_INFO structure containing calculated 
*       clock frequency, normalized clock frequency, number of 
*       clock cycles during test sampling, and the number of 
*       microseconds elapsed during the sampling.
***************************************************************/

unsigned long FAR PASCAL cpunormspeed(int clocks)
{
	struct FREQ_INFO cpu_speed;

	cpu_speed = cpuspeed(clocks);
	return cpu_speed.norm_freq;
}

/***************************************************************
* ProcessorCount() -- Return the number of CPU's on this machine.
*
* Inputs:
*
* Returns:
*		 always 1 for 16 bit dll
***************************************************************/

unsigned long FAR PASCAL ProcessorCount()
{
	return 1;
}

/***************************************************************
* CpuSpeed() -- Return the raw clock rate of the host CPU.
*
* Inputs:
*	clocks:		NULL: Use default value for number of cycles
*				   per BSF instruction.
*   			Positive Integer: Use clocks value for number
*				   of cycles per BSF instruction.
*
* Returns:
*		If error then return all zeroes in FREQ_INFO structure
*		Else return FREQ_INFO structure containing calculated 
*       clock frequency, normalized clock frequency, number of 
*       clock cycles during test sampling, and the number of 
*       microseconds elapsed during the sampling.
***************************************************************/

struct FREQ_INFO FAR PASCAL cpuspeed(int clocks) 
{
	ulong  cycles;					// Clock cycles elapsed 
									//   during test
	
	ushort processor = wincpuid();	// Family of processor

	DWORD features = wincpufeatures();	// Features of Processor
	
	int manual=0;			// Specifies whether the user 
							//   manually entered the number of
							//   cycles for the BSF instruction.

	struct FREQ_INFO cpu_speed;		// Return structure for
									//   cpuspeed
					
	// Number of cycles needed to execute a single BSF 
	//   instruction. Note that processors below i386(tm) 
	//   are not supported.
	ushort processor_cycles[] = {
		00,  00,  00, 115, 47, 43, 
		38,  38,  38, 38,  38, 38, 
	};

	memset(&cpu_speed, 0x00, sizeof(cpu_speed));
	
	if ( processor & CLONE_MASK )
		return cpu_speed;

	// Check for manual BSF instruction clock count
	if (0 <= clocks) {
		cycles =ITERATIONS*(ulong)processor_cycles[processor];
	}
	else if (0 < clocks && clocks <= MAXCLOCKS)  {
		cycles = ITERATIONS * (ulong) clocks;
		manual = 1;			// Toggle manual control flag.
							//   Note that this mode will not
							// 	 work properly with processors
							//   which can process multiple
							//   BSF instructions at a time.
							//   For example, manual mode
							//   will not work on a 
							//   PentiumPro(R)
	}

	if ( ( features&0x00000010 ) && !(manual) ) {
		if ( clocks == 0 )
			return GetRDTSCCpuSpeed();
		else
			return GetCmosCpuSpeed();	
    }
	else if ( processor >= 3 ) {
		return GetBSFCpuSpeed(cycles);
	}        
 
	return cpu_speed;
   	
} // cpuspeed()



static struct FREQ_INFO GetBSFCpuSpeed(ulong cycles)
{
 	ulong  ticks;	// Microseconds elapsed 								//   during test
	ulong freq;		// Most current frequ. calculation
	int i;			// Temporary Variable

	ulong current = 0;      // Variable to store time
							//   elapsed during loop of
							//   of BSF instructions

	ulong lowest  = ULONG_MAX;	// Since algorithm finds 
								//   the lowest value out of
								//   a set of samplings, 
								//   this variable is set 
								//   intially to the max 
								//   unsigned long value). 
								//   This guarantees that 
								//   the initialized value 
								//   is not later used as 
								//   the least time through 
								//   the loop.

	struct FREQ_INFO cpu_speed;		// Return structure for
									//   cpuspeed
					
	memset(&cpu_speed, 0x00, sizeof(cpu_speed));
	
	for ( i = 0; i < SAMPLINGS; i++ ) {
								// Sample SAMPLINGS times. 
								//   Can be increased or 
								//   decreased depending
								//   on accuracy vs. time
								//   requirements

			
		current = Time_Processor_bsf();
           
		if ( current < lowest )		// Take lowest elapsed
			lowest = current;		//   time to account
									//   for some samplings
									//   being interrupted
									//   by other operations 
	}

	ticks = lowest;				
		
		
	// Note that some seemingly arbitrary mulitplies and
	//   divides are done below. This is to maintain a 
	//   high level of precision without truncating the 
	//   most significant data. According to what value 
	//   ITERATIIONS is set to, these multiplies and
	//   divides might need to be shifted for optimal
	//   precision.

    ticks = ticks * 100000; 	// Convert ticks to hundred 
      							//   thousandths of a tick
        
    ticks = ticks / 119318;		// Convert hundred 
       							//   thousandths of ticks to
       							//   microseconds (us)
        
    if ( (ticks%119318) >= 119318/2 )
       	ticks++;				// Round up if necessary
        	
    freq = cycles/ticks;		// Cycles / us  = MHz

	cpu_speed.raw_freq  = freq;
    if ( cycles%ticks > ticks/2 )
       	freq++;					// Round up if necessary

	cpu_speed.in_cycles = cycles;	// Return variable structure
	cpu_speed.ex_ticks  = ticks;	//   determined by one of 
	cpu_speed.norm_freq = freq;

	return cpu_speed;
}			

static struct FREQ_INFO GetRDTSCCpuSpeed()

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩大陆在线| 国产一区久久久| 欧美丝袜自拍制服另类| 一区二区三区在线看| 欧美专区在线观看一区| 三级一区在线视频先锋 | 久久新电视剧免费观看| 国产黄色精品网站| 最新热久久免费视频| 欧美午夜一区二区三区免费大片| 亚洲国产综合人成综合网站| 91精品在线一区二区| 国产精品一区二区在线播放| 国产欧美日韩不卡免费| 91久久人澡人人添人人爽欧美| 亚洲高清久久久| 日韩欧美中文字幕公布| 国产盗摄一区二区| 亚洲图片欧美综合| 久久久777精品电影网影网| 91网址在线看| 免费久久99精品国产| 国产清纯在线一区二区www| 欧美影院一区二区三区| 国产一区二区精品久久99| 中文字幕亚洲在| 日韩免费观看高清完整版在线观看| 国产乱码精品一区二区三区五月婷| 国产精品国模大尺度视频| 欧美精品在线观看播放| 国产成人午夜精品5599| 日韩精品亚洲一区| 中文字幕一区二区三区在线不卡 | 欧美日韩成人综合| 国产福利电影一区二区三区| 亚洲国产精品久久久男人的天堂| 精品黑人一区二区三区久久 | 国产成人免费视频网站| 日韩主播视频在线| 亚洲天堂av一区| 久久久久久免费网| 欧美日韩激情一区| 91视频com| 国产99精品国产| 美女网站视频久久| 亚洲在线一区二区三区| 国产情人综合久久777777| 日韩亚洲欧美在线| 欧美在线观看一二区| 99久久99久久精品免费观看| 国产一区二区导航在线播放| 首页欧美精品中文字幕| 亚洲激情在线播放| 一区在线播放视频| 久久久久久亚洲综合影院红桃 | 欧美日本免费一区二区三区| 波多野结衣一区二区三区 | 国产乱对白刺激视频不卡| 亚洲成在线观看| 亚洲精品高清在线| 亚洲日本欧美天堂| 综合色中文字幕| 中文在线一区二区| 中文字幕不卡在线观看| www国产成人免费观看视频 深夜成人网| 欧美在线啊v一区| 91丨porny丨最新| 99久久久免费精品国产一区二区| 国产一区二区三区高清播放| 久久se精品一区二区| 蜜芽一区二区三区| 蜜桃精品视频在线观看| 秋霞影院一区二区| 久久精品噜噜噜成人88aⅴ| 日韩精彩视频在线观看| 亚洲aⅴ怡春院| 午夜不卡av在线| 日韩专区一卡二卡| 偷窥少妇高潮呻吟av久久免费| 亚洲最快最全在线视频| 亚洲一区视频在线观看视频| 亚洲精品国产无套在线观| 一区二区三区电影在线播| 亚洲最新视频在线观看| 性久久久久久久久| 免费人成精品欧美精品| 久久成人av少妇免费| 国产精品亚洲第一| caoporm超碰国产精品| 91一区二区在线观看| 欧美伊人久久久久久久久影院 | 欧美一区二区福利在线| 日韩三级免费观看| 久久久午夜电影| 亚洲国产精品激情在线观看| 国产精品久久久久一区二区三区| 中文字幕一区二区三区蜜月| 伊人色综合久久天天人手人婷| 亚洲第一成人在线| 久久成人免费网| 成人理论电影网| 欧美在线一二三四区| 日韩亚洲欧美高清| 国产精品女主播av| 亚洲国产aⅴ天堂久久| 激情欧美一区二区| av不卡一区二区三区| 欧美色综合天天久久综合精品| 91精品在线观看入口| 国产日韩欧美不卡在线| 亚洲精品视频观看| 久久电影网电视剧免费观看| 99久久综合国产精品| 4438亚洲最大| 中文字幕av不卡| 亚洲成a人v欧美综合天堂下载 | 中文字幕av免费专区久久| 亚洲影院免费观看| 精品亚洲porn| 日本精品裸体写真集在线观看| 91精品综合久久久久久| 中文字幕色av一区二区三区| 日韩精品一区第一页| 成人av资源下载| 欧美videos大乳护士334| 国产精品女主播在线观看| 香蕉成人伊视频在线观看| 福利电影一区二区| 欧美色综合影院| 国产精品久久久久精k8| 久久精品国产99久久6| 欧美在线视频日韩| 欧美激情一区在线| 奇米一区二区三区av| 91在线视频18| 久久久99久久| 麻豆国产91在线播放| 欧美日韩五月天| 亚洲女性喷水在线观看一区| 黑人精品欧美一区二区蜜桃| 欧美福利视频一区| 亚洲免费高清视频在线| 国产aⅴ精品一区二区三区色成熟| 欧美精品三级在线观看| 一区二区三区中文字幕在线观看| 成人综合在线视频| 26uuu精品一区二区| 日本特黄久久久高潮| 欧美日韩一区高清| 亚洲在线视频网站| 91精品1区2区| 亚洲免费资源在线播放| 不卡的av网站| 中文字幕高清不卡| 国产91精品一区二区麻豆网站| 日韩欧美国产1| 日本不卡在线视频| 91精品国产aⅴ一区二区| 亚洲一区二区三区视频在线播放 | 欧美视频日韩视频在线观看| 亚洲人精品午夜| youjizz久久| 中文字幕一区二区三区蜜月| 成人av网站大全| 国产精品三级视频| 成人精品视频.| 国产精品视频一二三| 丁香六月久久综合狠狠色| 日本一区二区三区视频视频| 国产激情精品久久久第一区二区| 久久综合精品国产一区二区三区 | 国产在线视视频有精品| 欧美精品一区二区三区蜜桃视频 | 一区二区三区小说| 欧美亚洲图片小说| 丝袜美腿亚洲一区| 91精品欧美久久久久久动漫 | 国产一区二区伦理| 亚洲国产精品国自产拍av| 波多野结衣91| 亚洲免费高清视频在线| 欧美日韩一区久久| 激情小说亚洲一区| 国产精品日日摸夜夜摸av| 99国产精品国产精品毛片| 亚洲制服丝袜av| 欧美一卡二卡三卡| 国产激情偷乱视频一区二区三区 | av在线播放不卡| 亚洲一区av在线| 欧美一区二区三区在线视频| 国产综合色在线| 国产精品电影一区二区| 在线观看日韩电影| 久久精品国产亚洲aⅴ| 国产欧美精品日韩区二区麻豆天美| 99久久99久久久精品齐齐| 午夜亚洲国产au精品一区二区| 日韩免费看的电影| www.av亚洲|