3 回答
TA贡献1859条经验 获得超6个赞
C:\>timeit timeit -?
Invalid switch -?
Usage: TIMEIT [-f filename] [-a] [-c] [-i] [-d] [-s] [-t] [-k keyname | -r keyname] [-m mask] [commandline...]
where: -f specifies the name of the database file where TIMEIT
keeps a history of previous timings. Default is .\timeit.dat
-k specifies the keyname to use for this timing run
-r specifies the keyname to remove from the database. If
keyname is followed by a comma and a number then it will
remove the slowest (positive number) or fastest (negative)
times for that keyname.
-a specifies that timeit should display average of all timings
for the specified key.
-i specifies to ignore non-zero return codes from program
-d specifies to show detail for average
-s specifies to suppress system wide counters
-t specifies to tabular output
-c specifies to force a resort of the data base
-m specifies the processor affinity mask
Version Number: Windows NT 5.2 (Build 3790)
Exit Time: 7:38 am, Wednesday, April 15 2009
Elapsed Time: 0:00:00.000
Process Time: 0:00:00.015
System Calls: 731
Context Switches: 299
Page Faults: 515
Bytes Read: 0
Bytes Written: 0
Bytes Other: 298
TA贡献1820条经验 获得超9个赞
Measure-Command {echo hi}
Days : 0 Hours : 0 Minutes : 0 Seconds : 0 Milliseconds : 0 Ticks : 1318 TotalDays : 1.52546296296296E-09 TotalHours : 3.66111111111111E-08 TotalMinutes : 2.19666666666667E-06 TotalSeconds : 0.0001318 TotalMilliseconds : 0.1318
TA贡献1765条经验 获得超5个赞
以(hh:mm:ss.ff格式)将执行时间降低到每秒的百分之一秒 不需要下载和安装资源包 看起来像个大书呆子(谁不喜欢)
@echo off @setlocal set start=%time% :: Runs your command cmd /c %* set end=%time% set options="tokens=1-4 delims=:.," for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100 for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100 set /a hours=%end_h%-%start_h% set /a mins=%end_m%-%start_m% set /a secs=%end_s%-%start_s% set /a ms=%end_ms%-%start_ms% if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms% if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs% if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins% if %hours% lss 0 set /a hours = 24%hours% if 1%ms% lss 100 set ms=0%ms% :: Mission accomplished set /a totalsecs = %hours%*3600 + %mins%*60 + %secs% echo command took %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total)
使用
timecmd [your command]
C:\>timecmd pause Press any key to continue . . . command took 0:0:1.18
timecmd "dir c:\windows /s > nul"
- 3 回答
- 0 关注
- 2242 浏览
添加回答
举报