中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-10-12 20:59
共 47,815 主题排行 / 349,922 发帖 / 今日 0 篇 / 48,286 会员排行
其它操作系统综合讨论区 » 【已解决】求计算命令执行时间的命令行工具...
可打印版本  1,274 / 5
第1楼 tireless 发表于 2008-09-11 18:51
银牌会员 发帖 1,122 积分 2,025
【已解决】求计算命令执行时间的命令行工具...
记得以前下载到过这个工具,现在找不到了...

[ Last edited by tireless on 2008-9-11 at 08:22 PM ]
第2楼 tireless 发表于 2008-09-12 02:15
银牌会员 发帖 1,122 积分 2,025
找到了一个 exec15.zip

Exec - Written by Bill Stewart ([email protected])

Executes a program using the CreateProcess Win32 API.

Usage: Exec ] -- program ]

-c Creates a new console (if running a console application)
-s n Configures the initial window state (e.g. -s 1 = start normally)
-w Waits for the program to finish
-e Displays the program's elapsed time (hh:mm:ss)
-d dir Configures a starting directory for the program (use quotes if needed)

Exec's command-line arguments must all appear BEFORE the program name. The --
characters tell Exec that it has no more options and to treat the remainder
of the command line as the command line it should run.

Example:

Exec -w -e -- cmd /c dir "C:\Program Files" /b /s
第3楼 tireless 发表于 2008-09-12 16:14
银牌会员 发帖 1,122 积分 2,025
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 ]
第4楼 ts47284 发表于 2008-09-12 17:24
新手上路 发帖 8 积分 14
路过来看看了呀
























从零开始最新章节
第5楼 DOSforever 发表于 2008-09-12 17:45
金牌会员 发帖 2,239 积分 4,639
如此看来 exec.exe 称作命令执行的时间没错,因为它计算一个命令从发出到执行结束总共用了多长时间。
而 timeit.exe 应该称作命令的启动时间,它计算从发出一个命令到启动完毕用了多长时间。
第6楼 lxmxn 发表于 2008-09-13 12:23
版主 发帖 4,938 积分 11,386
貌似这个 timeit 还生成了一个数据库文件,在当前目录。
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023