MAK RTIspy API Documentation for HLA Evolved
lrcMsgStatsXmlBlock.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  ** Copyright (c) 2006 MaK Technologies, Inc.
00003  ** All rights reserved.
00004  *********************************************************************/
00005 /*******************************************************************************
00006  ** $RCSfile: lrcMsgStatsXmlBlock.h,v $ $Revision: 1.6 $ $State: Exp $
00007  *******************************************************************************/
00008 #ifndef DtLrcMsgStatsXmlBlock_H_
00009 #define DtLrcMsgStatsXmlBlock_H_
00010 
00011 #include <rtiMsConfig.h>
00012 #include "spyXmlBlock.h"
00013 #include "msgStatsXmlBlock.h"
00014 #include "statisticsXmlBlock.h"
00015 #include <mtl/env.h>
00016 #include "webSpyUtils.h"
00017 #include <rtiMsg.h>
00018 
00019 #include <vlutil/vlFedTarget.h>
00020 #include <vlutil/vlString.h>
00021 #include <vlutil/vlFilename.h>
00022 #include <vlutil/vlSmartPointers.h>
00023 
00024 #include <iosfwd>
00025 #include <map>
00026 
00027 // Define the XML tags used by this block
00028 DtDECLARE_SPY_XML_TAG( DtLrcMsgStatsXmlTag );
00029 DtDECLARE_SPY_XML_TAG( DtTotalSentBytesXmlTag );
00030 DtDECLARE_SPY_XML_TAG( DtTotalReadBytesXmlTag );
00031 DtDECLARE_SPY_XML_TAG( DtTotalAnonBytesXmlTag );
00032 DtDECLARE_SPY_XML_TAG( DtTotalStampedBytesXmlTag );
00033 DtDECLARE_SPY_XML_TAG( DtTotalNetworkReadTimesXmlTag );
00034 DtDECLARE_SPY_XML_TAG( DtTotalNetworkSendTimesXmlTag );
00035 
00036 
00037 class DtLrcMsgStatsXmlBlock;
00038 typedef DtBoost::shared_ptr<DtLrcMsgStatsXmlBlock> DtLrcMsgStatsXmlBlockSP;
00039 typedef DtBoost::weak_ptr<DtLrcMsgStatsXmlBlock>   DtLrcMsgStatsXmlBlockWP;
00040 
00041 // The DtLrcMsgStatsXmlBlock holds the current statistics for the messages
00042 // sent and received by a given LRC
00043 class DT_DLL_WWW DtLrcMsgStatsXmlBlock : public DtSpyXmlBlock
00044 {
00045 public:
00046    typedef std::map< DtRtiMsgKind, DtMsgStatsXmlBlockSP > MessagesByKindMap;
00047    
00048    static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent );
00049 
00050 public:
00051    DtLrcMsgStatsXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root );
00052    DtLrcMsgStatsXmlBlock( DtEnvValueSP root );
00053    virtual ~DtLrcMsgStatsXmlBlock();
00054 
00055    // Reset all values to zero
00056    virtual void reset();
00057    
00058    // Add a sent message to the tally
00059    virtual void messageSent( unsigned int fedId, DtRtiMsgKind msgKind, 
00060       unsigned int size, double sendTime );
00061 
00062    // Add a received message to the tally
00063    virtual void messageRead( unsigned int fedId, DtRtiMsgKind msgKind,
00064       unsigned int size, double recvTime );
00065 
00066    // Get a pointer to the current statistics for a specific message
00067    const DtMsgStatsXmlBlockSP msgStats( DtRtiMsgKind msgKind ) const;
00068    
00069    // Access the complete list of RTI messages
00070    inline const MessagesByKindMap& messages() const;
00071    
00072    
00073 protected:
00074 
00075    // @defgroup Totals
00076 
00077    // Total num msgs and bandwidth sent (including anon)
00078    // @ingroup Totals
00079    DtStatisticsXmlBlock<unsigned int>::BlockWP mySentBytes;
00080    
00081    // Total num msgs and bandwidth read (including anon)
00082    // @ingroup Totals
00083    DtStatisticsXmlBlock<unsigned int>::BlockWP myReadBytes;
00084 
00085    // Total num msgs and bandwidth read from anon messages (may have been sent by self)
00086    // @ingroup Totals
00087    DtStatisticsXmlBlock<unsigned int>::BlockWP myAnonBytes;
00088 
00089    // Total num msgs and bandwidth read from stamped messages (definitely sent from other feds)
00090    // @ingroup Totals
00091    DtStatisticsXmlBlock<unsigned int>::BlockWP myStampedBytes;
00092 
00093    // Total time spent in socket reads
00094    // @ingroup Totals
00095    DtStatisticsXmlBlock<double>::BlockWP myNetworkReadTimes;
00096 
00097    // Total time spent in socket sends
00098    // @ingroup Totals
00099    DtStatisticsXmlBlock<double>::BlockWP myNetworkSendTimes;
00100 
00101    MessagesByKindMap myMessages;
00102 };
00103 
00104 const DtLrcMsgStatsXmlBlock::MessagesByKindMap& DtLrcMsgStatsXmlBlock::messages() const
00105 {
00106    return myMessages;
00107 }
00108 
00109 
00110 #endif // DtLrcMsgStatsXmlBlock_H_
00111 

Document ID: Generated on Thu Jun 14 14:15:04 EDT 2012 from SVN revision 116116
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)