Class RTTHeader

  • All Implemented Interfaces:
    Constructable<Header>, SizeStreamable, Streamable

    public class RTTHeader
    extends Header
    Header to measure round-trip times (in nanoseconds) for sync RPCs (https://issues.redhat.com/browse/JGRP-2604)
    Since:
    5.2.1
    Author:
    Bela Ban
    • Constructor Summary

      Constructors 
      Constructor Description
      RTTHeader()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.function.Supplier<? extends Header> create()
      Creates an instance of the class implementing this interface
      RTTHeader deserialize​(long nanos)
      Sets either deserialize_req or deserialize_rsp; same logic as serialize(long).
      long downRequest()
      Time to send a request down, from sending until just before serialization
      short getMagicId()
      Returns the magic-ID.
      long networkRequest()
      The time the request has spent on the network, between serializing it at the caller and de-serializing it at the receiver
      long networkResponse()
      The time a response has spent on the network, between serializing the response and de-serializing it
      protected static java.lang.String print​(long r)  
      long processingTime()
      Time between reception of a message and sending of a response (= time spent in application code)
      void readFrom​(java.io.DataInput in)
      Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
      RTTHeader receiveReq​(long nanos)  
      RTTHeader rspDispatched​(long nanos)  
      RTTHeader sendReq​(long nanos)  
      RTTHeader sendRsp​(long nanos)  
      RTTHeader serialize​(long nanos)
      Since we don't know whether we're serializing a request or a response, the following happens: since the request is serialized _before_ the response, we check if serialize_req is 0: if so we set it, otherwise we set serialize_rsp instead.
      int serializedSize()
      Returns the size (in bytes) of the marshalled object
      java.lang.String toString()  
      long totalTime()
      The total time for a round-trip
      long upReq()
      The time after deserializing a request until before it is dispatched to the application
      long upRsp()
      The time between deserialization of a response and after dispatching to the application
      void writeTo​(java.io.DataOutput out)
      Write the entire state of the current object (including superclasses) to outstream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • send_req

        protected long send_req
      • serialize_req

        protected long serialize_req
      • deserialize_req

        protected long deserialize_req
      • receive_req

        protected long receive_req
      • send_rsp

        protected long send_rsp
      • serialize_rsp

        protected long serialize_rsp
      • deserialize_rsp

        protected long deserialize_rsp
      • rsp_dispatched

        protected long rsp_dispatched
    • Constructor Detail

      • RTTHeader

        public RTTHeader()
    • Method Detail

      • create

        public java.util.function.Supplier<? extends Header> create()
        Description copied from interface: Constructable
        Creates an instance of the class implementing this interface
      • getMagicId

        public short getMagicId()
        Description copied from class: Header
        Returns the magic-ID. If defined in jg-magic-map.xml, the IDs need to be the same
        Specified by:
        getMagicId in class Header
      • sendReq

        public RTTHeader sendReq​(long nanos)
      • serialize

        public RTTHeader serialize​(long nanos)
        Since we don't know whether we're serializing a request or a response, the following happens: since the request is serialized _before_ the response, we check if serialize_req is 0: if so we set it, otherwise we set serialize_rsp instead.
      • receiveReq

        public RTTHeader receiveReq​(long nanos)
      • sendRsp

        public RTTHeader sendRsp​(long nanos)
      • rspDispatched

        public RTTHeader rspDispatched​(long nanos)
      • totalTime

        public long totalTime()
        The total time for a round-trip
      • downRequest

        public long downRequest()
        Time to send a request down, from sending until just before serialization
      • networkRequest

        public long networkRequest()
        The time the request has spent on the network, between serializing it at the caller and de-serializing it at the receiver
      • upReq

        public long upReq()
        The time after deserializing a request until before it is dispatched to the application
      • upRsp

        public long upRsp()
        The time between deserialization of a response and after dispatching to the application
      • processingTime

        public long processingTime()
        Time between reception of a message and sending of a response (= time spent in application code)
      • networkResponse

        public long networkResponse()
        The time a response has spent on the network, between serializing the response and de-serializing it
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Header
      • serializedSize

        public int serializedSize()
        Description copied from interface: SizeStreamable
        Returns the size (in bytes) of the marshalled object
      • writeTo

        public void writeTo​(java.io.DataOutput out)
                     throws java.io.IOException
        Description copied from interface: Streamable
        Write the entire state of the current object (including superclasses) to outstream. Note that the output stream must not be closed
        Throws:
        java.io.IOException
      • readFrom

        public void readFrom​(java.io.DataInput in)
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
        Description copied from interface: Streamable
        Read the state of the current object (including superclasses) from instream Note that the input stream must not be closed
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • print

        protected static java.lang.String print​(long r)