Home > Articles > Operating Systems, Server > Microsoft Servers

  • Print
  • + Share This
This chapter is from the book

Process Execution Times

You can determine the amount of time that a process requires (elapsed, kernel, and user times) using the GetProcessTimes function, which is not available on Windows 9x.

BOOL GetProcessTimes (
   HANDLE hProcess,
   LPFILETIME lpCreationTime,
   LPFILETIME lpExitTime,
   LPFILETIME lpKernelTime,
   LPFILETIME lpUserTime)

The process handle can refer to a process that is still running or to one that has terminated. Elapsed time can be computed by subtracting the creation time from the exit time, as shown in the next example. The FILETIME type is a 64-bit item; create a union with a LARGE_INTEGER to perform the subtraction. The lsW example in Chapter 3 showed how to convert and display file times.

GetThreadTimes is similar and requires a thread handle for a parameter. Chapter 7 covers thread management.

  • + Share This
  • 🔖 Save To Your Account