Packagemx.messaging.messages
Classpublic class MessagePerformanceUtils
InheritanceMessagePerformanceUtils Inheritance Object

The MessagePerformanceUtils class is used to retrieve various metrics about the sizing and timing of a message sent from a client to the server and its response message, as well as pushed messages from the server to the client.

Metrics are gathered when the following properties on the channel are set to true: <record-message-times> enables capturing of timing information, <record-message-sizes> enables capturing of sizing information. Set these parameters to true or false, where the default value is false. You can set them to different values to capture only one type of metrics. For example, the following channel definition specifies to capture message timing information, but not message sizing information:

     <channel-definition id="my-streaming-amf" 
         class="mx.messaging.channels.StreamingAMFChannel">
         <endpoint 
             url="http://{server.name}:{server.port}/{context.root}/messagebroker/streamingamf"          
             class="flex.messaging.endpoints.StreamingAMFEndpoint"/>
         <properties>
             <record-message-times>true</record-message-times>
             <record-message-sizes>false</record-message-sizes>
         </properties>
     </channel-definition>

In your client application, you use the methods and properties of this class to retrieve performance metrics about received messages.

When these metrics are enabled an instance of this class should be created from a response, acknowledgement, or message handler in the form:

var mpiutil:MessagePerformanceUtils = new MessagePerformanceUtils(event.message);
     



Public Properties
 PropertyDefined By
  clientReceiveTime : Number
[read-only] The number of milliseconds since the start of the Unix epoch, January 1, 1970, 00:00:00 GMT, to when the client received response message from the server.
MessagePerformanceUtils
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  messageSize : int
[read-only] The size of the original client message, in bytes, as measured during deserialization by the server endpoint.
MessagePerformanceUtils
  networkRTT : Number
[read-only] The duration, in milliseconds, from when a client sent a message to the server until it received a response, excluding the server processing time.
MessagePerformanceUtils
  originatingMessageSentTime : Number
[read-only] The timestamp, in milliseconds since the start of the Unix epoch on January 1, 1970, 00:00:00 GMT, to when the client that caused a push message sent its message.
MessagePerformanceUtils
  originatingMessageSize : Number
[read-only] Size, in bytes, of the message that originally caused this pushed message.
MessagePerformanceUtils
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  pushedMessageFlag : Boolean
[read-only] Contains true if the message was pushed to the client but is not a response to a message that originated on the client.
MessagePerformanceUtils
  pushOneWayTime : Number
[read-only] Time, in milliseconds, from when the server pushed the message until the client received it.
MessagePerformanceUtils
  responseMessageSize : int
[read-only] The size, in bytes, of the response message sent to the client by the server as measured during serialization at the server endpoint.
MessagePerformanceUtils
  serverAdapterExternalTime : Number
[read-only] Time, in milliseconds, spent in a module invoked from the adapter associated with the destination for this message, before either the response to the message was ready or the message had been prepared to be pushed to the receiving client.
MessagePerformanceUtils
  serverAdapterTime : Number
[read-only] Processing time, in milliseconds, of the message by the adapter associated with the destination before either the response to the message was ready or the message has been prepared to be pushed to the receiving client.
MessagePerformanceUtils
  serverNonAdapterTime : Number
[read-only] Server processing time spent outside of the adapter associated with the destination of this message.
MessagePerformanceUtils
  serverPollDelay : Number
[read-only] Time, in milliseconds, that this message sat on the server after it was ready to be pushed to this client but before it was picked up by a poll request.
MessagePerformanceUtils
  serverPrePushTime : Number
[read-only] Time, in milliseconds, between the server receiving the client message and the server beginning to push the message out to other clients.
MessagePerformanceUtils
  serverProcessingTime : Number
[read-only] Time, in milliseconds, between server receiving the client message and either the time the server responded to the received message or has the pushed message ready to be sent to a receiving client.
MessagePerformanceUtils
  serverSendTime : Number
[read-only] The number of milliseconds since the start of the Unix epoch, January 1, 1970, 00:00:00 GMT, to when the server sent a response message back to the client.
MessagePerformanceUtils
  totalPushTime : Number
[read-only] Time, in milliseconds, from when the originating client sent a message and the time that the receiving client received the pushed message.
MessagePerformanceUtils
  totalTime : Number
[read-only] Time, in milliseconds, between this client sending a message and receiving a response from the server.
MessagePerformanceUtils
Public Methods
 MethodDefined By
  
Constructor.
MessagePerformanceUtils
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
The prettyPrint() method returns a formatted String containing all non-zero and non-null properties of the class.
MessagePerformanceUtils
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Property Detail
clientReceiveTimeproperty
clientReceiveTime:Number  [read-only]

The number of milliseconds since the start of the Unix epoch, January 1, 1970, 00:00:00 GMT, to when the client received response message from the server.


Implementation
    public function get clientReceiveTime():Number
messageSizeproperty 
messageSize:int  [read-only]

The size of the original client message, in bytes, as measured during deserialization by the server endpoint.


Implementation
    public function get messageSize():int
networkRTTproperty 
networkRTT:Number  [read-only]

The duration, in milliseconds, from when a client sent a message to the server until it received a response, excluding the server processing time. This value is calculated as totalTime - serverProcessingTime.

In the case of a pushed message using an RTMP channel, this metric is meaningless because client does not initiate the pushed message; the server sends a message to the client whenever a message is available. Therefore, for RTMP pushed message this value is 0, but for RTMP acknowledge messages it contains a valid number.


Implementation
    public function get networkRTT():Number
originatingMessageSentTimeproperty 
originatingMessageSentTime:Number  [read-only]

The timestamp, in milliseconds since the start of the Unix epoch on January 1, 1970, 00:00:00 GMT, to when the client that caused a push message sent its message. Only populated in the case of a pushed message, but not for an acknowledge message.


Implementation
    public function get originatingMessageSentTime():Number
originatingMessageSizeproperty 
originatingMessageSize:Number  [read-only]

Size, in bytes, of the message that originally caused this pushed message. Only populated in the case of a pushed message, but not for an acknowledge message.


Implementation
    public function get originatingMessageSize():Number
pushedMessageFlagproperty 
pushedMessageFlag:Boolean  [read-only]

Contains true if the message was pushed to the client but is not a response to a message that originated on the client. For example, when the client polls the server for a message, pushedMessageFlag is false. When you are using a streaming channel, pushedMessageFlag is true. For an acknowledge message, pushedMessageFlag is false.


Implementation
    public function get pushedMessageFlag():Boolean
pushOneWayTimeproperty 
pushOneWayTime:Number  [read-only]

Time, in milliseconds, from when the server pushed the message until the client received it. Note that this value is only relevant if the server and receiving client have synchronized clocks. Only populated in the case of a pushed message, but not for an acknowledge message.


Implementation
    public function get pushOneWayTime():Number
responseMessageSizeproperty 
responseMessageSize:int  [read-only]

The size, in bytes, of the response message sent to the client by the server as measured during serialization at the server endpoint.


Implementation
    public function get responseMessageSize():int
serverAdapterExternalTimeproperty 
serverAdapterExternalTime:Number  [read-only]

Time, in milliseconds, spent in a module invoked from the adapter associated with the destination for this message, before either the response to the message was ready or the message had been prepared to be pushed to the receiving client. This corresponds to the time that the message was processed by the server, excluding the time it was processed by your custom code, as defined by the value in the serverAdapterTime property.


Implementation
    public function get serverAdapterExternalTime():Number
serverAdapterTimeproperty 
serverAdapterTime:Number  [read-only]

Processing time, in milliseconds, of the message by the adapter associated with the destination before either the response to the message was ready or the message has been prepared to be pushed to the receiving client. This corresponds to the time that the message was processed by your code on the server.


Implementation
    public function get serverAdapterTime():Number
serverNonAdapterTimeproperty 
serverNonAdapterTime:Number  [read-only]

Server processing time spent outside of the adapter associated with the destination of this message. Calculated as serverProcessingTime - serverAdapterTime.


Implementation
    public function get serverNonAdapterTime():Number
serverPollDelayproperty 
serverPollDelay:Number  [read-only]

Time, in milliseconds, that this message sat on the server after it was ready to be pushed to this client but before it was picked up by a poll request. For an RTMP channel, this value is always 0.


Implementation
    public function get serverPollDelay():Number
serverPrePushTimeproperty 
serverPrePushTime:Number  [read-only]

Time, in milliseconds, between the server receiving the client message and the server beginning to push the message out to other clients.


Implementation
    public function get serverPrePushTime():Number
serverProcessingTimeproperty 
serverProcessingTime:Number  [read-only]

Time, in milliseconds, between server receiving the client message and either the time the server responded to the received message or has the pushed message ready to be sent to a receiving client. For example, for an acknowledge message, this is the time from when the server receives a message from the producer and sends the acknowledge message back to the producer. For a consumer that uses polling, it is the time between the arrival of the consumer?s polling message and any message returned in response to the poll.


Implementation
    public function get serverProcessingTime():Number
serverSendTimeproperty 
serverSendTime:Number  [read-only]

The number of milliseconds since the start of the Unix epoch, January 1, 1970, 00:00:00 GMT, to when the server sent a response message back to the client.


Implementation
    public function get serverSendTime():Number
totalPushTimeproperty 
totalPushTime:Number  [read-only]

Time, in milliseconds, from when the originating client sent a message and the time that the receiving client received the pushed message. Note that this value is only relevant if the two clients have synchronized clocks. Only populated in the case of a pushed message, but not for an acknowledge message,


Implementation
    public function get totalPushTime():Number
totalTimeproperty 
totalTime:Number  [read-only]

Time, in milliseconds, between this client sending a message and receiving a response from the server. This property contains 0 for an RTMP channel.


Implementation
    public function get totalTime():Number
Constructor Detail
MessagePerformanceUtils()Constructor
public function MessagePerformanceUtils(message:Object)

Constructor. Creates an MessagePerformanceUtils instance with information from the message received by the client.

Parameters
message:Object — The message received from the server. This can be a message pushed from the server, or an acknowledge message received by the client after the client pushed a message to the server.
Method Detail
prettyPrint()method
public function prettyPrint():String

The prettyPrint() method returns a formatted String containing all non-zero and non-null properties of the class.

For example, you can use the Alert control to display the available metrics, as the following example shows:

              var mpiutil:MessagePerformanceUtils = new MessagePerformanceUtils(message);                     
              Alert.show(mpiutil.prettyPrint(), "MPI Output", Alert.NONMODAL);
         

Returns
String — String containing a summary of all available non-zero and non-null metrics.