Exemple #1
0
 public void diffCacheResult(CPUCacheData compare)
 {
     foreach (var v in matchingData)
     {
         foundDifference = true;
         if (compare.matchingData[v.Key] != v.Value)
         {
             diffData.Add(v.Key, Tuple.Create<int, int>(v.Value, compare.matchingData[v.Key]));
         }
     }
 }
Exemple #2
0
        private static void DiffParsecFiles(string inputFile, StringBuilder sb, string bench, int numCache)
        {
            List<CPUCacheData> baseline = new List<CPUCacheData>();
            List<CPUCacheData> comparison = new List<CPUCacheData>();

            List<CPUCacheData> currList = baseline;

            // there are CPUs , and each cpu has a bunch of metrics
            using (StreamReader sr = new StreamReader(inputFile))
            {
                string line;
                // parse header
                do
                {
                    line = sr.ReadLine();
                } while (line != null && !line.Contains("numReadHits"));

                if (line == null)
                {
                    Console.WriteLine("*** bad input file");
                }

                bool firstResult = true;
                while (line != null)
                {
                    CPUCacheData c = new CPUCacheData();
                    string[] fieldNames = line.Split(',');

                    string[] values = sr.ReadLine().Split(',');
                    Debug.Assert(fieldNames[0].Equals("CPUId", StringComparison.InvariantCultureIgnoreCase));
                    c.CPUid = Int32.Parse(values[0]);
                    Debug.Assert(c.CPUid >= 0 && c.CPUid <= 15);
                    for (int i = 1; i < fieldNames.Length; i++)
                    {
                        c.matchingData.Add(fieldNames[i], Int32.Parse(values[i]));
                    }

                    if (!firstResult && c.CPUid == 0)
                    {
                        currList = comparison;
                    }
                    currList.Add(c);
                    firstResult = false;
                    line = sr.ReadLine();
                }
            }

            Console.WriteLine("Baseline: {0}, Comparison: {1}", baseline.Count, comparison.Count);

            for (int i = 0; i < baseline.Count; i++)
            {
                baseline[i].diffCacheResult(comparison[i]);
                string line = baseline[i].diffToString(bench, numCache);
                if (line != null)
                {
                    sb.Append(line);
                }
            }
        }