private int GetGpuCategoryByCpuSample(ThreadData thread, GPUTime gpuSample) { int category = (int)Category.Other; var cpuSample = GetCpuSample(thread, gpuSample); for (var current = cpuSample; current != null; current = current.parent) { if (current.sampleName == null) { continue; } if (current.sampleName.EndsWith("Opaques")) { return((int)Category.Opaque); } else if (current.sampleName.EndsWith("Transparents")) { return((int)Category.Transparent); } else if (current.sampleName.EndsWith("ShadowMap")) { return((int)Category.Shadowmap); } else if (current.sampleName.Contains("PostProcessing")) { return((int)Category.PostProcess); } } return(category); }
public override string ToString() { if (UseGPU) { return(Label + " " + GPUTime.ToString("0.00") + " / " + CPUTime.ToString("0.00")); } return(Label + " " + CPUTime.ToString("0.00")); }
private ProfilerSample GetCpuSample(ThreadData thread, GPUTime gpuSample) { int idx = (int)gpuSample.relatedSampleIndex; if (thread.m_AllSamples == null) { return(null); } if (idx < 0 || idx >= thread.m_AllSamples.Count) { return(null); } ProfilerSample cpuSample = thread.m_AllSamples[idx]; return(cpuSample); }
public void AddGpuSample(GPUTime gpuTime, int category) { if (gpuTimeByCategory == null) { gpuTimeByCategory = new Dictionary <int, GpuTimeInfo>(); } GpuTimeInfo time; if (gpuTimeByCategory.TryGetValue(category, out time)) { time.time += gpuTime.gpuTimeInMicroSec; time.count += 1; gpuTimeByCategory[category] = time; } else { time = new GpuTimeInfo { time = gpuTime.gpuTimeInMicroSec, count = 1 }; gpuTimeByCategory.Add(category, time); } }