private void AddMeasureResults(MeasureResults results, int shiftColumn, bool reverse)
 {
     if (results != null)
     {
         for (int pos = 0; pos < results.Count; pos++)
         {
             int row = pos;
             if (reverse)
             {
                 row = Rows - pos - 1;
             }
             var point = results[pos];
             Data[row, shiftColumn].Content = point.ReferencePressure.PressureByUnits.ToString(PressValFormat);
             if (point is CurrentCheckPoint)
             {
                 Data[row, 1 + shiftColumn].Content = (point as CurrentCheckPoint).CurrentFromEtalonPressure.ToString(CurrValFormat);
                 Data[row, 2 + shiftColumn].Content = (point as CurrentCheckPoint).MeasuredCurrent.ToString(CurrValFormat);
             }
             else
             {
                 Data[row, 1 + shiftColumn].Content = "-";
                 Data[row, 2 + shiftColumn].Content = "-";
             }
             Data[row, 3 + shiftColumn].Content = point.Pressure.PressureByUnits.ToString(PressValFormat);
             Data[row, 4 + shiftColumn].Content = point.ErrorMeasure.ToString(ErrValFormat);
             Data[row, 4 + shiftColumn].Color   = ResumeToColor(results[pos].Resume);
         }
     }
 }
Beispiel #2
0
 private IEnumerable <Series> ConvertAllSeries(MeasureResults results, bool isMemory)
 {
     if ((results.Types & StructureType.RBTree) > 0)
     {
         var series = ConvertResults(results.GetResults(StructureType.RBTree), isMemory);
         series.Name = Properties.Resources.RBTree;
         yield return(series);
     }
     if ((results.Types & StructureType.VEB) > 0)
     {
         var series = ConvertResults(results.GetResults(StructureType.VEB), isMemory);
         series.Name = Properties.Resources.VEB;
         yield return(series);
     }
     if ((results.Types & StructureType.XTrieDPH) > 0)
     {
         var series = ConvertResults(results.GetResults(StructureType.XTrieDPH), isMemory);
         series.Name = Properties.Resources.XTrieDPH;
         yield return(series);
     }
     if ((results.Types & StructureType.YTrieDPH) > 0)
     {
         var series = ConvertResults(results.GetResults(StructureType.YTrieDPH), isMemory);
         series.Name = Properties.Resources.YTrieDPH;
         yield return(series);
     }
     if ((results.Types & StructureType.XTrieStandard) > 0)
     {
         var series = ConvertResults(results.GetResults(StructureType.XTrieStandard), isMemory);
         series.Name = Properties.Resources.XTrieStandard;
         yield return(series);
     }
     if ((results.Types & StructureType.YTrieStandard) > 0)
     {
         var series = ConvertResults(results.GetResults(StructureType.YTrieStandard), isMemory);
         series.Name = Properties.Resources.YTrieStandard;
         yield return(series);
     }
 }
        private void AddVariations(MeasureResults measureResults, Variations variationResults)
        {
            const string VariationFormat = "0.0000";

            if (variationResults != null)
            {
                for (int row = 0; row < measureResults.Count; row++)
                {
                    var variation = variationResults.GetVariationPointByPercent(measureResults[row].PercentRange);
                    if (variation != null)
                    {
                        Data[row, 10].Content = variation.Value.ToString(VariationFormat);
                        Data[row, 10].Color   = ResumeToColor(variation.Resume);
                    }
                    else
                    {
                        Data[row, 10].Content = "-----";
                        Data[row, 10].Color   = ColorItem.Neutral;
                    }
                }
            }
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            if (args.Length != 6 && args.Length != 7)
            {
                System.Console.WriteLine("USAGE: Kora.Benchmark.exe PATH START COUNT STEP <F|S> <ad|r> [CONTROL]");
                System.Console.WriteLine("PATH - where to dump the results");
                System.Console.WriteLine("START, COUNT, STEP - controls amount of elements in collections.");
                System.Console.WriteLine("<F|S> - F is for fast structures only: rbtree, veb, xtrie-std, ytrie-std, S is for all");
                System.Console.WriteLine("<a|d|f|s|m> - benchmark type: (a)dd, (d)el, (f)ind, (s)ucc, (m)emory");
                System.Console.WriteLine("CONTROL - When measuring find and succ how many keys should we search");
                return;
            }
            string path  = args[0];
            int    start = int.Parse(args[1]);
            int    count = int.Parse(args[2]);
            int    step  = int.Parse(args[3]);

            StructureType types = 0;

            if (args[4].Equals("f", StringComparison.OrdinalIgnoreCase))
            {
                types = Fast;
            }
            else if (args[4].Equals("s", StringComparison.OrdinalIgnoreCase))
            {
                types = All;
            }
            else
            {
                throw new ArgumentException();
            }

            BenchmarkType type;

            if (args[5].Equals("a", StringComparison.OrdinalIgnoreCase))
            {
                type = BenchmarkType.Add;
            }
            else if (args[5].Equals("d", StringComparison.OrdinalIgnoreCase))
            {
                type = BenchmarkType.Delete;
            }
            else if (args[5].Equals("f", StringComparison.OrdinalIgnoreCase))
            {
                type = BenchmarkType.Search;
            }
            else if (args[5].Equals("s", StringComparison.OrdinalIgnoreCase))
            {
                type = BenchmarkType.Successor;
            }
            else if (args[5].Equals("m", StringComparison.OrdinalIgnoreCase))
            {
                type = BenchmarkType.Memory;
            }
            else
            {
                throw new ArgumentException();
            }

            int rets = (type == BenchmarkType.Search || type == BenchmarkType.Successor) ? int.Parse(args[6]) : 0;

            MeasureResults results = null;

            switch (type)
            {
            case BenchmarkType.Add:
                results = Kora.Benchmarking.MeasureSeriesAdd(types, start, count, start);
                break;

            case BenchmarkType.Delete:
                results = Kora.Benchmarking.MeasureSeriesDelete(types, start, count, start);
                break;

            case BenchmarkType.Search:
                results = Kora.Benchmarking.MeasureSeriesSearch(types, start, count, start, rets);
                break;

            case BenchmarkType.Successor:
                results = Kora.Benchmarking.MeasureSeriesSuccessor(types, start, count, start, rets);
                break;

            case BenchmarkType.Memory:
                results = Kora.Benchmarking.MeasureSeriesMemory(types, start, count, start);
                break;
            }

            bool isMemory = type == BenchmarkType.Memory;

            Tuple <long, long>[] currentResults;
            // dump rbtree
            currentResults = results.GetResults(StructureType.RBTree);
            if (currentResults != null)
            {
                DumpResults(currentResults, Path.Combine(path, "RBTree"), isMemory);
            }
            // dump veb
            currentResults = results.GetResults(StructureType.VEB);
            if (currentResults != null)
            {
                DumpResults(currentResults, Path.Combine(path, "VEB"), isMemory);
            }
            // dump dph
            currentResults = results.GetResults(StructureType.DPH);
            if (currentResults != null)
            {
                DumpResults(currentResults, Path.Combine(path, "DPH"), isMemory);
            }
            // dump dph
            currentResults = results.GetResults(StructureType.DPH);
            if (currentResults != null)
            {
                DumpResults(currentResults, Path.Combine(path, "DPH"), isMemory);
            }
            // dump xt-dph
            currentResults = results.GetResults(StructureType.XTrieDPH);
            if (currentResults != null)
            {
                DumpResults(currentResults, Path.Combine(path, "XTrie-DPH"), isMemory);
            }
            // dump yt-dph
            currentResults = results.GetResults(StructureType.YTrieDPH);
            if (currentResults != null)
            {
                DumpResults(currentResults, Path.Combine(path, "YTrie-DPH"), isMemory);
            }
            // dump xt-std
            currentResults = results.GetResults(StructureType.XTrieStandard);
            if (currentResults != null)
            {
                DumpResults(currentResults, Path.Combine(path, "XTrie-Standard"), isMemory);
            }
            // dump yt-std
            currentResults = results.GetResults(StructureType.YTrieStandard);
            if (currentResults != null)
            {
                DumpResults(currentResults, Path.Combine(path, "YTrie-Standard"), isMemory);
            }
        }
 private void AddResultTopDown(MeasureResults results)
 {
     AddMeasureResults(results, 5, true);
 }
 private void AddResultUpwards(MeasureResults results)
 {
     AddMeasureResults(results, 0, false);
 }