public static unsafe void MarkerBegin(IntPtr markerHandle, int metadata) { var data = new ProfilerMarkerData { Type = (byte)ProfilerMarkerDataType.Int32, Size = (uint)UnsafeUtility.SizeOf <int>(), Ptr = UnsafeUtility.AddressOf(ref metadata) }; ProfilerUnsafeUtility.BeginSampleWithMetadata(markerHandle, 1, &data); }
public ProfilerCounter(ProfilerCategory category, string name, ProfilerMarkerDataUnit dataUnit) { #if ENABLE_PROFILER m_Type = ProfilerUtility.GetProfilerMarkerDataType <T>(); m_Ptr = ProfilerUnsafeUtility.CreateMarker(name, category, MarkerFlags.Counter, 1); ProfilerUnsafeUtility.SetMarkerMetadata(m_Ptr, 0, null, m_Type, (byte)dataUnit); #endif }
public ProfilerMarker(ProfilerCategory category, string name, string param1Name) { #if ENABLE_PROFILER m_P1Type = ProfilerUtility.GetProfilerMarkerDataType <TP1>(); m_Ptr = ProfilerUnsafeUtility.CreateMarker(name, category, MarkerFlags.Default, 1); ProfilerUnsafeUtility.SetMarkerMetadata(m_Ptr, 0, param1Name, m_P1Type, (byte)ProfilerMarkerDataUnit.Undefined); #endif }
public static CustomSampler Create(string name, bool collectGpuData = false) { IntPtr nativeSampler = ProfilerUnsafeUtility.CreateMarker(name, ProfilerUnsafeUtility.CategoryScripts, MarkerFlags.Default | (collectGpuData ? MarkerFlags.SampleGPU : 0), 0); if (nativeSampler == IntPtr.Zero) { return(s_InvalidCustomSampler); } return(new CustomSampler(nativeSampler)); }
public static unsafe void BeginSample(string s) { #if ENABLE_PROFILER // Just gets the marker if it already exists - this is much slower than using ProfilerMarker objects though // because they just store the marker internally for reuse (avoiding a lot of potential string comparisons) IntPtr marker = ProfilerUnsafeUtility.CreateMarker(s, ProfilerUnsafeUtility.InternalCategoryInternal, MarkerFlags.Default, 0); ProfilerUnsafeUtility.BeginSample(marker); ProfilerProtocolThread.Stream.markerStack.PushMarker(marker); #endif }
public static ProfilerMarkerWithStringData Create(string name, string parameterName) { var marker = ProfilerUnsafeUtility.CreateMarker(name, ProfilerUnsafeUtility.CategoryOther, MarkerFlags.Default, 1); ProfilerUnsafeUtility.SetMarkerMetadata(marker, 0, parameterName, (byte)ProfilerMarkerDataType.String16, 0); return(new ProfilerMarkerWithStringData { _marker = marker }); }
public static unsafe void Begin(this ProfilerMarker marker, ulong metadata) { var data = new ProfilerMarkerData { Type = (byte)ProfilerMarkerDataType.UInt64, Size = (uint)UnsafeUtility.SizeOf <ulong>(), Ptr = &metadata }; ProfilerUnsafeUtility.BeginSampleWithMetadata(marker.Handle, 1, &data); }
public static Sampler Get(string name) { IntPtr nativeSampler = ProfilerUnsafeUtility.GetMarker(name); if (nativeSampler == IntPtr.Zero) { return(s_InvalidSampler); } return(new Sampler(nativeSampler)); }
public void End() { #if ENABLE_PROFILER // Early out as soon as possible if profiler disabled if (!PlayerConnectionProfiler.Enabled) { return; } ProfilerUnsafeUtility.EndSample(m_Ptr); #endif }
public ProfilerMarker(string name, string param1Name, string param2Name, string param3Name) { #if ENABLE_PROFILER m_P1Type = ProfilerUtility.GetProfilerMarkerDataType <TP1>(); m_P2Type = ProfilerUtility.GetProfilerMarkerDataType <TP2>(); m_P3Type = ProfilerUtility.GetProfilerMarkerDataType <TP3>(); m_Ptr = ProfilerUnsafeUtility.CreateMarker(name, ProfilerUnsafeUtility.CategoryScripts, MarkerFlags.Default, 3); ProfilerUnsafeUtility.SetMarkerMetadata(m_Ptr, 0, param1Name, m_P1Type, (byte)ProfilerMarkerDataUnit.Undefined); ProfilerUnsafeUtility.SetMarkerMetadata(m_Ptr, 1, param2Name, m_P2Type, (byte)ProfilerMarkerDataUnit.Undefined); ProfilerUnsafeUtility.SetMarkerMetadata(m_Ptr, 2, param3Name, m_P3Type, (byte)ProfilerMarkerDataUnit.Undefined); #endif }
public unsafe void Begin(TP1 p1) { #if ENABLE_PROFILER var data = new ProfilerMarkerData { Type = m_P1Type, Size = (uint)UnsafeUtility.SizeOf <TP1>(), Ptr = UnsafeUtility.AddressOf(ref p1) }; ProfilerUnsafeUtility.BeginSampleWithMetadata(m_Ptr, 1, &data); #endif }
public static unsafe void Begin(this ProfilerMarker marker, string metadata) { var data = new ProfilerMarkerData { Type = (byte)ProfilerMarkerDataType.String16 }; fixed(char *c = metadata) { data.Size = ((uint)metadata.Length + 1) * 2; data.Ptr = c; ProfilerUnsafeUtility.BeginSampleWithMetadata(marker.Handle, 1, &data); } }
public unsafe void Begin(TP1 p1, TP2 p2) { #if ENABLE_PROFILER var data = stackalloc ProfilerMarkerData[2]; data[0].Type = m_P1Type; data[0].Size = (uint)UnsafeUtility.SizeOf <TP1>(); data[0].Ptr = UnsafeUtility.AddressOf(ref p1); data[1].Type = m_P2Type; data[1].Size = (uint)UnsafeUtility.SizeOf <TP2>(); data[1].Ptr = UnsafeUtility.AddressOf(ref p2); ProfilerUnsafeUtility.BeginSampleWithMetadata(m_Ptr, 2, data); #endif }
public void Sample(T value) { #if ENABLE_PROFILER unsafe { var data = new ProfilerMarkerData { Type = m_Type, Size = (uint)UnsafeUtility.SizeOf <T>(), Ptr = UnsafeUtility.AddressOf(ref value) }; ProfilerUnsafeUtility.SingleSampleWithMetadata(m_Ptr, 1, &data); } #endif }
private static void CreateInternal(ref DisposeSentinel sentinel, int callSiteStackDepth) { NativeLeakDetectionMode mode = NativeLeakDetection.Mode; bool flag = mode == NativeLeakDetectionMode.Disabled; if (!flag) { ProfilerUnsafeUtility.BeginSample(DisposeSentinel.s_CreateProfilerMarkerPtr); StackTrace stackTrace = null; bool flag2 = mode == NativeLeakDetectionMode.EnabledWithStackTrace; if (flag2) { stackTrace = new StackTrace(callSiteStackDepth + 2, true); } sentinel = new DisposeSentinel { m_StackTrace = stackTrace, m_IsCreated = 1 }; ProfilerUnsafeUtility.EndSample(DisposeSentinel.s_CreateProfilerMarkerPtr); } }
public AutoScope Auto(string value) { if (value == null) { throw new ArgumentNullException(nameof(value)); } unsafe { fixed(char *charPointer = value) { ProfilerMarkerData data = new ProfilerMarkerData { Type = (byte)ProfilerMarkerDataType.String16, Size = (uint)value.Length * 2 + 2 }; data.Ptr = charPointer; ProfilerUnsafeUtility.BeginSampleWithMetadata(_marker, 1, &data); } } return(new AutoScope(_marker)); }
protected override void Finalize() { try { bool flag = this.m_IsCreated != 0; if (flag) { string filename = ""; int linenumber = 0; ProfilerUnsafeUtility.BeginSample(DisposeSentinel.s_LogErrorProfilerMarkerPtr); bool flag2 = this.m_StackTrace != null; if (flag2) { string str = StackTraceUtility.ExtractFormattedStackTrace(this.m_StackTrace); string msg = "A Native Collection has not been disposed, resulting in a memory leak. Allocated from:\n" + str; bool flag3 = this.m_StackTrace.FrameCount != 0; if (flag3) { filename = this.m_StackTrace.GetFrame(0).GetFileName(); linenumber = this.m_StackTrace.GetFrame(0).GetFileLineNumber(); } UnsafeUtility.LogError(msg, filename, linenumber); } else { string msg2 = "A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details."; UnsafeUtility.LogError(msg2, filename, linenumber); } ProfilerUnsafeUtility.EndSample(DisposeSentinel.s_LogErrorProfilerMarkerPtr); } } finally { base.Finalize(); } }
internal void GetName(ref string name) { name = ProfilerUnsafeUtility.Internal_GetName(this.m_Ptr); }
public void End() { ProfilerUnsafeUtility.EndSample(this.m_Ptr); }
public void Begin(UnityEngine.Object contextUnityObject) { ProfilerUnsafeUtility.Internal_BeginWithObject(this.m_Ptr, contextUnityObject); }
public void Begin() { ProfilerUnsafeUtility.BeginSample(this.m_Ptr); }
public unsafe ProfilerMarker(ProfilerCategory category, char *name, int nameLen) { this.m_Ptr = ProfilerUnsafeUtility.CreateMarker(name, nameLen, category, MarkerFlags.Default, 0); }
internal AutoScope(IntPtr markerPtr) { this.m_Ptr = markerPtr; ProfilerUnsafeUtility.BeginSample(markerPtr); }
public ProfilerMarker(ProfilerCategory category, string name, MarkerFlags flags) { m_Ptr = ProfilerUnsafeUtility.CreateMarker(name, category, flags, 0); }
public void End() { #if ENABLE_PROFILER ProfilerUnsafeUtility.EndSample(m_Ptr); #endif }
public unsafe ProfilerMarker(ProfilerCategory category, char *name, int nameLen, MarkerFlags flags) { m_Ptr = ProfilerUnsafeUtility.CreateMarker(name, nameLen, category, flags, 0); }
public ProfilerMarker(string name) { this.m_Ptr = ProfilerUnsafeUtility.CreateMarker(name, 1, MarkerFlags.Default, 0); }
public ProfilerMarker(ProfilerCategory category, string name) { this.m_Ptr = ProfilerUnsafeUtility.CreateMarker(name, category, MarkerFlags.Default, 0); }
public static unsafe void EndSample() { #if ENABLE_PROFILER ProfilerUnsafeUtility.EndSample(ProfilerProtocolThread.Stream.markerStack.PopMarker()); #endif }
public void Begin(Object contextUnityObject) { ProfilerUnsafeUtility.Internal_BeginWithObject(m_Ptr, contextUnityObject); }