c++ - GetProcessTimes called periodically returns the same results -
i'm calling getprocesstimes()
periodically in loop same thing on each iteration, seems generate same results every time , changes time time. normal behaviour ? shouldn't results change little bit on time ?
void imcalledperiodically() { static const dword dwpid = ::getcurrentprocessid(); static const handle hproc = ::openprocess( process_query_information, false, dwpid ); static filetime ftunused1, ftunused2; // unused, mandatory parameters. ularge_integer uliusr, ulikrn; ::getprocesstimes( hproc, & ftunused1, & ftunused2, (_filetime *)& ulikrn, (_filetime *)& uliusr); printf("usr=%i64d krn=%i64d", uliusr.quadpart, ulikrn.quadpart ); // etc... }
the output values change time times, example :
641002, 641002, 641002, 641002 1092007, 1092007, 1092007, 1092007 etc...
shouldn't change few every time ? there kind of refresh rate internal function ?
thanks help.
you noticing values changing every 16 ms, default time interval windows uses timers , thread time quantum. so, if making calls in relatively tight loop, repeating values.
on top of fact times show actual cpu consumption. if process little or no work in between calls, times not increase.
Comments
Post a Comment