static double GetRecorderFrameAverage(ProfilerRecorder recorder) { var samplesCount = recorder.Capacity; if (samplesCount == 0) { return(0); } double r = 0; //unsafe { var samples = new List <ProfilerRecorderSample>(); recorder.CopyTo(samples); for (var i = 0; i < samples.Count; ++i) { r += samples[i].Value; } r /= samples.Count; } return(r); }
static double GetRecorderFrameAverage(ProfilerRecorder recorder) { var samplesCount = recorder.Capacity; if (samplesCount == 0) { return(0); } double r = 0; unsafe { var samples = stackalloc ProfilerRecorderSample[samplesCount]; recorder.CopyTo(samples, samplesCount); for (var i = 0; i < samplesCount; ++i) { r += samples[i].Value; } r /= samplesCount; } r *= (1e-6f); return(r); }
private double GetRecorderFrameTimeAverage(ProfilerRecorder recorder) { int samplesCount = recorder.Capacity; if (samplesCount == 0) { return(0); } List <ProfilerRecorderSample> samples = new List <ProfilerRecorderSample>(samplesCount); recorder.CopyTo(samples); double r = samples.Aggregate <ProfilerRecorderSample, double>(0, (current, sample) => current + sample.Value); r /= samplesCount; return(r); }