Sort vertex loader debug statistics by number of verts loaded - now easy to identify the heaviest vertex loader in games.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2252 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2009-02-15 12:38:25 +00:00
parent a4aac9ec99
commit 232e961b6f
5 changed files with 31 additions and 8 deletions

View File

@ -24,8 +24,6 @@ namespace VertexManager
void AddVertices(int primitive, int numvertices);
void Flush(); // flushes the current buffer
// This doesn't really belong here and are not relevant for D3D - TODO, find better place to put them.
int GetRemainingSize(); // remaining space in the current buffer.
// TODO: move, rename.

View File

@ -84,7 +84,7 @@ void LOADERDECL PosMtx_Write()
void LOADERDECL TexMtx_ReadDirect_UByte()
{
s_curtexmtx[s_texmtxread] = DataReadU8()&0x3f;
s_curtexmtx[s_texmtxread] = DataReadU8() & 0x3f;
PRIM_LOG("texmtx%d: %d, ", s_texmtxread, s_curtexmtx[s_texmtxread]);
s_texmtxread++;
}
@ -700,7 +700,7 @@ void VertexLoader::SetVAT(u32 _group0, u32 _group1, u32 _group2)
m_VtxAttr.texCoord[7].Frac = vat.g2.Tex7Frac;
};
void VertexLoader::AppendToString(std::string *dest)
void VertexLoader::AppendToString(std::string *dest) const
{
dest->reserve(250);
static const char *posMode[4] = {

View File

@ -63,7 +63,8 @@ public:
void RunVertices(int vtx_attr_group, int primitive, int count);
// For debugging / profiling
void AppendToString(std::string *dest);
void AppendToString(std::string *dest) const;
int GetNumLoadedVerts() const { return m_numLoadedVertices; }
private:
enum

View File

@ -912,7 +912,7 @@ void Renderer::SwapBuffers()
}
if (g_Config.bOverlayStats) {
char st[2048];
char st[8192];
char *p = st;
if (g_Config.bShowFPS)
p+=sprintf(p, "FPS: %d\n", s_fps); // So it shows up before the stats and doesn't make anyting ugly

View File

@ -16,6 +16,8 @@
// http://code.google.com/p/dolphin-emu/
#include <map>
#include <vector>
#include <algorithm>
#include "VideoCommon.h"
#include "Statistics.h"
@ -51,11 +53,33 @@ void Shutdown()
g_VertexLoaderMap.clear();
}
namespace {
struct entry {
std::string text;
u64 num_verts;
bool operator < (const entry &other) const {
return num_verts > other.num_verts;
}
};
}
void AppendListToString(std::string *dest)
{
for (VertexLoaderMap::iterator iter = g_VertexLoaderMap.begin(); iter != g_VertexLoaderMap.end(); ++iter)
std::vector<entry> entries;
size_t total_size = 0;
for (VertexLoaderMap::const_iterator iter = g_VertexLoaderMap.begin(); iter != g_VertexLoaderMap.end(); ++iter)
{
iter->second->AppendToString(dest);
entry e;
iter->second->AppendToString(&e.text);
e.num_verts = iter->second->GetNumLoadedVerts();
entries.push_back(e);
total_size += e.text.size() + 1;
}
sort(entries.begin(), entries.end());
dest->reserve(dest->size() + total_size);
for (std::vector<entry>::const_iterator iter = entries.begin(); iter != entries.end(); ++iter) {
dest->append(iter->text);
}
}