Average Rating:

2.00 by 2 users.

29 Downloads, 68 Views

Measure-Sleeper.ps1

By: Klaas 21 Apr 2011 03:33 PM UTC in the category: Beginner Event 10

Description:

Gives the average time start-sleep really slept. You can choose the number of repetitions and the seconds to sleep.
<#
.SYNOPSIS
	Measure the average real sleep time of a chosen number of repetitions of a chosen time to start-sleep.
.DESCRIPTION
	Give a number of repetitions. Give a number of seconds to sleep. The scripts executes the start-sleep command and
	calculates the average time the execution was really paused.
.NOTES
	Name	:	Measure-Sleeper.ps1
	Author	:	Klaas Vandenberghe
	Date	:	2011-04-21
#>


$aantal = read-host("How many repetitions")
$tijd = read-host("How many seconds to sleep")
for ($i=1;$i -le $aantal;$i++)
	{
	$prest = measure-command {start-sleep $tijd}
	$totaal += $prest.totalmilliseconds
	}
$avg = $totaal / $aantal
"Average time start-sleep really slept was $avg milliseconds."
Top

Comments: