// Add a benchmark to the list of benchmarks read in from the .XML file. public void AddBenchmark ( string name, string suiteName, string tags, string workingDirectory, string exeName, string exeArgs, bool doRunInShell, bool useSSE, bool useAVX, int expectedResults ) { BenchmarkSuite benchmarkSuite; BenchmarkTagSet benchmarkTagSet; Benchmark benchmark; benchmark = new Benchmark(name, suiteName, tags, workingDirectory, exeName, exeArgs, doRunInShell, useSSE, useAVX, expectedResults); BenchmarkList.Add(benchmark); if (!BenchmarkSuiteTable.TryGetValue(suiteName, out benchmarkSuite)) { benchmarkSuite = new BenchmarkSuite(suiteName); BenchmarkSuiteTable.Add(suiteName, benchmarkSuite); } benchmarkSuite.BenchmarkList.Add(benchmark); string[] tagList = tags.Split(ListSeparatorCharSet, StringSplitOptions.RemoveEmptyEntries); foreach (string tag in tagList) { if (!BenchmarkTagSetTable.TryGetValue(tag, out benchmarkTagSet)) { benchmarkTagSet = new BenchmarkTagSet(tag); BenchmarkTagSetTable.Add(tag, benchmarkTagSet); } benchmarkTagSet.BenchmarkList.Add(benchmark); } }
// Select benchmarks to run based on controls for suite, tag, or specfic // benchmark inclusion/exclusion. public void SelectBenchmarks() { List <Benchmark> benchmarkList = BenchmarkList; List <string> includeBenchmarkList = Controls.IncludeBenchmarkList; List <string> excludeBenchmarkList = Controls.ExcludeBenchmarkList; List <string> includeTagList = Controls.IncludeTagList; List <string> excludeTagList = Controls.ExcludeTagList; string suiteName = Controls.SuiteName; if (suiteName != "") { BenchmarkSuite benchmarkSuite = null; if (!BenchmarkSuiteTable.TryGetValue(suiteName, out benchmarkSuite)) { throw new Exception("bad suite name: " + suiteName); } benchmarkList = benchmarkSuite.BenchmarkList; } foreach (Benchmark benchmark in benchmarkList) { string benchmarkName = benchmark.Name; bool include = true; if (includeBenchmarkList.Count > 0) { include = false; if (includeBenchmarkList.Contains(benchmarkName)) { include = true; } } if (include && (excludeBenchmarkList.Count > 0)) { if (excludeBenchmarkList.Contains(benchmarkName)) { include = false; } } if (include && (excludeTagList.Count > 0)) { foreach (string tag in excludeTagList) { BenchmarkTagSet benchmarkTagSet = null; if (!BenchmarkTagSetTable.TryGetValue(tag, out benchmarkTagSet)) { throw new Exception("bad tag: " + tag); } List <Benchmark> excludeTagBenchmarkList = benchmarkTagSet.BenchmarkList; if (excludeTagBenchmarkList.Contains(benchmark)) { include = false; } } } if (include) { SelectedBenchmarkList.Add(benchmark); } } }