Example #1
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;
        }
Example #2
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;
        }