statistic.cpp

00001 
00002 /* Copyright (c) 2009, Stefan Eilemann <eile@equalizergraphics.com> 
00003  *
00004  * This library is free software; you can redistribute it and/or modify it under
00005  * the terms of the GNU Lesser General Public License version 2.1 as published
00006  * by the Free Software Foundation.
00007  *  
00008  * This library is distributed in the hope that it will be useful, but WITHOUT
00009  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00010  * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00011  * details.
00012  * 
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this library; if not, write to the Free Software Foundation, Inc.,
00015  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
00016  */
00017 
00018 #include "statistic.h"
00019 
00020 #include <string>
00021 
00022 #ifdef WIN32
00023 #  define bzero( ptr, size ) memset( ptr, 0, size );
00024 #else
00025 #  include <strings.h>
00026 #endif
00027 
00028 namespace eq
00029 {
00030 namespace
00031 {
00033 static std::string _statisticNames[Statistic::ALL] =
00034 {
00035     "NO EVENT",
00036     "clear",
00037     "draw",
00038     "finish draw",
00039     "assemble",
00040     "wait frame",
00041     "readback",
00042     "finish",
00043     "throttle",
00044     "barrier",
00045     "swap",
00046     "pipe idle",
00047     "transmit",
00048     "compress",
00049     "receive",
00050     "start frame",
00051     "finish frame",
00052     "wait finish"
00053 };
00054 
00055 static Vector3f _statisticColors[Statistic::ALL] = 
00056 {
00057     Vector3f( 0.f, 0.f, 0.f ),
00058     Vector3f( .5f, 1.0f, .5f ), // clear
00059     Vector3f( 0.f, 1.0f, 0.f ), // draw
00060     Vector3f( 0.f, .5f, 0.f ), // draw finish
00061     Vector3f( 1.0f, 1.0f, 0.f ),  // assemble
00062     Vector3f( 1.0f, 0.f, 0.f ), // wait frame
00063     Vector3f( 1.0f, .5f, .5f ), // readback
00064     Vector3f( 1.0f, 1.0f, 0.f ), // finish
00065     Vector3f( 1.0f, 0.f, 1.f ), // throttle
00066     Vector3f( 1.0f, 0.f, 0.f ), // swap barrier
00067     Vector3f( 1.f, 1.f, 1.f ), // swap
00068     Vector3f( 1.f, 1.f, 1.f ), // pipe idle
00069     Vector3f( 0.f, 0.f, 1.0f ), // transmit
00070     Vector3f( .7f, .7f, 1.f ), // compress
00071     Vector3f( .7f, 1.f, .7f ), // decompress
00072     Vector3f( .5f, 1.0f, .5f ), // start frame
00073     Vector3f( .5f, .5f, .5f ), // finish frame
00074     Vector3f( 1.0f, 0.f, 0.f ) // wait finish frame
00075 };
00076 }
00077 
00078 const std::string& Statistic::getName( const Type type )
00079 {
00080     EQASSERT( sizeof( _statisticNames ) / sizeof( std::string ) == ALL );
00081 
00082     return _statisticNames[ type ];
00083 }
00084 
00085 const Vector3f& Statistic::getColor( const Type type )
00086 {
00087     EQASSERT( sizeof( _statisticColors ) / sizeof( Vector3f ) == ALL );
00088 
00089     return _statisticColors[ type ];
00090 }
00091 
00092 std::ostream& operator << ( std::ostream& os, const Statistic& event )
00093 {
00094     os << event.resourceName << ": " << Statistic::getName( event.type )
00095        << ' ' << event.frameNumber << ' ' << event.task << ' ' 
00096        << event.startTime << " - " << event.endTime;
00097     return os;
00098 }
00099 
00100 }
Generated on Mon Aug 10 18:58:41 2009 for Equalizer 0.9 by  doxygen 1.5.8