LCOV - code coverage report
Current view: top level - eq/fabric - statistic.cpp (source / functions) Hit Total Coverage
Test: Equalizer Lines: 10 18 55.6 %
Date: 2017-12-16 05:07:20 Functions: 6 8 75.0 %

          Line data    Source code
       1             : 
       2             : /* Copyright (c) 2009-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 "statistic.h"
      19             : 
      20             : #include <string>
      21             : #include <vmmlib/vector.hpp>
      22             : 
      23             : #ifdef _WIN32
      24             : #define bzero(ptr, size) memset(ptr, 0, size);
      25             : #else
      26             : #include <strings.h>
      27             : #endif
      28             : 
      29             : namespace eq
      30             : {
      31             : namespace fabric
      32             : {
      33             : namespace
      34             : {
      35         460 : struct StatisticData
      36             : {
      37             :     const Statistic::Type type;
      38             :     const std::string name;
      39             :     const Vector3f color;
      40             : };
      41             : 
      42          40 : static StatisticData _statisticData[] = {
      43             :     {Statistic::NONE, "NO EVENT", Vector3f(0.f, 0.f, 0.f)},
      44             :     {Statistic::CHANNEL_CLEAR, "clear", Vector3f(.5f, 1.0f, .5f)},
      45             :     {Statistic::CHANNEL_DRAW, "draw", Vector3f(0.f, .9f, 0.f)},
      46             :     {Statistic::CHANNEL_DRAW_FINISH, "finish draw", Vector3f(0.f, .5f, 0.f)},
      47             :     {Statistic::CHANNEL_ASSEMBLE, "assemble", Vector3f(1.0f, 1.0f, 0.f)},
      48             :     {Statistic::CHANNEL_FRAME_WAIT_READY, "wait frame",
      49             :      Vector3f(1.0f, 0.f, 0.f)},
      50             :     {Statistic::CHANNEL_READBACK, "readback", Vector3f(1.0f, .5f, .5f)},
      51             :     {Statistic::CHANNEL_ASYNC_READBACK, "readback", Vector3f(1.0f, .5f, .5f)},
      52             :     {Statistic::CHANNEL_VIEW_FINISH, "view finish", Vector3f(1.f, 0.f, 1.0f)},
      53             :     {Statistic::CHANNEL_FRAME_TRANSMIT, "transmit", Vector3f(0.f, 0.f, 1.0f)},
      54             :     {Statistic::CHANNEL_FRAME_COMPRESS, "compress", Vector3f(0.f, .7f, 1.f)},
      55             :     {Statistic::CHANNEL_FRAME_WAIT_SENDTOKEN, "wait send token",
      56             :      Vector3f(1.f, 0.f, 0.f)},
      57             :     {Statistic::WINDOW_FINISH, "finish", Vector3f(1.0f, 1.0f, 0.f)},
      58             :     {Statistic::WINDOW_THROTTLE_FRAMERATE, "throttle",
      59             :      Vector3f(1.0f, 0.f, 1.f)},
      60             :     {Statistic::WINDOW_SWAP_BARRIER, "barrier", Vector3f(1.0f, 0.f, 0.f)},
      61             :     {Statistic::WINDOW_SWAP, "swap", Vector3f(1.f, 1.f, 1.f)},
      62             :     {Statistic::WINDOW_FPS, "FPS", Vector3f(1.f, 1.f, 1.f)},
      63             :     {Statistic::PIPE_IDLE, "pipe idle", Vector3f(1.f, 1.f, 1.f)},
      64             :     {Statistic::NODE_FRAME_DECOMPRESS, "decompress", Vector3f(0.f, .7f, 1.f)},
      65             :     {Statistic::CONFIG_START_FRAME, "start frame", Vector3f(.5f, 1.0f, .5f)},
      66             :     {Statistic::CONFIG_FINISH_FRAME, "finish frame", Vector3f(.5f, .5f, .5f)},
      67             :     {Statistic::CONFIG_WAIT_FINISH_FRAME, "wait finish",
      68             :      Vector3f(1.0f, 0.f, 0.f)},
      69          20 :     {Statistic::ALL, "ALL EVENTS", Vector3f(0.0f, 0.f, 0.f)}};
      70             : }
      71             : 
      72          26 : const std::string& Statistic::getName(const Type type)
      73             : {
      74          26 :     LBASSERTINFO(_statisticData[type].type == type, int(type));
      75          26 :     return _statisticData[type].name;
      76             : }
      77             : 
      78          26 : const Vector3f& Statistic::getColor(const Type type)
      79             : {
      80          26 :     LBASSERTINFO(_statisticData[type].type == type, type);
      81          26 :     return _statisticData[type].color;
      82             : }
      83             : 
      84           0 : std::ostream& operator<<(std::ostream& os, const Statistic::Type& type)
      85             : {
      86           0 :     os << Statistic::getName(type);
      87           0 :     return os;
      88             : }
      89             : 
      90           0 : std::ostream& operator<<(std::ostream& os, const Statistic& event)
      91             : {
      92           0 :     os << event.resourceName << ": " << event.type << ' ' << event.frameNumber
      93           0 :        << ' ' << event.task << ' ' << event.startTime << " - " << event.endTime
      94           0 :        << ' ' << event.idleTime << '/' << event.totalTime;
      95           0 :     return os;
      96             : }
      97             : }
      98          60 : }

Generated by: LCOV version 1.11