PSProfiler
PSProfiler copied to clipboard
Add `-HumanReadable` switch for ms duration formatting
Salutations👋
I was using this script to speed up my pwsh startup time, and I found the duration formatting a bit hard to read
Is there any interest in a -HumanReadable
flag or similar to format the durations?
~ ❯ pwsh -NoProfile {
Import-Module ~\git\PSProfiler\src\PSProfiler.psd1
Measure-Script -Path ~\git\posh-git\src\all.ps1
}
~\git\posh-git\src\all.ps1
Count Line Time Taken Statement
----- ---- ---------- ---------
0 1 00:00.0000000
1 2 00:00.0412562 . $PSScriptRoot\ConsoleMode.ps1
1 3 00:00.0323621 . $PSScriptRoot\Utils.ps1
1 4 00:00.0093024 . $PSScriptRoot\AnsiUtils.ps1
1 5 00:00.0035924 . $PSScriptRoot\WindowTitle.ps1
1 6 00:00.0070591 . $PSScriptRoot\PoshGitTypes.ps1
1 7 00:00.0085255 . $PSScriptRoot\GitUtils.ps1
1 8 00:00.0501589 . $PSScriptRoot\GitPrompt.ps1
1 9 00:00.0049326 . $PSScriptRoot\GitParamTabExpansion.ps1
1 10 00:00.0839039 . $PSScriptRoot\GitTabExpansion.ps1
1 11 00:00.0057058 . $PSScriptRoot\TortoiseGit.ps1
~ ❯ pwsh -NoProfile {
Import-Module ~\git\PSProfiler\src\PSProfiler.psd1
Measure-Script -HumanReadable -Path ~\git\posh-git\src\all.ps1
}
~\git\posh-git\src\all.ps1
Count Line Time Taken Statement
----- ---- ---------- ---------
0 1 0ms
1 2 27ms . $PSScriptRoot\ConsoleMode.ps1
1 3 31ms . $PSScriptRoot\Utils.ps1
1 4 9ms . $PSScriptRoot\AnsiUtils.ps1
1 5 4ms . $PSScriptRoot\WindowTitle.ps1
1 6 7ms . $PSScriptRoot\PoshGitTypes.ps1
1 7 8ms . $PSScriptRoot\GitUtils.ps1
1 8 48ms . $PSScriptRoot\GitPrompt.ps1
1 9 5ms . $PSScriptRoot\GitParamTabExpansion.ps1
1 10 94ms . $PSScriptRoot\GitTabExpansion.ps1
1 11 5ms . $PSScriptRoot\TortoiseGit.ps1