标签:
using UnityEngine; using System.Collections; using System.Diagnostics; using System; public class PerformanceTest { public static PerformanceData Execute(Action action, int runCount) { Stopwatch sw = new Stopwatch(); sw.Start(); for (int i = 0; i < runCount; i++) { action(); } sw.Stop(); double a = sw.ElapsedMilliseconds / (double)runCount; return new PerformanceData() { TotalMilliseconds = sw.ElapsedMilliseconds, MeanMilliseconds = sw.ElapsedMilliseconds / runCount }; } } public class PerformanceData { public double TotalMilliseconds { get; set; } public double MeanMilliseconds { get; set; } }
标签:
原文地址:http://www.cnblogs.com/plateFace/p/5482682.html