简体   繁体   中英

How to measure user time used by process on windows?

On linux we can use "time" command. Or from C++:

#include <sys/time.h>
#include <sys/resource.h>

int getrusage(int who, struct rusage *usage);

How to do a closest thing to that on windows ?

GetProcessTimes

This gives lpUserTime [out] : A pointer to a FILETIME structure that receives the amount of time that the process has executed in user mode. The time that each of the threads of the process has executed in user mode is determined, and then all of those times are summed together to obtain this value.

进行精确时间测量的最佳方法是使用平台无关的库组件,例如ACE_High_Res_Timer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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