pipeStatistics.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "pipeStatistics.h"
00019
00020 #include "config.h"
00021 #include "pipe.h"
00022 #include "global.h"
00023
00024 #ifdef WIN32_VC
00025 # define snprintf _snprintf
00026 #endif
00027
00028 namespace eq
00029 {
00030
00031 PipeStatistics::PipeStatistics( const Statistic::Type type, Pipe* pipe )
00032 : StatisticSampler< Pipe >( type, pipe, pipe->getCurrentFrame( ))
00033 {
00034 #if 0
00035 const int32_t hint = pipe->getIAttribute( Pipe::IATTR_HINT_STATISTICS );
00036 if( hint == OFF )
00037 return;
00038 #endif
00039
00040 const std::string& name = pipe->getName();
00041 if( name.empty( ))
00042 snprintf( event.data.statistic.resourceName, 32, "pipe %d",
00043 pipe->getID( ));
00044 else
00045 snprintf( event.data.statistic.resourceName, 32, "%s", name.c_str( ));
00046
00047 event.data.statistic.startTime = pipe->getConfig()->getTime();
00048 event.data.statistic.endTime = 0;
00049 }
00050
00051
00052 PipeStatistics::~PipeStatistics()
00053 {
00054 #if 0
00055 const int32_t hint = _owner->getIAttribute( Pipe::IATTR_HINT_STATISTICS);
00056 if( hint == OFF )
00057 return;
00058 #endif
00059
00060 if( event.data.statistic.frameNumber == 0 )
00061 return;
00062
00063 Config* config = _owner->getConfig();
00064 if( event.data.statistic.endTime == 0 )
00065 event.data.statistic.endTime = config->getTime();
00066 config->sendEvent( event );
00067 }
00068
00069 }