Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
A version of this page is also available for
4/8/2010

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 FILETIMEstructure that receives the creation time of the thread.

lpExitTime

[out] Long pointer to a FILETIMEstructure 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 FILETIMEstructure that receives the amount of time the thread executed in kernel mode.

lpUserTime

[out] Pointer to a FILETIMEstructure 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 FILETIMEdata 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 FILETIMEstructure specified by lpKernelTimewith a 64-bit value of ten million. That is the number of 100-nanosecond units in one second.

The following support restrictions are set for GetThreadTimesfor Windows CE 2.10 through 2.12:

  • The lpCreationTime, lpExitTime, and lpKernelTimeparameters are not supported. They are always returned as zero.

  • The lpUserTimeparameter reports the total time a thread has been running. There is no distinction between user and kernel modes.

  • The lpUserTimeparameter is not valid when the thread exits.

Requirements

Header winbase.h
Library coredll.lib
Windows Embedded CE Windows CE 2.10 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also