Partager via


GetThreadTimes (Compact 2013)

3/28/2014

This function obtains timing information about a specified thread.

Syntax

BOOL GetThreadTimes (
  HANDLE hThread,
  LPFILETIME lpCreationTime,
  LPFILETIME lpExitTime,
  LPFILETIME lpKernelTime,
  LPFILETIME lpUserTime
);

Parameters

  • hThread
    [in] Open handle that specifies the thread whose timing information is sought.

    This handle must be created with THREAD_QUERY_INFORMATION access.

  • lpCreationTime
    [out] Long pointer to a FILETIME structure that receives the creation time of the thread.
  • lpExitTime
    [out] Long pointer to a FILETIME structure that receives the exit time of the thread.

    If the thread has not exited, the content of this structure is undefined.

  • lpKernelTime
    [out] Long pointer to a FILETIME structure that receives the amount of time the thread executed in kernel mode.
  • lpUserTime
    [out] Pointer to a FILETIME structure that receives the amount of time the thread executed in user mode.

Return Value

Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.

Remarks

All times are expressed using FILETIME data structures. Such a structure contains two 32-bit values that combine to form a 64-bit count of 100-nanosecond time units.

Thread creation and exit times are points in time expressed as the amount of time that has elapsed since midnight on January 1, 1601 at Greenwich, England.

Thread kernel mode and user mode times are amounts of time. For example, if a thread spends one second in kernel mode, this function fills the FILETIME structure specified by lpKernelTime with a 64-bit value of ten million. That is the number of 100-nanosecond units in one second.

Threads that are suspended and never resumed before terminating need to take care of startup and cleanup processes. These threads can accumulate kernel and user time. If you call GetThreadTimes on a suspended thread, the returned values include this time.

Requirements

Header

winbase.h

Library

coredll.lib

See Also

Reference

Process and Thread Functions
FILETIME