使用DTSC(Read Time Stamp Counter)指令做高精度时间处理,比QueryPerformanceCounter效率要高出一个数量级
来源:互联网 发布:易语言a星寻路算法 编辑:程序博客网 时间:2024/05/18 14:27
// Test.cpp : Defines the entry point for the console application.
//
#pragma once
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#include <stdio.h>
#include <tchar.h>
#include "Windows.h"
__declspec( naked ) inline unsigned __int64 GetCPUCounter()
{
__asm _emit 0x0F;
__asm _emit 0x31;
__asm ret;
}
int _tmain(int argc, _TCHAR* argv[])
{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
unsigned __int64 counter;
LARGE_INTEGER counter1;
counter = GetCPUCounter();
QueryPerformanceCounter(&counter1);
unsigned __int64 diff = (GetCPUCounter() - counter);
unsigned __int64 counter2 = GetCPUCounter();
GetCPUCounter();
unsigned __int64 diff1 = (GetCPUCounter() - counter2);
printf("diff: %d/n", diff - diff1);
system("pause");
return 0;
}
- 使用DTSC(Read Time Stamp Counter)指令做高精度时间处理,比QueryPerformanceCounter效率要高出一个数量级
- 再论 Time stamp counter
- 【C++】高精度代码运行时间( QueryPerformanceCounter )
- 8.3 时间戳(Time Stamp)选项
- Benchmark Code on DSP using the Time Stamp Counter (TSC)
- Directshow中的Sample时间戳(Time Stamp)
- 使用QueryPerformanceCounter()记录时间
- ime stamp counter
- unix time stamp(时间戳)和常规时间相互转换的C++代码
- 高精度计时器---QueryPerformanceFrequency()与QueryPerformanceCounter()的使用
- 精确获取时间(QueryPerformanceCounter)
- 精确获取时间(QueryPerformanceCounter)
- 精确获取时间(QueryPerformanceCounter)
- 精确获取时间(QueryPerformanceCounter)
- 精确获取时间(QueryPerformanceCounter)
- 精确获取时间(QueryPerformanceCounter)
- 精确获取时间(QueryPerformanceCounter)
- 精确获取时间(QueryPerformanceCounter)
- .NET中的内部类型
- Sicily 1045. Space Management[离散化]
- greenlet implemenation
- java虚拟机
- Win7安装IIS
- 使用DTSC(Read Time Stamp Counter)指令做高精度时间处理,比QueryPerformanceCounter效率要高出一个数量级
- 使用 Amazon S3 服务轻松实现存储
- c#结构类型
- 域名解析系统DNS诊断命令nslookup详解
- 1.VC(ui)-单选按钮的自绘实现
- Nslookup命令详解
- 读史可以使人明智,鉴以往可以知未来
- php转码自己定义的iconv函数
- 2010年清华大学博士研究生拟录取名单公示