示例#1
0
 void ProfilerVisualizer.OnRecorderDetached(Profiler.RecorderData label)
 {
     isDirty = true;
     if (labelIndents != null)
     {
         labelIndents.Remove(labelIndents.Count - 1);
     }
 }
示例#2
0
 void ProfilerVisualizer.OnRecorderAttached(Profiler.RecorderData newLabel)
 {
     isDirty = true;
     if (labelIndents != null)
     {
         labelIndents.Add(0);
     }
 }
示例#3
0
    void ProfilerVisualizer.OnUpdate(Profiler.ProfilerData data)
    {
        if (isDirty)
        {
            GenerateLabelLayout(data);
            isDirty = false;
        }
        if ((passedTime + updateInterval < Time.realtimeSinceStartup))
        {
            //Reset the builder, but keep the header format string
            dataBuilder.Length = header.Length;
            int lastFrameRendered = labelsRendered;
            labelsRendered = 0;
            const string dataFormat = "{0,6:F2}\t{1,4:F2}\t{2,6:F2}\n";
            for (int i = 0; i < data.recorderData.Count; i++)
            {
                if (data.recorderData[i].layout.visible)
                {
                    Profiler.RecorderData sample = data.recorderData[i];
                    dataBuilder.AppendFormat(dataFormat, sample.avgTime, sample.avgCount, sample.time);
                    ++labelsRendered;
                }
            }
            if (labelsRendered != lastFrameRendered) //We must redraw the "static" labels if one of them has been hidden since last frame
            {
                isDirty = true;
            }
            dataLayout.text = dataBuilder.ToString();
            fpsLayout.text  = String.Format("<b>{0:F2} FPS ({1:F2}ms)</b>", 1.0f / data.m_AvgDeltaTime, data.m_AvgDeltaTime * 1000.0f);
            passedTime      = Time.realtimeSinceStartup;

            long        monoTotal   = UnityEngine.Profiling.Profiler.GetMonoHeapSizeLong();
            long        monoUsed    = UnityEngine.Profiling.Profiler.GetMonoUsedSizeLong();
            long        nativeTotal = UnityEngine.Profiling.Profiler.GetTotalReservedMemoryLong();
            long        nativeUsed  = UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong();
            const float toMB        = 1f / 1000000f;
            memoryLabel.text = "Memory(Mono): " + Math.Round(monoUsed * toMB) + "MB / " + Math.Round(monoTotal * toMB) + "MB\nMemory(Native): " + Math.Round(nativeUsed * toMB) + "MB / " + Math.Round(nativeTotal * toMB) + "MB";
        }
    }
 void ProfilerVisualizer.OnRecorderDetached(Profiler.RecorderData label)
 {
     isDirty = true;
 }
 void ProfilerVisualizer.OnRecorderAttached(Profiler.RecorderData newLabel)
 {
     isDirty = true;
 }
示例#6
0
 void ProfilerVisualizer.OnRecorderDetached(Profiler.RecorderData remLabel)
 {
 }
示例#7
0
 void ProfilerVisualizer.OnRecorderAttached(Profiler.RecorderData newLabel)
 {
 }