南强小屋 Design By 杰米
Linux 下的 time 命令可以获取命令执行时间,Windows 下并没有类似的命令,我们可以自力更生写一个批处理,命名为time.bat。
[plain]
@echo off
set /a StartMS=%time:~3,1%*60000 + %time:~4,1%*6000 + %time:~6,1%*1000 + %time:~7,1%*100 + %time:~9,1%*10 + %time:~10,1%
%1 %2 %3 %4 %5 %6
set /a EndMS =%time:~3,1%*60000 + %time:~4,1%*6000 + %time:~6,1%*1000 + %time:~7,1%*100 + %time:~9,1%*10 + %time:~10,1%
set /a realtime = %EndMS%-%StartMS%
echo %realtime%ms
这是执行的例子,测试PHP 5.3、5.4、5.5 不同版本的运行速度:
[plain]
F:\BAK>time.bat F:\BAK\php-5.3.27\php.exe primes.benchmark.php
PHP version 5.3.27
Found 148933 prime numbers.
867ms
F:\BAK>time.bat F:\BAK\php-5.4.19\php.exe primes.benchmark.php
PHP version 5.4.19
Found 148933 prime numbers.
759ms
F:\BAK>time.bat F:\BAK\php-5.5.4\php.exe primes.benchmark.php
PHP version 5.5.4
Found 148933 prime numbers.
733ms
[plain]
@echo off
set /a StartMS=%time:~3,1%*60000 + %time:~4,1%*6000 + %time:~6,1%*1000 + %time:~7,1%*100 + %time:~9,1%*10 + %time:~10,1%
%1 %2 %3 %4 %5 %6
set /a EndMS =%time:~3,1%*60000 + %time:~4,1%*6000 + %time:~6,1%*1000 + %time:~7,1%*100 + %time:~9,1%*10 + %time:~10,1%
set /a realtime = %EndMS%-%StartMS%
echo %realtime%ms
这是执行的例子,测试PHP 5.3、5.4、5.5 不同版本的运行速度:
[plain]
F:\BAK>time.bat F:\BAK\php-5.3.27\php.exe primes.benchmark.php
PHP version 5.3.27
Found 148933 prime numbers.
867ms
F:\BAK>time.bat F:\BAK\php-5.4.19\php.exe primes.benchmark.php
PHP version 5.4.19
Found 148933 prime numbers.
759ms
F:\BAK>time.bat F:\BAK\php-5.5.4\php.exe primes.benchmark.php
PHP version 5.5.4
Found 148933 prime numbers.
733ms
南强小屋 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
南强小屋 Design By 杰米
暂无在windws下模拟Linux下可获取命令执行时间的time命令的评论...