Windows Server 2003 Resource Kit Tools里的
Timeit.exe 才是我想要的!上面的 exec 只能计算“逝去时间”,而不能计算“命令执行成功所花的时间”。例如我要 exec 计算
Explorer.exe /n,D:\nirsoft“命令执行成功所花的时间”,它就无能为力了,它只能计算 explorer.exe 运行的时间,即我把 d:\nirsoft 关掉后它才会报告一个“逝去时间”。
Timeit.exe 可以计算“逝去时间”和“创建时间”
下面计算了打开 d:\nirsoft 的三种方式所用时间。
1.用 explorer.exe 打开
命令:timeit.exe Explorer.exe /n,D:\nirsoft
Process Time: 0:00:01.375
2.打开 .lnk
命令:timeit.exe %SystemRoot%\System32\Rundll32.exe Url,FileProtocolHandler "%HOMEDRIVE%%HOMEPATH%\桌面\nirsoft.lnk"
Process Time: 0:00:00.281
3.用系统关联打开
命令:timeit.exe cmd /c start d:\nirsoft
Process Time: 0:00:00.062
可以看出,用系统关联打开的时间最短!
再做个比较来证明这点:浏览器加网址参数 和 用关联打开网址
C:\>timeit.exe E:\Program Files\Opera\opera.exe
http://www.cn-dos.net/forum
Version Number: Windows NT 5.1 (Build 2600)
Exit Time: 3:55 pm, Friday, September 12 2008
Elapsed Time: 0:00:00.828
Process Time: 0:00:00.421
System Calls: 25648
Context Switches: 2844
Page Faults: 11121
Bytes Read: 187914
Bytes Written: 35690
Bytes Other: 126367
C:\>timeit.exe cmd /c start
http://www.cn-dos.net/forum
Version Number: Windows NT 5.1 (Build 2600)
Exit Time: 3:55 pm, Friday, September 12 2008
Elapsed Time: 0:00:00.421
Process Time: 0:00:00.109
System Calls: 21833
Context Switches: 2464
Page Faults: 3782
Bytes Read: 185279
Bytes Written: 31984
Bytes Other: 42080
从中可以看出,在“运行”对话框中直接输入网址,和用浏览器加网址参数是绝对不同的。浏览器加网址参数 不但速度慢,且更消耗系统资源。
Last edited by tireless on 2008-9-11 at 08:16 PM ]