![]() |
MAK RTIspy API Documentation for HLA 1.3
|
00001 /********************************************************************* 00002 ** Copyright (c) 2006 MaK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: lrcApiStatsXmlBlock.h,v $ $Revision: 1.6 $ $State: Exp $ 00007 *******************************************************************************/ 00008 #ifndef DtLrcApiStatsXmlBlock_H_ 00009 #define DtLrcApiStatsXmlBlock_H_ 00010 00011 #include <rtiMsConfig.h> 00012 #include "spyXmlBlock.h" 00013 #include "apiStatsXmlBlock.h" 00014 #include "statisticsXmlBlock.h" 00015 #include <mtl/env.h> 00016 #include "webSpyUtils.h" 00017 00018 #include <vlutil/vlFedTarget.h> 00019 #include <vlutil/vlString.h> 00020 #include <vlutil/vlFilename.h> 00021 #include <vlutil/vlSmartPointers.h> 00022 00023 #include <iosfwd> 00024 #include <map> 00025 00026 // Define the XML tags used by this block 00027 DtDECLARE_SPY_XML_TAG( DtLrcApiStatsXmlTag ); 00028 DtDECLARE_SPY_XML_TAG( DtTotalRtiApiTimesXmlTag ); 00029 DtDECLARE_SPY_XML_TAG( DtTotalFedAmbCallbackTimesXmlTag ); 00030 00031 class DtLrcApiStatsXmlBlock; 00032 typedef DtBoost::shared_ptr<DtLrcApiStatsXmlBlock> DtLrcApiStatsXmlBlockSP; 00033 typedef DtBoost::weak_ptr<DtLrcApiStatsXmlBlock> DtLrcApiStatsXmlBlockWP; 00034 00035 // The DtLrcApiStatsXmlBlock holds the current statistics for the rtiAmbCalls and fedAmbCalls 00036 // known by a given LRC 00037 class DT_DLL_WWW DtLrcApiStatsXmlBlock : public DtSpyXmlBlock 00038 { 00039 public: 00040 typedef std::map< DtString, DtApiStatsXmlBlockSP > ApiCallsByNameMap; 00041 00042 static DtSpyXmlBlockSP create( DtNodeAndParentPair xmlNodeAndParent ); 00043 00044 public: 00045 DtLrcApiStatsXmlBlock( DtEnvValueSP existingNode, DtEnvValueSP root ); 00046 DtLrcApiStatsXmlBlock( DtEnvValueSP root ); 00047 virtual ~DtLrcApiStatsXmlBlock(); 00048 00049 // Reset all values to zero 00050 virtual void reset(); 00051 00052 // Add an RTI Amb. API call to the tally 00053 virtual void rtiAmbCalled( const DtString& callName, double callTime ); 00054 00055 // Add a Fed. Amb. API call to the tally 00056 virtual void fedAmbCalled( const DtString& callName, double callTime ); 00057 00058 // Get a pointer to the current statistics for a specific RTI Amb. call 00059 const DtApiStatsXmlBlockSP rtiAmbCallStats( const DtString& method ) const; 00060 00061 // Get a pointer to the current statistics for a specific Fed. Amb. callback 00062 const DtApiStatsXmlBlockSP fedAmbCallbackStats( const DtString& method ) const; 00063 00064 // Get the complete list of RTI Ambassador calls 00065 inline const ApiCallsByNameMap& rtiAmbCalls() const; 00066 00067 // Get the complete list of Fed Ambassador calls 00068 inline const ApiCallsByNameMap& fedAmbCalls() const; 00069 00070 protected: 00071 00072 // @defgroup Totals 00073 00074 // Total time spent in RTI Amb. calls 00075 // @ingroup Totals 00076 DtStatisticsXmlBlock<double>::BlockWP myRtiApiTimes; 00077 00078 // Total time spent in Fed. Amb. callbacks 00079 // @ingroup Totals 00080 DtStatisticsXmlBlock<double>::BlockWP myFedAmbCallbackTimes; 00081 00082 ApiCallsByNameMap myRtiAmbCalls; 00083 ApiCallsByNameMap myFedAmbCalls; 00084 }; 00085 00086 const DtLrcApiStatsXmlBlock::ApiCallsByNameMap& DtLrcApiStatsXmlBlock::rtiAmbCalls() const 00087 { 00088 return myRtiAmbCalls; 00089 } 00090 const DtLrcApiStatsXmlBlock::ApiCallsByNameMap& DtLrcApiStatsXmlBlock::fedAmbCalls() const 00091 { 00092 return myFedAmbCalls; 00093 } 00094 00095 00096 #endif // DtLrcApiStatsXmlBlock_H_ 00097