' Collection of code snippets by Arne Vajhøj ' posted to eksperten.dk, usenet and other places (2002-now) Imports System Imports System.Diagnostics Imports System.Threading Namespace E Public Class Program Public Shared Sub Main(args As String()) Dim startwall As DateTime = DateTime.Now Dim startcpu As Double = Process.GetCurrentProcess().TotalProcessorTime.TotalMilliseconds Dim t As Integer = 100 While True Dim x As Double = 2 For i As Integer = 0 To 999999 x = Math.Pow(Math.Sqrt(x), 2) Next Dim deltawall As Double = (DateTime.Now - startwall).TotalMilliseconds Dim deltacpu As Double = Process.GetCurrentProcess().TotalProcessorTime.TotalMilliseconds - startcpu Dim usage As Double = deltacpu / deltawall t = CInt((t * usage / 0.5 + 0.5)) Thread.Sleep(t) End While End Sub End Class End Namespace