internal AutoScope(IntPtr markerPtr)
            {
                m_Ptr = markerPtr;
#if ENABLE_PROFILER
                ProfilerUnsafeUtility.BeginSample(markerPtr);
#endif
            }
예제 #2
0
        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 void Begin()
        {
#if ENABLE_PROFILER
            // Early out as soon as possible if profiler disabled
            if (!PlayerConnectionProfiler.Enabled)
            {
                return;
            }
            ProfilerUnsafeUtility.BeginSample(m_Ptr);
#endif
        }
예제 #4
0
        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);
            }
        }
예제 #5
0
 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();
     }
 }
 public void Begin()
 {
     ProfilerUnsafeUtility.BeginSample(this.m_Ptr);
 }
 internal AutoScope(IntPtr markerPtr)
 {
     this.m_Ptr = markerPtr;
     ProfilerUnsafeUtility.BeginSample(markerPtr);
 }