中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

中国DOS联盟论坛
现在时间是 2026-07-28 11:13
中国DOS联盟论坛 » 其它操作系统综合讨论区 » 【已解决】求计算命令执行时间的命令行工具... 查看 1,149 回复 5
楼 主 【已解决】求计算命令执行时间的命令行工具... 发表于 2008-09-11 18:51 ·  中国 江西 赣州 电信
银牌会员
★★★★
积分 2,025
发帖 1,122
注册 2007-09-05 20:15
18年会员
UID 96653
性别 男
状态 离线
记得以前下载到过这个工具,现在找不到了...

[ Last edited by tireless on 2008-9-11 at 08:22 PM ]
2 发表于 2008-09-12 02:15 ·  中国 江西 赣州 电信
银牌会员
★★★★
积分 2,025
发帖 1,122
注册 2007-09-05 20:15
18年会员
UID 96653
性别 男
状态 离线
找到了一个 exec15.zip

Exec - Written by Bill Stewart (bstewart@iname.com)

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
本帖最近评分记录 (共 1 条) 点击查看详情
评分人分数时间
DOSforever +2 2008-09-12 14:36
3 发表于 2008-09-12 16:14 ·  中国 江西 赣州 电信
银牌会员
★★★★
积分 2,025
发帖 1,122
注册 2007-09-05 20:15
18年会员
UID 96653
性别 男
状态 离线
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 发表于 2008-09-12 17:24 ·  中国 四川 南充 阆中市 电信
新手上路
积分 14
发帖 8
注册 2008-08-06 11:58
17年会员
UID 122810
性别 男
状态 离线
路过来看看了呀
























从零开始最新章节
5 发表于 2008-09-12 17:45 ·  中国 上海 电信
金牌会员
★★★★
积分 4,639
发帖 2,239
注册 2005-01-30 00:00
21年会员
UID 35785
性别 男
状态 离线
如此看来 exec.exe 称作命令执行的时间没错,因为它计算一个命令从发出到执行结束总共用了多长时间。
而 timeit.exe 应该称作命令的启动时间,它计算从发出一个命令到启动完毕用了多长时间。
6 发表于 2008-09-13 12:23 ·  中国 湖北 武汉 联通
版主
★★★★★
积分 11,386
发帖 4,938
注册 2006-07-23 17:10
20年会员
UID 59080
状态 离线
貌似这个 timeit 还生成了一个数据库文件,在当前目录。
论坛跳转: