LCOV - code coverage report
Current view: top level - eq - statisticSampler.h (source / functions) Hit Total Coverage
Test: Equalizer Lines: 0 19 0.0 %
Date: 2016-07-30 05:04:55 Functions: 0 15 0.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2009-2013, Stefan Eilemann <eile@equalizergraphics.com>
       3             :  *                    2012, 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             : #ifndef EQ_STATISTICSAMPLER_H
      20             : #define EQ_STATISTICSAMPLER_H
      21             : 
      22             : #include <eq/configEvent.h> // member
      23             : 
      24             : namespace eq
      25             : {
      26             :     /**
      27             :      * Utility to sample an statistics event.
      28             :      *
      29             :      * Holds a ConfigEvent, which is initialized from the owner's data during
      30             :      * initialization. Subclasses implement the constructor and destructor to
      31             :      * sample the times and process the gathered statistics.
      32             :      */
      33             :     template< typename Owner > class StatisticSampler
      34             :     {
      35             :     public:
      36             :         /**
      37             :          * Construct a new statistics sampler.
      38             :          *
      39             :          * @param type The statistics type.
      40             :          * @param owner The originator of the statistics event.
      41             :          * @param frameNumber The current frame.
      42             :          * @version 1.0
      43             :          */
      44           0 :         StatisticSampler( const Statistic::Type type, Owner* owner,
      45             :                           const uint32_t frameNumber = LB_UNDEFINED_UINT32 )
      46           0 :             : _owner( owner )
      47             :         {
      48           0 :             LBASSERT( owner );
      49           0 :             LBASSERT( owner->getID() != 0 );
      50           0 :             LBASSERT( owner->getSerial() != CO_INSTANCE_INVALID );
      51           0 :             event.data.type                  = Event::STATISTIC;
      52           0 :             event.data.serial                = owner->getSerial();
      53           0 :             event.data.originator            = owner->getID();
      54           0 :             event.data.statistic.type        = type;
      55           0 :             event.data.statistic.frameNumber = frameNumber;
      56           0 :             event.data.statistic.resourceName[0] = '\0';
      57           0 :             event.data.statistic.startTime   = 0;
      58           0 :             event.data.statistic.endTime     = 0;
      59             : 
      60           0 :             if( event.data.statistic.frameNumber == LB_UNDEFINED_UINT32 )
      61           0 :                 event.data.statistic.frameNumber = owner->getCurrentFrame();
      62           0 :         }
      63             : 
      64             :         /** Destruct and finish statistics sampling. @version 1.0 */
      65           0 :         virtual ~StatisticSampler()
      66             :         {
      67           0 :             LBASSERTINFO( event.data.statistic.startTime <=
      68             :                           event.data.statistic.endTime, event.data.statistic );
      69           0 :         }
      70             : 
      71             :         ConfigEvent event; //!< The statistics event.
      72             : 
      73             :     protected:
      74             :         Owner* const _owner;
      75             :     };
      76             : 
      77             : }
      78             : 
      79             : #endif // EQ_STATISTICSAMPLER_H

Generated by: LCOV version 1.11