Esempio n. 1
0
        // Threadsafe - must be only message in the block
        static public unsafe void SendNewFrame()
        {
            if (!PlayerConnectionProfiler.Enabled)
            {
                return;
            }

            // This needs to happen with the main thread id (not the session id) and be the only message in the block.
            // Note it can (and should) also be sent from other threads - the above comment only refers to main thread vs. session "thread",
            // which is the context of the method call we are in.
            streamSession.profiledFrame++;
            ProfilerProtocolThread.SendNewFrame();
        }
Esempio n. 2
0
        public static unsafe void Initialize()
        {
            if (initialized)
            {
                return;
            }
            PlayerConnectionProfiler.Initialize();
            ProfilerProtocolSession.Initialize();
            ProfilerProtocolThread.Initialize();

            ThreadSetInfo((ulong)Baselib_Thread_GetCurrentThreadId(), GetProfilerTime(), false, "", "Main Thread");

            initialized = true;
        }
Esempio n. 3
0
        public static unsafe void Shutdown()
        {
            if (!initialized)
            {
                return;
            }

            FastHashTableBufferNode *node = markerHashTableHead;

            while (node != null)
            {
                var prevNode = node;
                node = node->next;
                UnsafeUtility.Free(prevNode, Allocator.Persistent);
                ProfilerStats.AccumStats.memReservedProfiler.Accumulate(-k_HashChunkSize);
                ProfilerStats.AccumStats.memUsedProfiler.Accumulate(-k_HashChunkSize);
            }
            markerHashTableHead = null;
            markerHashTableTail = null;
            node = threadHashTableHead;
            while (node != null)
            {
                var prevNode = node;
                node = node->next;
                UnsafeUtility.Free(prevNode, Allocator.Persistent);
                ProfilerStats.AccumStats.memReservedProfiler.Accumulate(-k_HashChunkSize);
                ProfilerStats.AccumStats.memUsedProfiler.Accumulate(-k_HashChunkSize);
            }
            threadHashTableHead = null;
            threadHashTableTail = null;

            nextMarkerId = 0;
            NeedsUpdate  = false;

            ProfilerProtocolThread.Shutdown();
            PlayerConnectionProfiler.Shutdown();
            initialized = false;
        }
Esempio n. 4
0
        // Burst/Thread safe
        internal static unsafe void MarkerEnd(void *markerPtr)
        {
            MarkerBucketNode *marker = (MarkerBucketNode *)markerPtr;

            ProfilerProtocolThread.SendEndSample(marker->markerId, GetProfilerTime());
        }
Esempio n. 5
0
        // Burst/Thread safe
        internal static unsafe void MarkerBegin(void *markerPtr, void *metadata, int metadataBytes)
        {
            MarkerBucketNode *marker = (MarkerBucketNode *)markerPtr;

            ProfilerProtocolThread.SendBeginSample(marker->markerId, GetProfilerTime());
        }