C++ 在代码运行时,有没有办法节省数据类型中循环所花费的时间(毫秒)?

C++ 在代码运行时,有没有办法节省数据类型中循环所花费的时间(毫秒)?,c++,visual-studio,analytics,C++,Visual Studio,Analytics,我想看看循环中一次“运行”需要多少毫秒,我想在我的应用程序中显示它,看看我的程序在许多功能打开或关闭的情况下是如何执行的。例如,有没有一种方法可以节省循环中每次运行的时间 我使用的程序是Visual Studio,语言是C++ // e.g. while(!GetAsyncKeyState(VK_ADD)){ // here are the features // here is the end of the loop and here the time should be sav

我想看看循环中一次“运行”需要多少毫秒,我想在我的应用程序中显示它,看看我的程序在许多功能打开或关闭的情况下是如何执行的。例如,有没有一种方法可以节省循环中每次运行的时间

我使用的程序是Visual Studio,语言是C++

// e.g.

while(!GetAsyncKeyState(VK_ADD)){
   // here are the features
   // here is the end of the loop and here the time should be saved
}

在循环中使用std::chrono::high_resolution_clock::now()。GetTickCount()?这是否满足您的要求?谢谢,丹尼斯没有想到这一点。这符合我的目的。谢谢你的提示@SuarezZhou MSFT,但不是我想要的。