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); }
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); } } }
private static ProfilerRecorder Create(ProfilerRecorderHandle statHandle, int maxSampleCount, ProfilerRecorderOptions options) { ProfilerRecorder result; ProfilerRecorder.Create_Injected(ref statHandle, maxSampleCount, options, out result); return(result); }
public static Recorder Get(string samplerName) { var handler = ProfilerRecorderHandle.Get(ProfilerCategory.Any, samplerName); if (!handler.Valid) { return(s_InvalidRecorder); } return(new Recorder(handler)); }
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()); }
public Recorder GetRecorder() { var handle = new ProfilerRecorderHandle((ulong)m_Ptr.ToInt64()); return(new Recorder(handle)); }
private static extern void Create_Injected(ref ProfilerRecorderHandle statHandle, int maxSampleCount, ProfilerRecorderOptions options, out ProfilerRecorder ret);
public ProfilerRecorder(ProfilerRecorderHandle statHandle, int capacity = 1, ProfilerRecorderOptions options = ProfilerRecorderOptions.Default) { this = ProfilerRecorder.Create(statHandle, capacity, options); }
public ProfilerRecorder(ProfilerMarker marker, int capacity = 1, ProfilerRecorderOptions options = ProfilerRecorderOptions.Default) { this = ProfilerRecorder.Create(ProfilerRecorderHandle.Get(marker), capacity, options); }
public unsafe ProfilerRecorder(ProfilerCategory category, char *statName, int statNameLen, int capacity = 1, ProfilerRecorderOptions options = ProfilerRecorderOptions.Default) { ProfilerRecorderHandle byName = ProfilerRecorderHandle.GetByName(category, statName, statNameLen); this = ProfilerRecorder.Create(byName, capacity, options); }
public ProfilerRecorder(ProfilerCategory category, string statName, int capacity = 1, ProfilerRecorderOptions options = ProfilerRecorderOptions.Default) { ProfilerRecorderHandle byName = ProfilerRecorderHandle.GetByName(category, statName); this = ProfilerRecorder.Create(byName, capacity, options); }