Exemple #1
0
        internal unsafe void EmitBlockBegin(ProfilerMessageType type, int byteSize)
        {
            // message type and 0 padded 32 bit alignment are part of block size
            byteSize         += 4;
            blockSizeExpected = byteSize;

            // Block end data will start with a 32 bit value which must be aligned, so consider that when
            // expressing size of the block data
            while ((byteSize & 3) != 0)
            {
                byteSize++;
            }
            buffer->WriteData <uint>(kPacketBlockHeader);
            buffer->WriteData <uint>(blockIndex);
            buffer->WriteData <ulong>(threadId);
            buffer->WriteData <int>(byteSize);
            blockSizeStart = buffer->DataToSendBytes;
            buffer->WriteData <uint>((uint)type);
        }
Exemple #2
0
        internal unsafe void EmitSample(ProfilerMessageType type, uint markerId, ulong sysTicks, byte metadataCount = 0)
        {
            int bytesData = 16;

            if (metadataCount > 0)
            {
                bytesData += 4;
            }

            EmitBlockBegin(type, bytesData);

            buffer->WriteData <uint>(0);  // flag (1 for mono sample)
            buffer->WriteData <uint>(markerId);
            buffer->WriteData <ulong>(sysTicks);
            if (metadataCount > 0)
            {
                buffer->WriteData <uint>(metadataCount);
            }

            EmitBlockEnd();
        }