MAK RTIspy API Documentation for HLA 1.3
lrcStateDbXmlBlock.h
Go to the documentation of this file.
00001 /*********************************************************************
00002  ** Copyright (c) 2006 MaK Technologies, Inc.
00003  ** All rights reserved.
00004  *********************************************************************/
00005 /*******************************************************************************
00006  ** $RCSfile: lrcStateDbXmlBlock.h,v $ $Revision: 1.7 $ $State: Exp $
00007  *******************************************************************************/
00008 #ifndef DtLrcStateDatabaseXmlBlock_H_
00009 #define DtLrcStateDatabaseXmlBlock_H_
00010 
00011 #include <rtiMsConfig.h>
00012 #include <spyXmlBlock.h>
00013 #include <mtl/env.h>
00014 #include <statisticsXmlBlock.h>
00015 #include <msgStatsXmlBlock.h>
00016 #include <objIntStatsXmlBlock.h>
00017 #include <apiStatsXmlBlock.h>
00018 #include <rtiMsg.h>
00019 
00020 #include <vlutil/vlString.h>
00021 #include <vlutil/vlSmartPointers.h>
00022 #include <vlutil/vlThreadSafe.h>
00023 
00024 #include <map>
00025 
00026 
00027 // Define the XML tags used by this block
00028 DtDECLARE_SPY_XML_TAG( DtLrcStateDatabaseXmlTag );
00029                       
00030 class DtLrcStateDatabaseXmlBlock;
00031 typedef DtBoost::shared_ptr<DtLrcStateDatabaseXmlBlock> DtLrcStateDatabaseXmlBlockSP;
00032 typedef DtBoost::weak_ptr<DtLrcStateDatabaseXmlBlock>   DtLrcStateDatabaseXmlBlockWP;
00033 
00034 // The DtLrcStateDatabaseXmlBlock holds the complete statistics collected by the spy about
00035 // the lrc
00036 class DT_DLL_WWW DtLrcStateDatabaseXmlBlock : public DtSpyXmlBlock
00037 {
00038 public:
00039 
00040    // Creator method
00041    static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent );
00042 
00043 public:
00044    
00045    // Ctor to build from XML data
00046    DtLrcStateDatabaseXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root );
00047 
00048    // Ctor to build from C++ data
00049    DtLrcStateDatabaseXmlBlock( DtEnvValueSP root );
00050    virtual ~DtLrcStateDatabaseXmlBlock();
00051 
00052    // Reset all values to zero
00053    virtual void reset();
00054    
00055    // Add a sent message to the tally
00056    virtual void messageSent( unsigned int fedId, DtRtiMsgKind msgKind, 
00057       unsigned int size, double sendTime );
00058 
00059    // Add a received message to the tally
00060    virtual void messageRead( unsigned int fedId, DtRtiMsgKind msgKind,
00061       unsigned int size, double recvTime );
00062 
00063    // Add an RTI Amb. API call to the tally
00064    virtual void rtiAmbCalled( const DtString& callName, double callTime );
00065 
00066    // Add a Fed. Amb. API call to the tally
00067    virtual void fedAmbCalled( const DtString& callName, double callTime );
00068 
00069    // Add a new object (registered or discovered)
00070    virtual void addObject( bool isRegistered, unsigned int objHandle, unsigned int classHandle,
00071       const DtString& theClassName, const DtString& theObjectName );
00072 
00073    // Record statistics about an update message
00074    void recordUpdate( bool isSent, unsigned int msgSize, double time,
00075       unsigned int handle, const DtString& name );
00076    
00077    // Record statistics about an interaction message   
00078    void recordInteraction( bool isSent, unsigned int msgSize, double time,
00079       unsigned int handle, const DtString& name );
00080 
00081    // Get a pointer to the current statistics for a specific message
00082    const DtMsgStatsXmlBlockSP msgStats( DtRtiMsgKind msgKind ) const;
00083    
00084    // Get a pointer to the current statistics for a specific RTI Amb. call
00085    const DtApiStatsXmlBlockSP rtiAmbCallStats( const DtString& method ) const;
00086 
00087    // Get a pointer to the current statistics for a specific Fed. Amb. callback
00088    const DtApiStatsXmlBlockSP fedAmbCallbackStats( const DtString& method ) const;
00089    
00090    // Get a pointer to the current statistics for a specific object instance
00091    const DtObjIntStatsXmlBlockSP objectStats( unsigned int handle ) const;
00092 
00093    // Get a pointer to the current statistics for a specific interaction class
00094    const DtObjIntStatsXmlBlockSP interactionStats( unsigned int handle ) const;
00095 
00096    // Access the complete list of messages
00097    inline const std::map< DtRtiMsgKind, DtMsgStatsXmlBlockWP >& messages() const;
00098 
00099    // Access the complete list of RTI Amb. calls
00100    inline const std::map< DtString, DtApiStatsXmlBlockWP >& rtiAmbCalls() const;
00101 
00102    // Access the complete list of Fed. Amb. callbacks
00103    inline const std::map< DtString, DtApiStatsXmlBlockWP >& fedAmbCallbacks() const;
00104    
00105    // Access the complete list of RTI objects
00106    inline const std::map< unsigned int, DtObjIntStatsXmlBlockWP >& objects() const;
00107    
00108    // Access the complete list of RTI interactions
00109    inline const std::map< unsigned int, DtObjIntStatsXmlBlockWP >& interactions() const;
00110    
00111    
00112 protected:
00113 
00114    // @defgroup Totals
00115 
00116    // Total num msgs and bandwidth sent (including anon)
00117    // @ingroup Totals
00118    DtStatisticsXmlBlock<unsigned int>::BlockWP mySentBytes;
00119    
00120    // Total num msgs and bandwidth read (including anon)
00121    // @ingroup Totals
00122    DtStatisticsXmlBlock<unsigned int>::BlockWP myReadBytes;
00123 
00124    // Total num msgs and bandwidth read from anon messages (may have been sent by self)
00125    // @ingroup Totals
00126    DtStatisticsXmlBlock<unsigned int>::BlockWP myAnonBytes;
00127 
00128    // Total num msgs and bandwidth read from stamped messages (definitely sent from other feds)
00129    // @ingroup Totals
00130    DtStatisticsXmlBlock<unsigned int>::BlockWP myStampedBytes;
00131 
00132    // Total time spent in socket reads
00133    // @ingroup Totals
00134    DtStatisticsXmlBlock<double>::BlockWP myNetworkReadTimes;
00135 
00136    // Total time spent in socket sends
00137    // @ingroup Totals
00138    DtStatisticsXmlBlock<double>::BlockWP myNetworkSendTimes;
00139 
00140    // Total time spent in RTI Amb. calls
00141    // @ingroup Totals
00142    DtStatisticsXmlBlock<double>::BlockWP myRtiApiTimes;
00143 
00144    // Total time spent in Fed. Amb. callbacks
00145    // @ingroup Totals
00146    DtStatisticsXmlBlock<double>::BlockWP myFedAmbCallbackTimes;
00147 
00148    // @defgroup Individual Stats
00149 
00150    // Time spent in each individual RTI Amb. call
00151    // @ingroup Individual Stats
00152    std::map< DtString, DtApiStatsXmlBlockWP > myRtiAmbCalls;
00153 
00154    // Time spent in each individual Fed. Amb. callback
00155    // @ingroup Individual Stats
00156    std::map< DtString, DtApiStatsXmlBlockWP > myFedAmbCallbacks;
00157 
00158    // Stats on individual objects by object instance handle
00159    // @ingroup Individual Stats
00160    std::map< unsigned int, DtObjIntStatsXmlBlockWP > myObjects;
00161    
00162    // Stats on individual interactions by interaction handle
00163    // @ingroup Individual Stats
00164    std::map< unsigned int, DtObjIntStatsXmlBlockWP > myInteractions;
00165 
00166    // Stats on individual messages by message kind
00167    // @ingroup Individual Stats
00168    std::map< DtRtiMsgKind, DtMsgStatsXmlBlockWP > myMessages;
00169    
00170 
00171 };
00172 
00173 inline const std::map< DtRtiMsgKind, DtMsgStatsXmlBlockWP >& DtLrcStateDatabaseXmlBlock::messages() const
00174 {
00175    return myMessages;
00176 }
00177 
00178 inline const std::map< DtString, DtApiStatsXmlBlockWP >& DtLrcStateDatabaseXmlBlock::rtiAmbCalls() const
00179 {
00180    return myRtiAmbCalls;
00181 }
00182 
00183 inline const std::map< DtString, DtApiStatsXmlBlockWP >& DtLrcStateDatabaseXmlBlock::fedAmbCallbacks() const
00184 {
00185    return myFedAmbCallbacks;
00186 }
00187 
00188 inline const std::map< unsigned int, DtObjIntStatsXmlBlockWP >& DtLrcStateDatabaseXmlBlock::objects() const
00189 {
00190    return myObjects;
00191 }
00192    
00193 inline const std::map< unsigned int, DtObjIntStatsXmlBlockWP >& DtLrcStateDatabaseXmlBlock::interactions() const
00194 {
00195    return myInteractions;
00196 }
00197 
00198 
00199 #endif // DtLrcStateDatabaseXmlBlock_H_
00200 

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)