Exemple #1
0
        public unsafe PlayerConnection()
        {
#if ENABLE_PLAYERCONNECTION
            // This builder is tracked so all can be freed during application shutdown - no need to destroy manually
            buffer = MessageStreamManager.CreateStreamBuilder();
#endif
        }
        public unsafe void CheckShutdownFrees()
        {
            // (because of PlayerConnectionTestFixture.PerTestSetUp)
            MessageStreamManager.DestroyStreamBuilder(messageBuilder);

            // Kill any buffers already registered from the profiler system
            MessageStreamManager.Shutdown();

            long sizePreInit = UnsafeUtility.GetHeapSize(Collections.Allocator.Persistent);

            // Start fresh
            MessageStreamManager.Initialize();

            // The pointers returned by these 2 methods will get lost surely...
            MessageStreamManager.CreateStreamBuilder();
            MessageStreamManager.CreateStreamBuilder();
            long sizeCreate = UnsafeUtility.GetHeapSize(Collections.Allocator.Persistent);

            MessageStreamManager.Shutdown();

            long sizeShutdown = UnsafeUtility.GetHeapSize(Collections.Allocator.Persistent);

            // (because of PlayerConnectionTestFixture.PerTestTearDown)
            // (also do this prior to asserts in case of test failure so tear down doesn't fail and we miss the real issue)
            MessageStreamManager.Initialize();
            messageBuilder = MessageStreamManager.CreateStreamBuilder();

            Assert.IsTrue(sizePreInit < sizeCreate);
            Assert.IsTrue(sizePreInit == sizeShutdown);
        }
Exemple #3
0
        public void PerTestSetUp()
        {
            TempMemoryScope.EnterScope();
            Connection.Initialize();
#if ENABLE_PROFILER
            Profiler.Initialize();
#endif
            unsafe
            {
                messageBuilder = MessageStreamManager.CreateStreamBuilder();
            }
        }
Exemple #4
0
 internal ProfilerProtocolStream(ulong streamId)
 {
     threadId          = (ulong)streamId;
     blockIndex        = 0;
     blockSizeStart    = 0;
     blockSizeExpected = 0;
     profiledFrame     = 0;
     unsafe
     {
         // This builder is tracked so all can be freed during application shutdown - no need to destroy manually
         buffer = MessageStreamManager.CreateStreamBuilder();
     }
     markerStack = new MarkerStack();
 }
        internal static unsafe void ReceiveConnectMessage()
        {
            MessageStreamBuilder *messageStream = MessageStreamManager.CreateStreamBuilder();

            messageStream->WriteData(ProfilerModes.ProfileCPU);

            MessageEventArgs message = new MessageEventArgs();

            message.data = messageStream->m_BufferList->ToByteArray(0, messageStream->m_BufferList->TotalBytes);

            var callback = Connection.GetMessageEvent(EditorMessageIds.kProfilerSetMode);

            callback.Invoke(message);

            MessageStreamManager.DestroyStreamBuilder(messageStream);
        }