예제 #1
0
        public Config(ScenarioTypeAttribute scenario
            , ImplementationTypeAttribute implementation
            , uint runs, ScenarioTypeAttribute[] knownScenarios
            , ImplementationTypeAttribute[] knownImplementations
            , IList<TypeLocator> perfTests
            , string pluginPath)
        {
            Scenario = scenario;
            Implementation = implementation;
            Runs = runs;
            KnownScenarios = knownScenarios;
            KnownImplementations = knownImplementations;
            PerfTests = perfTests;
            PluginPath = pluginPath;
            Groups = new Dictionary<ScenarioTypeAttribute, IDictionary<ImplementationTypeAttribute, TypeLocator>>();

            foreach (var knownScenario in KnownScenarios)
            {
                var inner = new Dictionary<ImplementationTypeAttribute, TypeLocator>();

                foreach (var knownImplementation in KnownImplementations)
                {
                    inner[knownImplementation] = perfTests.FirstOrDefault(pt => pt.Attributes.Contains(knownImplementation) && pt.Attributes.Contains(knownScenario));
                }

                Groups[knownScenario] = inner;
            }
        }
예제 #2
0
 public Scenario(ScenarioTypeAttribute scenario, int numberOfCores, Config config)
 {
     if (config.Implementation == null)
     {
         foreach (var implementation in config.KnownImplementations)
         {
             _implementations.Add(new Implementation(scenario, implementation, (int) config.Runs, numberOfCores, config));
         }
     }
     else
     {
         _implementations.Add(new Implementation(scenario, config.Implementation, (int)config.Runs, numberOfCores, config));
     }
 }
        public Implementation(ScenarioTypeAttribute scenario, ImplementationTypeAttribute implementation, int runs, int numberOfCores, Config config)
        {
            _scenarioName = scenario.Description;
            _implementationName = implementation.Description;
            var type = config.Groups[scenario][implementation];

            // HACK: shouldn't add combinations that don't exist
            if (type == null)
            {
                return;
            }

            _domain = CreateSandboxDomain("Sandbox Domain", config.PluginPath, SecurityZone.Internet);

            for (int i = 0; i < config.Runs; i++)
            {
                var perfTest = (PerfTest)_domain.CreateInstanceAndUnwrap(type.AssemblyName, type.TypeName);
                _testRuns.Add(perfTest.CreateTestRun(i,numberOfCores));
            }
        }
 public bool Equals(ScenarioTypeAttribute other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return base.Equals(other) && Equals(other.Description, Description);
 }