Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Stokes <mogurijin@gmail.com>2013-06-17 10:40:39 +0400
committerMitchell Stokes <mogurijin@gmail.com>2013-06-17 10:40:39 +0400
commit2a1d58c14dc8727d3bf080f45c6ab2aeb3827df8 (patch)
treec25486bb1c2744d92fe39a87664db1d9946efb43 /source/gameengine
parentc749301a3b66a440158839d38f848a17679077ab (diff)
BGE: Fixing the python profiling information so that bge.logic.getProfileInfo() returns information even if Show Framerate and Profile is not enabled.
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/KX_KetsjiEngine.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
index 3abc129521e..01b726a8e3f 100644
--- a/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
+++ b/source/gameengine/Ketsji/KX_KetsjiEngine.cpp
@@ -521,10 +521,23 @@ void KX_KetsjiEngine::EndFrame()
RenderDebugProperties();
}
- m_average_framerate = m_logger->GetAverage();
- if (m_average_framerate < 1e-6)
- m_average_framerate = 1e-6;
- m_average_framerate = 1.0/m_average_framerate;
+ double tottime = m_logger->GetAverage(), time;
+ if (tottime < 1e-6)
+ tottime = 1e-6;
+
+#ifdef WITH_PYTHON
+ for (int i = tc_first; i < tc_numCategories; ++i) {
+ time = m_logger->GetAverage((KX_TimeCategory)i);
+ PyObject *val = PyTuple_New(2);
+ PyTuple_SetItem(val, 0, PyFloat_FromDouble(time*1000.f));
+ PyTuple_SetItem(val, 1, PyFloat_FromDouble(time/tottime * 100.f));
+
+ PyDict_SetItemString(m_pyprofiledict, m_profileLabels[i], val);
+ Py_DECREF(val);
+ }
+#endif
+
+ m_average_framerate = 1.0/tottime;
// Go to next profiling measurement, time spend after this call is shown in the next frame.
m_logger->NextMeasurement(m_kxsystem->GetTimeInSeconds());
@@ -1526,15 +1539,6 @@ void KX_KetsjiEngine::RenderDebugProperties()
m_rendertools->RenderBox2D(xcoord + (int)(2.2 * profile_indent), ycoord, m_canvas->GetWidth(), m_canvas->GetHeight(), time/tottime);
ycoord += const_ysize;
-
-#ifdef WITH_PYTHON
- PyObject *val = PyTuple_New(2);
- PyTuple_SetItem(val, 0, PyFloat_FromDouble(time*1000.f));
- PyTuple_SetItem(val, 1, PyFloat_FromDouble(time/tottime * 100.f));
-
- PyDict_SetItemString(m_pyprofiledict, m_profileLabels[j], val);
- Py_DECREF(val);
-#endif
}
}
// Add the ymargin for titles below the other section of debug info