Example #1
0
        public static unsafe void MarkerBegin(IntPtr markerHandle, double metadata)
        {
            var data = new ProfilerMarkerData {
                Type = (byte)ProfilerMarkerDataType.Double, Size = (uint)UnsafeUtility.SizeOf <double>(), Ptr = UnsafeUtility.AddressOf(ref metadata)
            };

            ProfilerUnsafeUtility.BeginSampleWithMetadata(markerHandle, 1, &data);
        }
        public static unsafe void Begin(this ProfilerMarker marker, ulong metadata)
        {
            var data = new ProfilerMarkerData
            {
                Type = (byte)ProfilerMarkerDataType.UInt64,
                Size = (uint)UnsafeUtility.SizeOf <ulong>(),
                Ptr  = &metadata
            };

            ProfilerUnsafeUtility.BeginSampleWithMetadata(marker.Handle, 1, &data);
        }
        public unsafe void Begin(TP1 p1)
        {
#if ENABLE_PROFILER
            var data = new ProfilerMarkerData
            {
                Type = m_P1Type,
                Size = (uint)UnsafeUtility.SizeOf <TP1>(),
                Ptr  = UnsafeUtility.AddressOf(ref p1)
            };
            ProfilerUnsafeUtility.BeginSampleWithMetadata(m_Ptr, 1, &data);
#endif
        }
        public static unsafe void Begin(this ProfilerMarker marker, string metadata)
        {
            var data = new ProfilerMarkerData {
                Type = (byte)ProfilerMarkerDataType.String16
            };

            fixed(char *c = metadata)
            {
                data.Size = ((uint)metadata.Length + 1) * 2;
                data.Ptr  = c;
                ProfilerUnsafeUtility.BeginSampleWithMetadata(marker.Handle, 1, &data);
            }
        }
Example #5
0
        public unsafe void Begin(TP1 p1, TP2 p2)
        {
#if ENABLE_PROFILER
            var data = stackalloc ProfilerMarkerData[2];
            data[0].Type = m_P1Type;
            data[0].Size = (uint)UnsafeUtility.SizeOf <TP1>();
            data[0].Ptr  = UnsafeUtility.AddressOf(ref p1);
            data[1].Type = m_P2Type;
            data[1].Size = (uint)UnsafeUtility.SizeOf <TP2>();
            data[1].Ptr  = UnsafeUtility.AddressOf(ref p2);
            ProfilerUnsafeUtility.BeginSampleWithMetadata(m_Ptr, 2, data);
#endif
        }
        public AutoScope Auto(string value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }
            unsafe
            {
                fixed(char *charPointer = value)
                {
                    ProfilerMarkerData data = new ProfilerMarkerData
                    {
                        Type = (byte)ProfilerMarkerDataType.String16,
                        Size = (uint)value.Length * 2 + 2
                    };

                    data.Ptr = charPointer;
                    ProfilerUnsafeUtility.BeginSampleWithMetadata(_marker, 1, &data);
                }
            }
            return(new AutoScope(_marker));
        }