public void LoadEditorCounters(out SortedDictionary <string, List <string> > systemCounters, out SortedDictionary <string, List <string> > userCounters) { userCounters = new SortedDictionary <string, List <string> >(); systemCounters = new SortedDictionary <string, List <string> >(); var availableCounterHandles = new List <ProfilerRecorderHandle>(); ProfilerRecorderHandle.GetAvailable(availableCounterHandles); foreach (var availableCounterHandle in availableCounterHandles) { var markerInfo = ProfilerRecorderHandle.GetDescription(availableCounterHandle); if ((markerInfo.Flags & MarkerFlags.Counter) == 0) { continue; } var counterName = markerInfo.Name; var categoryName = markerInfo.Category.Name; if ((markerInfo.Flags & MarkerFlags.Script) != 0) { AddToCountersCollection(categoryName, counterName, userCounters); } else { AddToCountersCollection(categoryName, counterName, systemCounters); } } }
public static int GetNames(List <string> names) { var availableMarkers = new List <ProfilerRecorderHandle>(); ProfilerRecorderHandle.GetAvailable(availableMarkers); if (names != null) { if (names.Count < availableMarkers.Count) { names.Capacity = availableMarkers.Count; for (int i = names.Count; i < availableMarkers.Count; i++) { names.Add(null); } } int index = 0; foreach (var h in availableMarkers) { var statDesc = ProfilerRecorderHandle.GetDescription(h); names[index] = statDesc.Name; index++; } } return(availableMarkers.Count); }
internal Recorder(ProfilerRecorderHandle handle) { if (!handle.Valid) { return; } m_RecorderCPU = new ProfilerRecorder(handle, 1, s_RecorderDefaultOptions); var description = ProfilerRecorderHandle.GetDescription(handle); if ((description.Flags & MarkerFlags.SampleGPU) != 0) { m_RecorderGPU = new ProfilerRecorder(handle, 1, s_RecorderDefaultOptions | ProfilerRecorderOptions.GpuRecorder); } }
static unsafe void EnumerateProfilerStats() { var availableStatHandles = new List <ProfilerRecorderHandle>(); ProfilerRecorderHandle.GetAvailable(availableStatHandles); var availableStats = new List <StatInfo>(availableStatHandles.Count); foreach (var h in availableStatHandles) { var statDesc = ProfilerRecorderHandle.GetDescription(h); var statInfo = new StatInfo() { Cat = statDesc.Category, Name = statDesc.Name, Unit = statDesc.UnitType }; availableStats.Add(statInfo); } availableStats.Sort((a, b) => { var result = string.Compare(a.Cat.ToString(), b.Cat.ToString()); if (result != 0) { return(result); } return(string.Compare(a.Name, b.Name)); }); var sb = new StringBuilder("Available stats:\n"); foreach (var s in availableStats) { sb.AppendLine($"{(int)s.Cat}\t\t - {s.Name}\t\t - {s.Unit}"); } Debug.Log(sb.ToString()); }