geob's Posts

You still did a fine job. Im no coder, but it looks like what i did works great. And yes you could pass a commandline option, and the use a select case statement to kick off multiple th... See more...
You still did a fine job. Im no coder, but it looks like what i did works great. And yes you could pass a commandline option, and the use a select case statement to kick off multiple threads.:D
I took it one step further, and made it multi-threaded. I compiled this in VB 2010, and it worked great. I then set a batch file up to run from VMware Tools at start up. It will peg a 2 Proc... See more...
I took it one step further, and made it multi-threaded. I compiled this in VB 2010, and it worked great. I then set a batch file up to run from VMware Tools at start up. It will peg a 2 Proc VM. - Begine Code - #Region " Imports " Imports System.Threading #End Region #Region " Module Module1 " Module Module1 #Region " Sub Main " Sub Main() Try Dim tmpWorker1 As New Thread(AddressOf Worker_Thread_1) Dim tmpWorker2 As New Thread(AddressOf Worker_Thread_2) tmpWorker1.Name = "Worker Thread # 1" tmpWorker2.Name = "Worker Thread # 2" tmpWorker1.Priority = ThreadPriority.Normal tmpWorker2.Priority = ThreadPriority.Normal 'tmpWorker1.IsBackground = True 'tmpWorker2.IsBackground = True tmpWorker1.Start() tmpWorker2.Start() Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub #End Region #Region " Private Sub Worker_Thread_1 " Private Sub Worker_Thread_1() Try Dim goal As Long Dim x As Long Dim y As Long Dim i As Long goal = 2181818 Do While True Dim BeginTime As DateTime = Now For i = 0 To goal x = 0.000001 y = Math.Sin(x) y = y + 0.00001 Next y = y + 0.01 Dim Span As TimeSpan = DateTime.Now.Subtract(BeginTime) Console.WriteLine("CPUWorkOut(Worker1) processed three million sines in " & Span.Milliseconds & " milliseconds!") Loop Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub #End Region #Region " Private Sub Worker_Thread_2 " Private Sub Worker_Thread_2() Try Dim goal As Long Dim x As Long Dim y As Long Dim i As Long goal = 2181818 Do While True Dim BeginTime As DateTime = Now For i = 0 To goal x = 0.000001 y = Math.Sin(x) y = y + 0.00001 Next y = y + 0.01 Dim Span As TimeSpan = DateTime.Now.Subtract(BeginTime) Console.WriteLine("CPUWorkOut(Worker2) processed three million sines in " & Span.Milliseconds & " milliseconds!") Loop Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub #End Region End Module #End Region - End Code -
Any of you coders know how to convert the following VBsript code to code that would function in Visual Basic console app? --Script Begin --- Dim goal Dim before Dim x Dim y Dim i ... See more...
Any of you coders know how to convert the following VBsript code to code that would function in Visual Basic console app? --Script Begin --- Dim goal Dim before Dim x Dim y Dim i goal = 2181818 Do While True before = Timer For i = 0 to goal x = 0.000001 y = sin(x) y = y + 0.00001 Next y = y + 0.01 WScript.Echo "I did three million sines in " & Int(Timer - before + 0.5) & " seconds!" Loop -Script End - Thanks in advance. Geob