Show statistics.cpp syntax highlighted
/***************************************************************************
statistics.cpp - Frame statistics
-------------------
begin : Wed Apr 2 2003
copyright : (C) 2003 by Reality Rift Studios
email : mattias@realityrift.com
***************************************************************************
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is the NeoEngine, NeoDevOpenGL, statistics.cpp
The Initial Developer of the Original Code is Mattias Jansson.
Portions created by Mattias Jansson are Copyright (C) 2003
Reality Rift Studios. All Rights Reserved.
***************************************************************************/
#include "statistics.h"
#include "device.h"
using namespace std;
using namespace NeoEngine;
namespace NeoOGL
{
std::string Device::GetStatistics()
{
return m_pkStats->GenerateString();
}
std::string FrameStatistics::GenerateString()
{
//FIXME: Not thread-safe
static char szStats[1024];
static string strStats;
snprintf( szStats, 1024, "Total ops : %d\nTotal polys : %d\nUnique polys : %d\nAverage passes: %.3f\n", m_uiTotalOps, m_uiTotalPolygons, m_uiUniquePolygons, float( m_uiTotalPolygons ) / float( m_uiUniquePolygons ) );
strStats = szStats;
for( unsigned int uiTMU = 0; uiTMU < m_pkDevice->m_uiNumTMUs; ++uiTMU )
{
snprintf( szStats, 1024, "TMU%d changes : %d (%d unique textures)\n", uiTMU, m_auiTextureChanges[ uiTMU ], m_vuiUniqueTextureIDs[ uiTMU ].size() );
strStats += szStats;
}
return strStats;
}
}; // namespace NeoOGL
See more files for this project here