powershell - 如何找到 PowerShell 中的最短执行时间?

标签 powershell time

我一直在 PowerShell 中使用 Measure-Command 来计时 Python 脚本的执行时间:

Measure-Command{C:\Python27\python.exe script.py}

这会以多种形式显示执行时间,包括TotalSeconds

为了最大限度地减少开销的影响,我想运行脚本 10 次,并找到 10 次运行中的最小 TotalSeconds 值。有没有一种简单的方法可以在 PowerShell 中执行此操作?

最佳答案

使用Measure-Object命令,如this SO answer :

C:\PS> 1..10 | % { Measure-Command { C:\Python27\python.exe script.py } } | Measure-Object -Minimum

Count    : 3
Average  : 
Sum      : 
Maximum  : 
Minimum  : 00:00:00.0095165
Property : 

关于powershell - 如何找到 PowerShell 中的最短执行时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38113055/

相关文章:

azure - 使用 PowerShell 锁定 Azure 资源

C: 我可以让我的程序看起来在 0 秒内运行吗

php - 解析 Twitter API 日期戳

powershell - 将Powershell中的命令输出捕获为字符串而不是字符串数组

powershell - netsh acl 设置(需要替代方法 - 注册表设置?)

c - 以微秒为单位获取 C 中的时间戳?

java - 如何使用 JSpinner 分别更改小时、分钟和秒?

ios - 如何调试具有时间依赖性的iOS应用

powershell - 如何在Powershell脚本结尾自动停止所有启动的进程

powershell - 如何将 get-childitem 的结果传递到命令中?