Search notes:

System.Diagnostics.Stopwatch (class)

Measure elapsed time.

Powershell example

The following simple PowerShell example tries to demonstrate how System.Diagnostics.Stopwatch can be used to measure elapsed time in milliseconds:
$stopWatch = new-object System.Diagnostics.Stopwatch

$stopWatch.Start()

$null = [System.Windows.Forms.Messagebox]::Show(
    "Press OK when done"    ,
    "Measuring elapsed time",
    [System.Windows.Forms.MessageBoxButtons]::OK
)


write-output("$($stopWatch.ElapsedMilliseconds) milliseconds have elapsed")
Github repository .NET-API, path: /System/Diagnostics/Stopwatch/measure-elapsed-time.ps1

See also

System.TimeSpan

Index