LCOV - code coverage report
Current view: top level - eq/client - statistic.cpp (source / functions) Hit Total Coverage
Test: lcov2.info Lines: 10 18 55.6 %
Date: 2014-06-18 Functions: 6 8 75.0 %

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

Generated by: LCOV version 1.10