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

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

Generated by: LCOV version 1.10