Пример #1
0
 /// <summary>
 /// Ends the profile capture
 /// </summary>
 public static void EndCapture()
 {
     if (TraceDLLAPI.EndCapture() == 0)
     {
         LogLastError("TraceProfiler::EndCapture");
     }
 }
Пример #2
0
 /// <summary>
 /// Signal the end of the event
 /// </summary>
 public void End()
 {
     if (m_ActiveCaptureId != 0 && m_ActiveCaptureId == TraceProfiler.ActiveCaptureId)
     {
         TraceDLLAPI.AddAsyncEvent(false, m_EventId, m_EventInstanceId);
     }
     m_ActiveCaptureId = 0;
 }
Пример #3
0
        /// <summary>
        /// Signal the beginning of the event
        /// </summary>
        public void Begin()
        {
            if (m_ActiveCaptureId != 0)
            {
                Debug.LogError("AsyncEvent.Begin calls cannot be nested");
            }

            if (TraceProfiler.ActiveCaptureId == 0)
            {
                Debug.LogError("Cannot begin an async event when profiling is not active");
            }

            m_ActiveCaptureId = TraceProfiler.ActiveCaptureId;

            TraceDLLAPI.AddAsyncEvent(true, m_EventId, m_EventInstanceId);
        }
Пример #4
0
        /// <summary>
        /// Begin a capturing profile data.
        /// </summary>
        /// <remarks>
        /// Captured profile data will be save to the file provided. The capture will end when you call EndCapture or when the maximum allowed memory is exceeded.
        /// </remarks>
        /// <param name="filename">Output file path. If the file path is not rooted, the path will be prepended by the player's persistent data path.</param>
        /// <param name="maxMemoryMB">Maximum amount of scratch memory that the profiler is allowed to use.</param>
        public static void BeginCapture(string filename, int maxMemoryMB = 500)
        {
            if (!IsPlatformSupported(Application.platform))
            {
                Debug.LogErrorFormat("The TraceEventProfiler does not support the current platform: {0}", Application.platform);
                return;
            }

            if (!Path.IsPathRooted(filename))
            {
                filename = Path.Combine(Application.persistentDataPath, filename);
            }

            Debug.Log("Writing Capture to " + filename);

            m_ActiveCaptureId = TraceDLLAPI.BeginCapture(filename, maxMemoryMB);
            if (m_ActiveCaptureId == 0)
            {
                LogLastError("TraceProfiler::BeginCapture");
            }
        }
Пример #5
0
 private static string GetLastError()
 {
     byte[] errorData = new byte[4096];
     TraceDLLAPI.GetLastProfilerError(errorData, errorData.Length);
     return(System.Text.Encoding.ASCII.GetString(errorData));
 }
Пример #6
0
 /// <param name="asyncEventName">The label that will show up in the profile capture</param>
 public AsyncEvent(string asyncEventName)
 {
     m_EventId         = TraceDLLAPI.RegisterAsyncEvent(asyncEventName);
     m_EventInstanceId = TraceDLLAPI.AcquireUniqueAsyncId();
     m_ActiveCaptureId = 0;
 }