diff --git a/src/helma/scripting/rhino/RhinoEngine.java b/src/helma/scripting/rhino/RhinoEngine.java index a5da2fd6..515eb604 100644 --- a/src/helma/scripting/rhino/RhinoEngine.java +++ b/src/helma/scripting/rhino/RhinoEngine.java @@ -216,8 +216,11 @@ public class RhinoEngine implements ScriptingEngine { try { Profiler profiler = (Profiler) Context.getCurrentContext().getDebugger(); String result = profiler.getResult(); - getResponse().debug("
" + result + ""); - System.out.println(result); + ResponseTrans res = getResponse(); + if (res != null) { + getResponse().debug("
" + result + ""); + } + app.logEvent(result); } catch (Exception x) { app.logError("Error in profiler: " + x, x); } diff --git a/src/helma/scripting/rhino/debug/Profiler.java b/src/helma/scripting/rhino/debug/Profiler.java index 33ab033a..c5e05298 100644 --- a/src/helma/scripting/rhino/debug/Profiler.java +++ b/src/helma/scripting/rhino/debug/Profiler.java @@ -46,11 +46,12 @@ public class Profiler implements Debugger { */ static String getFunctionName(DebuggableScript script) { if (script.isFunction()) { + StringBuffer b = new StringBuffer(script.getSourceName()).append(" #"); + b.append(script.getLineNumbers()[0]); if (script.getFunctionName() != null) { - return script.getSourceName() + ": " + script.getFunctionName(); - } else { - return script.getSourceName() + ": #" + script.getLineNumbers()[0]; + b.append(": ").append(script.getFunctionName()); } + return b.toString(); } else { return script.getSourceName(); } @@ -96,9 +97,7 @@ public class Profiler implements Debugger { * Called when thrown exception is handled by the function or script. */ public void onExceptionThrown(Context cx, Throwable ex) { - invocations ++; - Long time = (Long) timer.pop(); - runtime += System.nanoTime() - time.longValue(); + // TODO: figure out if this is called in addition or in place of to onExit } /**