frameDataStatistics.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "frameDataStatistics.h"
00019
00020 #include "config.h"
00021 #include "global.h"
00022 #include "pipe.h"
00023 #include "frameData.h"
00024
00025 #ifdef WIN32_VC
00026 # define snprintf _snprintf
00027 #endif
00028
00029 namespace eq
00030 {
00031
00032 FrameDataStatistics::FrameDataStatistics( const Statistic::Type type,
00033 FrameData* frameData,
00034 const uint32_t frameNumber )
00035 : StatisticSampler< FrameData >( type, frameData, frameNumber )
00036 {
00037 snprintf( event.data.statistic.resourceName, 32, "frame %d",
00038 frameData->getID( ));
00039
00040 const net::Session* session = frameData->getSession();
00041 EQASSERT( session );
00042 if( !session )
00043 {
00044 event.data.statistic.frameNumber = 0;
00045 return;
00046 }
00047
00048 const Config* config = EQSAFECAST( const Config*, session );
00049 event.data.statistic.startTime = config->getTime();
00050 }
00051
00052
00053 FrameDataStatistics::~FrameDataStatistics()
00054 {
00055 if( event.data.statistic.frameNumber == 0 )
00056 return;
00057
00058 net::Session* session = _owner->getSession();
00059 EQASSERT( session );
00060 if( !session )
00061 return;
00062
00063 Config* config = EQSAFECAST( Config*, session );
00064 event.data.statistic.endTime = config->getTime();
00065 config->sendEvent( event );
00066 }
00067
00068 }