In C there is a function called clock(). With this function you can get process' CPU time.
Under windows NT/2K/XP I can use GetProcessTimes to get the process CPU time, but what can I do under Win9x?
Posted on 2003-11-07 04:10:20 by greenant
well if you have a good c/++ compiler u can use
uint rdtsceax;
uint rdtscedx;
__asm rdtsc
__asm mov rdtsceax,eax
__asm mov rdtscedx,edx
thats what i use insted of api in my c++
Posted on 2003-11-07 15:51:19 by Qages
I want a windows api to use in my assembly programs.
With rdtsc you can't know the effective cpu time of your process.
Posted on 2003-11-08 02:30:50 by greenant
I guess he means something like GetTickCount, and I quote the Win32 Programmer's Reference HelpFile:
Windows NT: To obtain the time elapsed since the computer was started, look up the System Up Time counter in the performance data in the registry key HKEY_PERFORMANCE_DATA. The value returned is an 8 byte value.
Posted on 2003-11-08 05:27:35 by Homer
In a multitasking environment like windows, the processor time is divided among the processes.
Each process share the CPU with the other processes.
Imagine you have 10 processes that do intensive use if the CPU. If these processes are equal and have equal priority, if your CPU runs for 10 seconds, each process runs for 1 second.

If you press CRTL+SHIFT+ESC into your NT os you execute TaskManager. In the second table, there are many columns. One is CPU time.
I want to know how to get this value.

Under Windows NT/2K/XP I can use GetProcessTimes, and use the 4th and the 5th structures to calculate this time.
But Windows 95/98/Me don't have GetProcessTimes.

I know C library has a function, called clock(), that retrieve this value. I don't know how C can know this value under windows 95/98/Me, sice GetProcessTimes doesn't exist.

I can't use GetTickCount or RDTSC because, doing so, I would calculate the time all the processes spent, not only my process CPU time
Posted on 2003-11-08 06:05:51 by greenant