示例#1
0
        public static Counter Allocate(Aeron.Aeron aeron, UnsafeBuffer tempBuffer, long recordingId,
                                       int sessionId, int streamId, string strippedChannel, string sourceIdentity)
        {
            tempBuffer.PutLong(RECORDING_ID_OFFSET, recordingId);
            tempBuffer.PutInt(SESSION_ID_OFFSET, sessionId);

            var sourceIdentityLength = Math.Min(sourceIdentity.Length, CountersReader.MAX_KEY_LENGTH - SOURCE_IDENTITY_OFFSET);

            tempBuffer.PutStringAscii(SOURCE_IDENTITY_LENGTH_OFFSET, sourceIdentity);
            var keyLength = SOURCE_IDENTITY_OFFSET + sourceIdentityLength;

            int labelLength = 0;

            labelLength += tempBuffer.PutStringWithoutLengthAscii(keyLength, NAME + ": ");
            labelLength += tempBuffer.PutLongAscii(keyLength + labelLength, recordingId);
            labelLength += tempBuffer.PutStringWithoutLengthAscii(keyLength + labelLength, " ");
            labelLength += tempBuffer.PutIntAscii(keyLength + labelLength, sessionId);
            labelLength += tempBuffer.PutStringWithoutLengthAscii(keyLength + labelLength, " ");
            labelLength += tempBuffer.PutIntAscii(keyLength + labelLength, streamId);
            labelLength += tempBuffer.PutStringWithoutLengthAscii(keyLength + labelLength, " ");
            labelLength += tempBuffer.PutStringWithoutLengthAscii(
                keyLength + labelLength, strippedChannel, 0, CountersReader.MAX_LABEL_LENGTH - labelLength);

            return(aeron.AddCounter(
                       RECORDING_POSITION_TYPE_ID, tempBuffer, 0, keyLength, tempBuffer, keyLength, labelLength));
        }
示例#2
0
        public static Counter Allocate(Aeron.Aeron aeron, UnsafeBuffer tempBuffer, long recordingId,
                                       long controlSessionId,
                                       long correlationId, int sessionId, int streamId, string strippedChannel)
        {
            tempBuffer.PutLong(RECORDING_ID_OFFSET, recordingId);
            tempBuffer.PutLong(CONTROL_SESSION_ID_OFFSET, controlSessionId);
            tempBuffer.PutLong(CORRELATION_ID_OFFSET, correlationId);
            tempBuffer.PutInt(SESSION_ID_OFFSET, sessionId);
            tempBuffer.PutInt(STREAM_ID_OFFSET, streamId);

            int labelLength = 0;

            labelLength += tempBuffer.PutStringWithoutLengthAscii(KEY_LENGTH, NAME + ": ");
            labelLength += tempBuffer.PutLongAscii(KEY_LENGTH + labelLength, recordingId);
            labelLength += tempBuffer.PutStringWithoutLengthAscii(KEY_LENGTH + labelLength, " ");
            labelLength += tempBuffer.PutIntAscii(KEY_LENGTH + labelLength, sessionId);
            labelLength += tempBuffer.PutStringWithoutLengthAscii(KEY_LENGTH + labelLength, " ");
            labelLength += tempBuffer.PutIntAscii(KEY_LENGTH + labelLength, streamId);
            labelLength += tempBuffer.PutStringWithoutLengthAscii(KEY_LENGTH + labelLength, " ");
            labelLength += tempBuffer.PutStringWithoutLengthAscii(KEY_LENGTH + labelLength, strippedChannel, 0,
                                                                  CountersReader.MAX_LABEL_LENGTH - labelLength);

            return(aeron.AddCounter(RECORDING_POSITION_TYPE_ID, tempBuffer, 0, KEY_LENGTH, tempBuffer, KEY_LENGTH,
                                    labelLength));
        }