singrdk/base/Applications/ServiceManager/Benchmark/JobSet.sg

74 lines
2.1 KiB
Plaintext
Raw Normal View History

2008-03-05 09:52:00 -05:00
///////////////////////////////////////////////////////////////////////////////
//
// Microsoft Research Singularity
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: Applications\ServiceManager\Benchmark\JobSet.sg
//
// Note:
//
using System;
using System.Collections;
using Microsoft.SingSharp;
using Microsoft.Singularity;
using Microsoft.Singularity.Channels;
using Microsoft.Singularity.ServiceManager;
using Microsoft.Singularity.Services;
namespace Microsoft.Singularity.Applications.ServiceManager
{
internal class JobSet
{
internal static void Start(BenchmarkServerInfo! info,
TRef<ServiceControlContract.Imp:Ready>! tref)
{
IList modules = new ArrayList();
modules.Add(new CommunicationJob(info));
modules.Add(new ArgumentJob(info));
modules.Add(new MultiThreadJob(info, tref));
DoJob(modules);
Console.WriteLine(info.BinaryName);
Console.WriteLine("====================");
DebugStub.WriteLine(info.BinaryName);
DebugStub.WriteLine("====================");
PrintResult(modules);
modules.Clear();
}
private static void DoJob(IList modules)
{
Job job;
if (modules == null) {
return;
}
foreach (Object obj in modules) {
if (obj != null) {
job = obj as Job;
if (job != null) {
job.Run();
}
}
}
}
private static void PrintResult(IList modules) {
if (modules == null) {
return;
}
foreach (Object obj in modules) {
if (obj != null) {
Console.WriteLine(obj.ToString());
DebugStub.WriteLine(obj.ToString());
}
}
}
}
}