LCOV - code coverage report
Current view: top level - eq/client - configStatistics.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 14 16 87.5 %
Date: 2014-06-18 Functions: 4 5 80.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2008-2009, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *
       4             :  * This library is free software; you can redistribute it and/or modify it under
       5             :  * the terms of the GNU Lesser General Public License version 2.1 as published
       6             :  * by the Free Software Foundation.
       7             :  *
       8             :  * This library is distributed in the hope that it will be useful, but WITHOUT
       9             :  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
      10             :  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
      11             :  * details.
      12             :  *
      13             :  * You should have received a copy of the GNU Lesser General Public License
      14             :  * along with this library; if not, write to the Free Software Foundation, Inc.,
      15             :  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      16             :  */
      17             : 
      18             : #include "configStatistics.h"
      19             : 
      20             : #include "config.h"
      21             : #include "global.h"
      22             : 
      23             : #include <cstdio>
      24             : 
      25             : #ifdef _MSC_VER
      26             : #  define snprintf _snprintf
      27             : #endif
      28             : 
      29             : namespace eq
      30             : {
      31             : 
      32          13 : ConfigStatistics::ConfigStatistics( const Statistic::Type type,
      33             :                                     Config* config )
      34          13 :         : StatisticSampler< Config >( type, config, config->getCurrentFrame( ))
      35             : {
      36          13 :     const std::string& name = config->getName();
      37          13 :     if( name.empty( ))
      38           0 :         snprintf( event.data.statistic.resourceName, 32, "config" );
      39             :     else
      40          13 :         snprintf( event.data.statistic.resourceName, 32, "%s", name.c_str( ));
      41          13 :     event.data.statistic.resourceName[31] = 0;
      42          13 :     event.data.statistic.startTime = config->getTime();
      43          13 : }
      44             : 
      45             : 
      46          26 : ConfigStatistics::~ConfigStatistics()
      47             : {
      48          13 :     event.data.statistic.endTime = _owner->getTime();
      49          13 :     if( event.data.statistic.endTime <= event.data.statistic.startTime )
      50           0 :         event.data.statistic.endTime = event.data.statistic.startTime + 1;
      51          13 :     _owner->sendEvent( event );
      52          13 : }
      53             : 
      54          36 : }

Generated by: LCOV version 1.10