예제 #1
0
        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 ProfilerCounterValue(ProfilerCategory category, string name, ProfilerMarkerDataUnit dataUnit)
        {
#if ENABLE_PROFILER
            byte dataType = ProfilerUtility.GetProfilerMarkerDataType <T>();
            unsafe
            {
                m_Value = (T *)ProfilerUnsafeUtility.CreateCounterValue(out var counterPtr, name, category, MarkerFlags.Default, dataType, (byte)dataUnit, UnsafeUtility.SizeOf <T>(), ProfilerCounterOptions.FlushOnEndOfFrame);
            }
#endif
        }
        public ProfilerCounterValue(string name, ProfilerMarkerDataUnit dataUnit, ProfilerCounterOptions counterOptions)
        {
#if ENABLE_PROFILER
            byte dataType = ProfilerUtility.GetProfilerMarkerDataType <T>();
            unsafe
            {
                m_Value = (T *)ProfilerUnsafeUtility.CreateCounterValue(out var counterPtr, name, ProfilerUnsafeUtility.CategoryScripts, MarkerFlags.Default, dataType, (byte)dataUnit, UnsafeUtility.SizeOf <T>(), counterOptions);
            }
#endif
        }