示例#1
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log($"Frequency = {ProcessingTimeCalculator.Frequency()}");

        foreach ((int size, int times) in sizeAndTimes)
        {
            string output = $"name\ttotal_ms\tavg_ms\t#size = {size}, times = {times}\n";

            var runAll  = new TestAll(size, times);
            var results = runAll.Run();

            foreach (var result in results)
            {
                output += $"{result.Key}\t{result.Value}\t{result.Value / times}\n";
            }

            Debug.Log(output);
        }
    }
示例#2
0
        public Dictionary <string, double> Run()
        {
            var results    = new Dictionary <string, double>();
            var calculator = new ProcessingTimeCalculator();

            foreach (var target in dic)
            {
                calculator.Reset();

                // 初回は重たくなりがちなので,一回空実行してもよいかも
                // target.Value.ProcessMain();

                for (int i = 0; i < times; ++i)
                {
                    calculator.Calculate(target.Value);
                }

                results[target.Key] = calculator.Elapsed().TotalMilliseconds;
            }

            return(results);
        }