|
using System;
using System.Collections;
using Sample.Mocks;
using Sample.Tests;
namespace Sample
{
class Sample
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
try
{
Initialize();
Console.Write("Number of threads? ");
int threadCount = int.Parse(Console.ReadLine());
Console.Write("Number of commands to execute? ");
int passes = int.Parse(Console.ReadLine());
ThreadContext context = new ThreadContext();
GeneralTest tests = new GeneralTest(context,passes);
ArrayList commands = tests.BasicGeneralCommandTest();
DateTime start = DateTime.Now;
//((ICommand)commands[0]).BasicGeneralCommandTest();
SimpleThreadPool pool = new SimpleThreadPool(commands, threadCount);
pool.Execute();
DateTime end = DateTime.Now;
double totalSeconds = 0;
foreach (CommandResult result in context.CommandResults)
{
totalSeconds += result.TimeProcessing.TotalSeconds;
}
Console.WriteLine("Aggregate Time: " + end.Subtract(start).TotalSeconds);
Console.WriteLine("Individual Time: " + totalSeconds);
TearDown();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.Read();
}
private static void Initialize() {
Mock mock = new Mock();
Console.WriteLine(string.Empty);
}
private static void TearDown() {
Console.WriteLine("Done!");
Console.Read();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Independent contract developer for .NET data-oriented systems.
not much to say about myself but feel free to contact me for any inquiries and comments!