Displaying time values in the profiler

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9224 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
funto66 2011-07-10 10:21:20 +00:00
parent 1958073778
commit 6b0e202d2b
2 changed files with 7 additions and 4 deletions

View File

@ -1233,9 +1233,9 @@ void IrrDriver::update(float dt)
if(kart->getCamera())
{
{
char marker_name[100];
sprintf(marker_name, "drawAll() for kart %d", i);
PROFILER_PUSH_CPU_MARKER(marker_name, (i+1)*60, 0x00, 0x00);
std::ostringstream oss;
oss << "drawAll() for kart " << i << std::flush;
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (i+1)*60, 0x00, 0x00);
}
kart->getCamera()->activate();

View File

@ -22,6 +22,7 @@
#include "guiengine/scalable_font.hpp"
#include <assert.h>
#include <stack>
#include <sstream>
Profiler profiler;
@ -257,7 +258,9 @@ void Profiler::draw()
while(!hovered_markers.empty())
{
Marker& m = hovered_markers.top();
text += std::string(m.name + "\n").c_str();
std::ostringstream oss;
oss << m.name << " [" << (m.end-m.start) << " ms]" << std::endl;
text += oss.str().c_str();
hovered_markers.pop();
}
font->draw(text, MARKERS_NAMES_POS, video::SColor(0xFF, 0xFF, 0x00, 0x00));