简单的查看函数时间运行类
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; } }
如果你感兴趣,你可以把你妹妹介绍给我