LCOV - code coverage report
Current view: top level - eq - configStatistics.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 14 16 87.5 %
Date: 2017-12-16 05:07:20 Functions: 4 5 80.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2008-2016, 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           3 : ConfigStatistics::ConfigStatistics(const Statistic::Type type, Config* config)
      32           3 :     : StatisticSampler<Config>(type, config, config->getCurrentFrame())
      33             : {
      34           3 :     const std::string& name = config->getName();
      35           3 :     if (name.empty())
      36           0 :         snprintf(statistic.resourceName, 32, "config");
      37             :     else
      38           3 :         snprintf(statistic.resourceName, 32, "%s", name.c_str());
      39           3 :     statistic.resourceName[31] = 0;
      40           3 :     statistic.startTime = config->getTime();
      41           3 : }
      42             : 
      43           6 : ConfigStatistics::~ConfigStatistics()
      44             : {
      45           3 :     statistic.endTime = _owner->getTime();
      46           3 :     if (statistic.endTime <= statistic.startTime)
      47           0 :         statistic.endTime = statistic.startTime + 1;
      48           3 :     _owner->sendEvent(EVENT_STATISTIC) << statistic;
      49           3 : }
      50          30 : }

Generated by: LCOV version 1.11