NT下的一个函数
function GetThreadTimes(hThread:THandle;var lpCreationTime,lpExitTime,
lpKernelTime,lpUserTime:TFileTime):Bool;StdCall
可以获得一个线程的运行时间,,
我没试过,呵呵,,
那位试出来了请告诉我哦。。 [email protected]
lpCreateTime 线程创建时间
LPEXITTIME 线程退出时间
LPKERNELTIME 执行操作系统代码所用时间
LPUSERTIME 执行本应用程序本身代码所用的时间以上都为Tfiletime
可以将四个参数showmessage出来吗?
function GetThreadTimes(hThread:THandle;var lpCreationTime,lpExitTime,
lpKernelTime,lpUserTime:TFileTime):Bool;StdCall
可以获得一个线程的运行时间,,
我没试过,呵呵,,
那位试出来了请告诉我哦。。 [email protected]
lpCreateTime 线程创建时间
LPEXITTIME 线程退出时间
LPKERNELTIME 执行操作系统代码所用时间
LPUSERTIME 执行本应用程序本身代码所用的时间以上都为Tfiletime
可以将四个参数showmessage出来吗?
解决方案 »
- 阻塞循环问题…… 高手进
- delhpi 中怎么定义一个int数组
- 在Delphi中用adoquery.SQL.Add(),如何将NULL传入数据库呢?
- install shield 打包问题
- 各位高手,看看这条SQL语句???
- Delphi应用实际遇到的系列问题
- 数据集问题
- Quake II已经从被人从C转换到delphi上了,可是我找不到下载,谁英文好帮忙找一下吧。
- 我如何把一form变成一个DLL
- 求结构体转换delphi,调用dll!在线等
- 关于QReport报表的问题,高手帮忙,急死人了。解决了问题的再开贴给100分
- ======如何真正关闭ClientSocket控件与服务器连接的端口!======
lpCreateTime:TFileTime;
LPEXITTIME:TFileTime;
LPKERNELTIME:TFileTime;
LPUSERTIME:TFileTime;
begin
GetThreadTimes(GetCurrentThreadId, lpCreateTime,lpEXITTIME,
lpKernelTime,lpusertime);
Memo1.Lines.Add(IntToStr(INT64(lpCreateTime)));
Memo1.Lines.Add(IntToStr(INT64(lpEXITTIME)));
Memo1.Lines.Add(IntToStr(INT64(lpKernelTime)));
Memo1.Lines.Add(IntToStr(INT64(lpusertime)));
如果没有溢出的话。//Delphi没有QWORD-_-
MSDN的话:
Res
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. There are several functions that an application can use to convert such values to more generally useful forms; see Time Functions.Thread kernel mode and user mode times are amounts of time. For example, if a thread has spent one second in kernel mode, this function will fill 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.
function FileTimeToDateTime(FileTime: TFileTime): TDateTime;
var
SysTime: TSystemTime;
begin
if not FileTimeToSystemTime(FileTime, SysTime) then
raise Exception.CreateFmt('FileTimeToSystemTime failed. ' +
'Error code %d', [GetLastError]);
with SysTime do
Result := EncodeDate(SysTime.wYear, SysTime.wMonth, SysTime.wDay) +
EncodeTime(SysTime.wHour, SysTime.wMinute, SysTime.wSecond, SysTime.wMilliseconds);
end;