0
__int64 start;
long double freq, tm;

void time_start()
{
    LARGE_INTEGER li;
    if(!QueryPerformanceFrequency(&li))
    std::cout << "QueryPerformanceFrequency failed!\n";

    freq = double(li.QuadPart)/1000.0;

    QueryPerformanceCounter(&li);
    start = li.QuadPart;
}

void time_stop()
{
    LARGE_INTEGER li;
    QueryPerformanceCounter(&li);
    tm = (double) (li.QuadPart - start)/freq;
}

这些是我用来测量执行时间的函数。它们在 VS 2012 中按预期工作,但在 devcpp 中它们总是显示相同的时间 - 一些 e-317 ......

我使用的标题:

#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <vector>
#include <stdlib.h>
#include <limits>
#include <ctime>
#include <cstdlib>
#include <windows.h>

怎么了?

4

0 回答 0