00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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 ),
00059 Vector3f( 0.f, 1.0f, 0.f ),
00060 Vector3f( 0.f, .5f, 0.f ),
00061 Vector3f( 1.0f, 1.0f, 0.f ),
00062 Vector3f( 1.0f, 0.f, 0.f ),
00063 Vector3f( 1.0f, .5f, .5f ),
00064 Vector3f( 1.0f, 1.0f, 0.f ),
00065 Vector3f( 1.0f, 0.f, 1.f ),
00066 Vector3f( 1.0f, 0.f, 0.f ),
00067 Vector3f( 1.f, 1.f, 1.f ),
00068 Vector3f( 1.f, 1.f, 1.f ),
00069 Vector3f( 0.f, 0.f, 1.0f ),
00070 Vector3f( .7f, .7f, 1.f ),
00071 Vector3f( .7f, 1.f, .7f ),
00072 Vector3f( .5f, 1.0f, .5f ),
00073 Vector3f( .5f, .5f, .5f ),
00074 Vector3f( 1.0f, 0.f, 0.f )
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 }