简体   繁体   English

如何在Win32进程中检索在用户模式下花费的时间

[英]How to retrieve the time spent in user mode in a win32 process

I know that GetProcessTimes can be used to retrieve the time a process spent in user mode (as opposed to the time it spent in kernel mode or the time it was suspended). 我知道, GetProcessTimes可用于检索进程在用户模式下花费的时间(而不是它在内核模式下花费的时间或被挂起的时间)。 Unfortunately, it seems that the resolution is only 16ms (the same as GetTickCount ). 不幸的是,分辨率似乎只有16ms(与GetTickCount相同)。

Is there a way to retrieve the time with greater precision? 有没有一种方法可以更精确地检索时间?

Take a look at QueryPerformanceCounter function. 看一下QueryPerformanceCounter函数。 But I have heard that it has problems in multi core environments, not sure though. 但是我听说它在多核环境中存在问题,但是不确定。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM