diff options
| author | Jules Blok <jules.blok@gmail.com> | 2015-06-10 00:00:12 +0200 |
|---|---|---|
| committer | Jules Blok <jules.blok@gmail.com> | 2015-06-10 00:00:12 +0200 |
| commit | 7dfced21a2e5aac7195e0e1ad76468e30306766b (patch) | |
| tree | bd671b639d3d911460b767caabad8fc8a759a6bf /Source/Core/VideoCommon/Statistics.cpp | |
| parent | c25be031fc1031d795157d8344b87b7841145197 (diff) | |
| parent | 7b0a65e295c784f9d573f2ef52d4e2a7b9bb2889 (diff) | |
Merge branch 'master' into stable
Diffstat (limited to 'Source/Core/VideoCommon/Statistics.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Statistics.cpp | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/Statistics.cpp b/Source/Core/VideoCommon/Statistics.cpp new file mode 100644 index 0000000000..04164cdaed --- /dev/null +++ b/Source/Core/VideoCommon/Statistics.cpp @@ -0,0 +1,92 @@ +// Copyright 2008 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include <string> +#include <utility> + +#include "Common/StringUtil.h" +#include "VideoCommon/Statistics.h" +#include "VideoCommon/VertexLoaderManager.h" + +Statistics stats; + +void Statistics::ResetFrame() +{ + memset(&thisFrame, 0, sizeof(ThisFrame)); +} + +void Statistics::SwapDL() +{ + std::swap(stats.thisFrame.numDLPrims, stats.thisFrame.numPrims); + std::swap(stats.thisFrame.numXFLoadsInDL, stats.thisFrame.numXFLoads); + std::swap(stats.thisFrame.numCPLoadsInDL, stats.thisFrame.numCPLoads); + std::swap(stats.thisFrame.numBPLoadsInDL, stats.thisFrame.numBPLoads); +} + +std::string Statistics::ToString() +{ + std::string str; + str += StringFromFormat("Textures created: %i\n", stats.numTexturesCreated); + str += StringFromFormat("Textures uploaded: %i\n", stats.numTexturesUploaded); + str += StringFromFormat("Textures alive: %i\n", stats.numTexturesAlive); + str += StringFromFormat("pshaders created: %i\n", stats.numPixelShadersCreated); + str += StringFromFormat("pshaders alive: %i\n", stats.numPixelShadersAlive); + str += StringFromFormat("vshaders created: %i\n", stats.numVertexShadersCreated); + str += StringFromFormat("vshaders alive: %i\n", stats.numVertexShadersAlive); + str += StringFromFormat("shaders changes: %i\n", stats.thisFrame.numShaderChanges); + str += StringFromFormat("dlists called: %i\n", stats.thisFrame.numDListsCalled); + str += StringFromFormat("Primitive joins: %i\n", stats.thisFrame.numPrimitiveJoins); + str += StringFromFormat("Draw calls: %i\n", stats.thisFrame.numDrawCalls); + str += StringFromFormat("Primitives: %i\n", stats.thisFrame.numPrims); + str += StringFromFormat("Primitives (DL): %i\n", stats.thisFrame.numDLPrims); + str += StringFromFormat("XF loads: %i\n", stats.thisFrame.numXFLoads); + str += StringFromFormat("XF loads (DL): %i\n", stats.thisFrame.numXFLoadsInDL); + str += StringFromFormat("CP loads: %i\n", stats.thisFrame.numCPLoads); + str += StringFromFormat("CP loads (DL): %i\n", stats.thisFrame.numCPLoadsInDL); + str += StringFromFormat("BP loads: %i\n", stats.thisFrame.numBPLoads); + str += StringFromFormat("BP loads (DL): %i\n", stats.thisFrame.numBPLoadsInDL); + str += StringFromFormat("Vertex streamed: %i kB\n", stats.thisFrame.bytesVertexStreamed / 1024); + str += StringFromFormat("Index streamed: %i kB\n", stats.thisFrame.bytesIndexStreamed / 1024); + str += StringFromFormat("Uniform streamed: %i kB\n", stats.thisFrame.bytesUniformStreamed / 1024); + str += StringFromFormat("Vertex Loaders: %i\n", stats.numVertexLoaders); + + std::string vertex_list; + VertexLoaderManager::AppendListToString(&vertex_list); + + // TODO : at some point text1 just becomes too huge and overflows, we can't even read the added stuff + // since it gets added at the far bottom of the screen anyway (actually outside the rendering window) + // we should really reset the list instead of using substr + if (vertex_list.size() + str.size() > 8170) + vertex_list = vertex_list.substr(0, 8170 - str.size()); + + str += vertex_list; + + return str; +} + +// Is this really needed? +std::string Statistics::ToStringProj() +{ + std::string projections; + + projections += "Projection #: X for Raw 6=0 (X for Raw 6!=0)\n\n"; + projections += StringFromFormat("Projection 0: %f (%f) Raw 0: %f\n", stats.gproj_0, stats.g2proj_0, stats.proj_0); + projections += StringFromFormat("Projection 1: %f (%f)\n", stats.gproj_1, stats.g2proj_1); + projections += StringFromFormat("Projection 2: %f (%f) Raw 1: %f\n", stats.gproj_2, stats.g2proj_2, stats.proj_1); + projections += StringFromFormat("Projection 3: %f (%f)\n\n", stats.gproj_3, stats.g2proj_3); + projections += StringFromFormat("Projection 4: %f (%f)\n", stats.gproj_4, stats.g2proj_4); + projections += StringFromFormat("Projection 5: %f (%f) Raw 2: %f\n", stats.gproj_5, stats.g2proj_5, stats.proj_2); + projections += StringFromFormat("Projection 6: %f (%f) Raw 3: %f\n", stats.gproj_6, stats.g2proj_6, stats.proj_3); + projections += StringFromFormat("Projection 7: %f (%f)\n\n", stats.gproj_7, stats.g2proj_7); + projections += StringFromFormat("Projection 8: %f (%f)\n", stats.gproj_8, stats.g2proj_8); + projections += StringFromFormat("Projection 9: %f (%f)\n", stats.gproj_9, stats.g2proj_9); + projections += StringFromFormat("Projection 10: %f (%f) Raw 4: %f\n\n", stats.gproj_10, stats.g2proj_10, stats.proj_4); + projections += StringFromFormat("Projection 11: %f (%f) Raw 5: %f\n\n", stats.gproj_11, stats.g2proj_11, stats.proj_5); + projections += StringFromFormat("Projection 12: %f (%f)\n", stats.gproj_12, stats.g2proj_12); + projections += StringFromFormat("Projection 13: %f (%f)\n", stats.gproj_13, stats.g2proj_13); + projections += StringFromFormat("Projection 14: %f (%f)\n", stats.gproj_14, stats.g2proj_14); + projections += StringFromFormat("Projection 15: %f (%f)\n", stats.gproj_15, stats.g2proj_15); + + return projections; +} |
