示例#1
0
    static double GetRecorderFrameAverage(ProfilerRecorder recorder)
    {
        var samplesCount = recorder.Capacity;

        if (samplesCount == 0)
        {
            return(0);
        }

        double r = 0;

        //unsafe
        {
            var samples = new List <ProfilerRecorderSample>();
            recorder.CopyTo(samples);

            for (var i = 0; i < samples.Count; ++i)
            {
                r += samples[i].Value;
            }
            r /= samples.Count;
        }

        return(r);
    }
    static double GetRecorderFrameAverage(ProfilerRecorder recorder)
    {
        var samplesCount = recorder.Capacity;

        if (samplesCount == 0)
        {
            return(0);
        }

        double r = 0;

        unsafe
        {
            var samples = stackalloc ProfilerRecorderSample[samplesCount];
            recorder.CopyTo(samples, samplesCount);
            for (var i = 0; i < samplesCount; ++i)
            {
                r += samples[i].Value;
            }
            r /= samplesCount;
        }

        r *= (1e-6f);
        return(r);
    }
示例#3
0
        private void OnEnable()
        {
            PlayerConnection.instance.Register(UnityProfilerLiteKun.kMsgSendEditorToPlayer, OnMessageEvent);
#if UNITY_2020_2_OR_NEWER
            mSystemMemoryRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "System Used Memory");
            mGcMemoryRecorder     = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "GC Reserved Memory");

            mAudioClipCountRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "AudioClip Count");

            mDynamicBathcedDrawCallsCountRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Dynamic Batched Draw Calls Count");
            mDynamicBatchesCountRecorder          = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Dynamic Batches Count");

            mStaticBatchedDrawCallsCountRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Static Batched Draw Calls Count");
            mStaticBatchesCountRecorder          = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Static Batches Count");

            mInstancedBatchedDrawCallsCountRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Instanced Batched Draw Calls Count");
            mInstancedBatchesCountRecorder          = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Instanced Batches Count");

            mDrawCallsCountRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Draw Calls Count");
            mBatchesCountRecorder   = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Batches Count");

            mTrianglesCountRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Triangles Count");
            mVerticesCountRecorder  = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Vertices Count");

            mSetPassCallsCountRecorder         = ProfilerRecorder.StartNew(ProfilerCategory.Render, "SetPass Calls Count");
            mShadowCastersCountRecorder        = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Shadow Casters Count");
            mVisibleSkinnedMeshesCountRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Visible Skinned Meshes Count");
#endif
        }
示例#4
0
 void OnEnable()
 {
     meshMemoryRecorder     = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "Mesh Memory");
     textureMemoryRecorder  = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "Texture Memory");
     mainThreadTimeRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "Main Thread", 30);
     VerticesRecorder       = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Vertices Count");
 }
示例#5
0
        private void OnEnable()
        {
            timer = Time.unscaledTime;

            mainThreadRecorder       = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "Main Thread", 15);
            totalMemoryUsedRecorder  = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "Total Used Memory");
            gcReservedMemoryRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "GC Reserved Memory");
            totalDrawCallsRecorder   = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Draw Calls Count");
        }
示例#6
0
 void OnEnable()
 {
     systemMemoryRecorder   = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "System Used Memory");
     gcMemoryRecorder       = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "GC Reserved Memory");
     vidMemoryRecorder      = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "Video Used Memory");
     mainThreadTimeRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "Main Thread", 15);
     drawCallsRecorder      = ProfilerRecorder.StartNew(ProfilerCategory.Render, "Draw Calls Count");
     updateTimer1Recorder   = ProfilerRecorder.StartNew(m_profileTimer1);
 }
示例#7
0
 /// <summary>
 /// Starts the profiler.
 /// </summary>
 public static void Begin()
 {
     managedReserved = ProfilerRecorder.StartNew(ProfilerCategory.Memory,
                                                 "GC Reserved Memory");
     managedUsed = ProfilerRecorder.StartNew(ProfilerCategory.Memory,
                                             "GC Used Memory");
     totalUsed = ProfilerRecorder.StartNew(ProfilerCategory.Memory,
                                           "Total Used Memory");
     systemUsed = ProfilerRecorder.StartNew(ProfilerCategory.Memory,
                                            "System Used Memory");
     lastManagedUsed = 0L;
     gcCount         = 0;
 }
        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);
            }
        }
示例#9
0
        private double GetRecorderFrameTimeAverage(ProfilerRecorder recorder)
        {
            int samplesCount = recorder.Capacity;

            if (samplesCount == 0)
            {
                return(0);
            }

            List <ProfilerRecorderSample> samples = new List <ProfilerRecorderSample>(samplesCount);

            recorder.CopyTo(samples);
            double r = samples.Aggregate <ProfilerRecorderSample, double>(0, (current, sample) => current + sample.Value);

            r /= samplesCount;

            return(r);
        }
示例#10
0
 private void OnEnable()
 {
     systemMemoryRec = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "System Used Memory");
     MainThreadRec   = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "Main Thread", 15);
     GPUThreadRec    = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "GPU ms");
 }
示例#11
0
 void OnEnable()
 {
     totalMemoryRecorder         = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "Total Used Memory");
     totalReservedMemoryRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "Total Reserved Memory");
     mainThreadTimeRecorder      = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "Main Thread", 30);
 }
示例#12
0
 void OnEnable()
 {
     _systemMemoryRecorder   = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "System Used Memory");
     _gcMemoryRecorder       = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "GC Reserved Memory");
     _mainThreadTimeRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Internal, "Main Thread", 15);
 }
 public MemoryProfiler()
 {
     TotalMemoryRecorder = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "Total Used Memory", 1, ProfilerRecorderOptions.Default | ProfilerRecorderOptions.StartImmediately);
     GCMemoryRecorder    = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "GC Used Memory", 1, ProfilerRecorderOptions.Default | ProfilerRecorderOptions.StartImmediately);
     GCAllocRecorder     = ProfilerRecorder.StartNew(ProfilerCategory.Memory, "GC Allocated In Frame", 1, ProfilerRecorderOptions.Default | ProfilerRecorderOptions.StartImmediately);
 }