Location:
Search - rdtsc
Search list
Description: 一.高精度延时, 是 CPU 测速的基础
Windows 内部有一个精度非常高的定时器, 精度在微秒级, 但不同的系统这个定时器的频率不同, 这个频率与硬件和操作系统都可能有关。
利用 API 函数 QueryPerformanceFrequency 可以得到这个定时器的频率。
利用 API 函数 QueryPerformanceCounter 可以得到定时器的当前值。
根据要延时的时间和定时器的频率, 可以算出要延时的时间定时器经过的周期数。
在循环里用 QueryPerformanceCounter 不停的读出定时器值, 一直到经过了指定周期数再结束循环, 就达到了高精度延时的目的。
高精度延时的程序, 参数: 微秒
二.测速程序
利用 rdtsc 汇编指令可以得到 CPU 内部定时器的值, 每经过一个 CPU 周期, 这个定时器就加一。
如果在一段时间内数得 CPU 的周期数, CPU工作频率 = 周期数 / 时间
为了不让其他进程和线程打扰, 必需要设置最高的优先级
以下函数设置当前进程和线程到最高的优先级。
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS)
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)
CPU 测速程序的源代码, 这个程序通过 CPU 在 1/16 秒的时间内经过的周期数计算出工作频率, 单位 MHz:
-one. High-precision delay, the CPU speed is the basis of Windows within a very high accuracy of the timer, the microsecond precision, but in the system timer different frequencies, the frequency and hardware and the operating system are likely. Using API function can be QueryPerformanceFrequency the timing The frequency. Use QueryPerformanceCounter API function can be the current timer value. According to the delay time and the frequency of the timer, you could calculate the time to delay timer after a few cycles. The circle with QueryPerformanceCounter repeatedly read out the timer value, until after a specified number of cycles end the cycle again, it reached a high precision delay purposes. High-precision delay the procedure parameters : 2 microsecond. Gun utilize RDTSC instruction can
Platform: |
Size: 1213 |
Author: 马俊 |
Hits:
Description: 在vc环境下用汇编语言实现,rdtsc指令详细使用范例。-vc environment in assembly language, the use of RDTSC instruction detailed examples.
Platform: |
Size: 6355 |
Author: 李筑 |
Hits:
Description: 测试CPU的小程序,通过rdtsc及混编实现.程序代码非常简单,但直得一看-small CPU test procedures, and mixed through RDTSC achieve. The code is very simple, but in a straight view
Platform: |
Size: 10059 |
Author: 陳永明 |
Hits:
Description: Classes for Time measurement on Win32. Useful as they work in lightweight fashion (by using directly performance counters and asm RDTSC x86 instruction) to get clock-precise CPU time measurement
Platform: |
Size: 3127 |
Author: Xavier De Galia |
Hits:
Description: 检测Pentium CPU的时钟(高精度显示),程序嵌入汇编检测\"RDTSC\"和\"PCLKS\"来实现。注:这个Dialog版本的演示代码,更加直观。
Platform: |
Size: 17321 |
Author: deht |
Hits:
Description: 用rdtsc来得到cpu频率
Platform: |
Size: 7089 |
Author: snk123 |
Hits:
Description: 一.高精度延时, 是 CPU 测速的基础
Windows 内部有一个精度非常高的定时器, 精度在微秒级, 但不同的系统这个定时器的频率不同, 这个频率与硬件和操作系统都可能有关。
利用 API 函数 QueryPerformanceFrequency 可以得到这个定时器的频率。
利用 API 函数 QueryPerformanceCounter 可以得到定时器的当前值。
根据要延时的时间和定时器的频率, 可以算出要延时的时间定时器经过的周期数。
在循环里用 QueryPerformanceCounter 不停的读出定时器值, 一直到经过了指定周期数再结束循环, 就达到了高精度延时的目的。
高精度延时的程序, 参数: 微秒
二.测速程序
利用 rdtsc 汇编指令可以得到 CPU 内部定时器的值, 每经过一个 CPU 周期, 这个定时器就加一。
如果在一段时间内数得 CPU 的周期数, CPU工作频率 = 周期数 / 时间
为了不让其他进程和线程打扰, 必需要设置最高的优先级
以下函数设置当前进程和线程到最高的优先级。
SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS)
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)
CPU 测速程序的源代码, 这个程序通过 CPU 在 1/16 秒的时间内经过的周期数计算出工作频率, 单位 MHz:
-one. High-precision delay, the CPU speed is the basis of Windows within a very high accuracy of the timer, the microsecond precision, but in the system timer different frequencies, the frequency and hardware and the operating system are likely. Using API function can be QueryPerformanceFrequency the timing The frequency. Use QueryPerformanceCounter API function can be the current timer value. According to the delay time and the frequency of the timer, you could calculate the time to delay timer after a few cycles. The circle with QueryPerformanceCounter repeatedly read out the timer value, until after a specified number of cycles end the cycle again, it reached a high precision delay purposes. High-precision delay the procedure parameters : 2 microsecond. Gun utilize RDTSC instruction can
Platform: |
Size: 1024 |
Author: 马俊 |
Hits:
Description: 在vc环境下用汇编语言实现,rdtsc指令详细使用范例。-vc environment in assembly language, the use of RDTSC instruction detailed examples.
Platform: |
Size: 163840 |
Author: 李筑 |
Hits:
Description: 测试CPU的小程序,通过rdtsc及混编实现.程序代码非常简单,但直得一看-small CPU test procedures, and mixed through RDTSC achieve. The code is very simple, but in a straight view
Platform: |
Size: 10240 |
Author: 陳永明 |
Hits:
Description: Classes for Time measurement on Win32. Useful as they work in lightweight fashion (by using directly performance counters and asm RDTSC x86 instruction) to get clock-precise CPU time measurement
Platform: |
Size: 3072 |
Author: Xavier De Galia |
Hits:
Description: 检测Pentium CPU的时钟(高精度显示),程序嵌入汇编检测"RDTSC"和"PCLKS"来实现。注:这个Dialog版本的演示代码,更加直观。-Detection of Pentium CPU clock (high-precision display), the program embedded in the compilation of detection
Platform: |
Size: 17408 |
Author: deht |
Hits:
Description: CPU 的精确计时器
This class implements an MFC wrapper class for the Pentium-specific (or better) time stamp counter which can be accessed using the "RDTSC" assembly language instruction. This counter has a resolution in terms of PCLKS (processor clocks) so if you have a 200 MHz CPU then this class will give a frequency of 200 MHz. The value returned is an 64 bit integer so assuming your CPU runs at 200 MHz, the value will take roughly 3000 years to roll over. As the value also starts counting from 0, the value returned is the number of cpu ticks since the computer was turned on.
Because the timer is part of the CPU hardware, it is unaffected by processor activity and workload. The class has only been tested on Intel CPU s (486, Pentium, Pentium Pro & Pentium 2). Feedback about its behaviour on other CPU types would be appreciated. The class can also be used on Windows NT without any problems.
-CPU precise timer This class implements an MFC wrapper class for the Pentium-specific (or better) time stamp counter which can be accessed using the
Platform: |
Size: 15360 |
Author: 谢兵 |
Hits:
Description: 使用CPU时间戳进行高精度计时,利用Rdtsc指令计算CPU的时钟频率-High-precision time stamp for the use of CPU time, using the Rdtsc Instruction Computing CPU clock frequency
Platform: |
Size: 2048 |
Author: 曾凡麟 |
Hits:
Description: RDTSC测试程序,能很好测试CPU的时间-RDTSC test procedures, test CPU can be a good time to
Platform: |
Size: 4096 |
Author: 李进 |
Hits:
Description: DOS下面测量CPU频率的小程序。主要通过rdtsc指令和ACPI的Performance Counter配合进行CPU频率的计算。本程序适用Watcom C编写-DOS The following CPU frequency measurement applet. Rdtsc instructions and ACPI through the Performance Counter facilitate the holding of CPU frequency calculations. This procedure applies to the preparation of Watcom C
Platform: |
Size: 54272 |
Author: 全达昆 |
Hits:
Description: RDTSC指令的使用以及相关问题,详解RDTSC命令的使用。-RDTSC instruction for use, and related issues, Xiang Jie RDTSC command.
Platform: |
Size: 11264 |
Author: dailong |
Hits:
Description: 本文介绍了一种随机生成二维迷宫的方法,并指出了该方法的几个关键点,即如何生成连接起点和终点的通路,如何实现强连通图,以及如何绘制迷宫和捕获键盘事件的编程技巧。虽然代码不多,却实现了一个较为完整的迷宫游戏,希望能为游戏编程爱好者们起到参考作用-We can use this program to detect the main frequency of CPU by using RDTSC instructor.
Platform: |
Size: 1743872 |
Author: joe |
Hits:
Description: 一个基于C++用于检测Pentium CPU时钟主频的小程序,高精度显示,原理是通过嵌入汇编语言后检测"RDTSC"和"PCLKS"来实现,较底层的操作。不过无从知道能否检测更高主频的CPU。若有需要的自己下载源码研究下。-A C++-based program for the detection of small Pentium CPU clock speed, high-precision display, the principle is the detection by embedding assembly language "RDTSC" and "PCLKS" to achieve, compared with the underlying operating. But no way to know whether a higher frequency of detection of the CPU. If download the source code under their own research needs.
Platform: |
Size: 9216 |
Author: wpudn25 |
Hits:
Description: Comment this out to deactivate the cycle counter. NOTE: it works only on CPUs which know the rdtsc command (586 or higher) (hope, you don t try to debug Mesa on a 386 ).
-Comment this out to deactivate the cycle counter. NOTE: it works only on CPUs which know the rdtsc command (586 or higher) (hope, you don t try to debug Mesa on a 386 ).
Platform: |
Size: 3072 |
Author: fjnavv |
Hits:
Description: Windows user space fast timer utility, using perfCounter frequency and combination of RDTSC and QueryPerformance
Platform: |
Size: 436224 |
Author: MAMI |
Hits: