Skip to content

Instantly share code, notes, and snippets.

@kdrag0n
Last active July 1, 2019 05:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kdrag0n/2de3a51bb2aac99cfb9003534bed002e to your computer and use it in GitHub Desktop.
Save kdrag0n/2de3a51bb2aac99cfb9003534bed002e to your computer and use it in GitHub Desktop.
WSL 2 boot speed tester written in PowerShell. Usage: Bootbench.ps1 [runs: default = 4]
$runs = If ($args.Length > 0) {$args[0]} Else {10}
$acc = 0
wsl --shutdown > $null
for ($i = 1; $i -le $runs; $i++) {
Write-Host -NoNewLine "Run $($i): "
$time = (Measure-Command {wsl /bin/true}).TotalMilliseconds
"$time ms" | Out-Default
$acc += $time
wsl --shutdown > $null
}
$acc /= $runs
"" | Out-Default
"Average: $acc ms" | Out-Default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment