Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在具有i7、queryperformance/frequency和时钟don'的Windows上以C为单位的执行时间;行不通_C_Windows_Query Performance_Execution Time - Fatal编程技术网

在具有i7、queryperformance/frequency和时钟don'的Windows上以C为单位的执行时间;行不通

在具有i7、queryperformance/frequency和时钟don'的Windows上以C为单位的执行时间;行不通,c,windows,query-performance,execution-time,C,Windows,Query Performance,Execution Time,我需要测量方法运行时经过的时间。我用QueryPerformanceCounter尝试了QueryPerformanceFrequency和clock\u t(这两种方法的示例,我从这里类似的问题中得到): 对于clock\t我有: clock_t start, end; start = clock(); method(one, two, result);/***** Method I need timed *****/ end = clock(); double timeElapsed = (

我需要测量方法运行时经过的时间。我用
QueryPerformanceCounter
尝试了
QueryPerformanceFrequency
clock\u t
(这两种方法的示例,我从这里类似的问题中得到):

对于
clock\t
我有:

clock_t start, end;
start = clock();
method(one, two, result);/***** Method I need timed *****/
end = clock();
double timeElapsed = (double)(end-start) / CLOCKS_PER_SEC;
我有
#include
用于
时钟
#include
#include
用于
查询性能频率
查询性能计数器
。 每次我用这两种方法运行这段代码时,经过的时间都是0。是否有可能代码运行速度太快,无法使用上面使用的方法进行测量,如果是,我可以用什么方法来补救

clock_t start, end;
start = clock();
method(one, two, result);/***** Method I need timed *****/
end = clock();
double timeElapsed = (double)(end-start) / CLOCKS_PER_SEC;