private static void FindDataSets(string root, List <DataSet> dataSets) { IEnumerable <string> graphFilePaths = Directory.EnumerateFiles(root, "DelayGraph*.graphml"); if (graphFilePaths.Any()) { List <GraphAndGoalPaths> graphsAndGoalsFilePaths = new List <GraphAndGoalPaths>(); foreach (string graphFilePath in graphFilePaths) { string graphFileName = Path.GetFileName(graphFilePath); string uniquifier = ParseOutUniquifier(graphFileName); string goalFileName = BuildExpectedGoalFileName(uniquifier); IEnumerable <string> goalFilePaths = Directory.EnumerateFiles(root, goalFileName); if (goalFilePaths.Count() != 1) { Console.WriteLine("Error: Couldn't find DelayGraphOriginalGoals*.xml file for delay graph: " + graphFilePath); continue; } GraphAndGoalPaths graghAndGoalPath = new GraphAndGoalPaths(graphFilePath, goalFilePaths.First()); graphsAndGoalsFilePaths.Add(graghAndGoalPath); } if (graphsAndGoalsFilePaths.Any()) { DataSet dataSet = new DataSet(root, graphsAndGoalsFilePaths); dataSets.Add(dataSet); } } IEnumerable <string> subDirs = Directory.EnumerateDirectories(root); foreach (string subDir in subDirs) { FindDataSets(subDir, dataSets); } }
private static void TabulateAndPrintReports(List <string> algorithmNames, string scoreCardDirectoy, Dictionary <string, LatencyAssignerScoreCard> overallScoreCards, Dictionary <string, int> isBest, Dictionary <string, int> isBestOrTied, GraphAndGoalPaths graphAndGoal, int originalTargetClockRate, bool failed, Dictionary <string, LatencyAssignerScoreCard> scoreCards) { foreach (string algorithmName in algorithmNames) { var scoreCard = scoreCards[algorithmName]; int slack = originalTargetClockRate - (int)scoreCard.TotalSumOfAchievedPeriods; if (failed) { // do not sum costs for failed test - no comparison overallScoreCards[algorithmName].RegisterResult(0, 0, 0, 0, slack, scoreCard.TotalExecutionTime); } else { // sum costs for passed test overallScoreCards[algorithmName].RegisterResult(scoreCard.TotalThroughputCosts, scoreCard.TotalLatencyCosts, scoreCard.TotalRegisterCosts, (int)scoreCard.TotalSumOfAchievedPeriods, slack, scoreCard.TotalExecutionTime); } bool best; bool tied; CheckAgainstOthers(algorithmNames, scoreCards, algorithmName, scoreCard, out best, out tied); // count how many best and best-or-tied tests for each assigner if (best) { isBestOrTied[algorithmName]++; if (!tied) { isBest[algorithmName]++; } } string filePath = GetScoreCardPath(scoreCardDirectoy, algorithmName); using (StreamWriter stream = File.AppendText(filePath)) { string score = string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0},{1},{2},{3},{4},{5},{6},{7},{8}", graphAndGoal.GraphPath, scoreCard.TotalThroughputCosts, scoreCard.TotalLatencyCosts, scoreCard.TotalRegisterCosts, slack, originalTargetClockRate, scoreCard.TotalSumOfAchievedPeriods, scoreCard.TotalExecutionTime, (best ? (tied ? "*" : "**") : " ")); stream.WriteLine(score); } } }