Split script profiler into a separate file

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1201 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-09-03 20:55:48 +00:00
parent d0e83dd277
commit f405b82ce2
8 changed files with 265 additions and 120 deletions
+9
View File
@@ -10,6 +10,7 @@
#include <script/script_manager.hpp>
#include <script/to_value.hpp>
#include <script/functions/functions.hpp>
#include <script/profiler.hpp>
#include <data/set.hpp>
#include <data/stylesheet.hpp>
#include <data/game.hpp>
@@ -294,6 +295,10 @@ void SetScriptManager::updateAll() {
Context& ctx = getContext(set.stylesheet);
FOR_EACH(v, set.data) {
try {
#if USE_SCRIPT_PROFILING
Timer t;
Profiler prof(t, v->fieldP.get(), _("update set.") + v->fieldP->name);
#endif
v->update(ctx);
} catch (const ScriptError& e) {
handle_error(ScriptError(e.what() + _("\n while updating set value '") + v->fieldP->name + _("'")), false, true);
@@ -304,6 +309,10 @@ void SetScriptManager::updateAll() {
Context& ctx = getContext(card);
FOR_EACH(v, card->data) {
try {
#if USE_SCRIPT_PROFILING
Timer t;
Profiler prof(t, v->fieldP.get(), _("update card.") + v->fieldP->name);
#endif
v->update(ctx);
} catch (const ScriptError& e) {
handle_error(ScriptError(e.what() + _("\n while updating card value '") + v->fieldP->name + _("'")), false, true);