Some obvious profiler fixes
This commit is contained in:
parent
7483b7a8ad
commit
3cef3759a8
2 changed files with 10 additions and 8 deletions
|
@ -216,8 +216,11 @@ public class RhinoEngine implements ScriptingEngine {
|
|||
try {
|
||||
Profiler profiler = (Profiler) Context.getCurrentContext().getDebugger();
|
||||
String result = profiler.getResult();
|
||||
getResponse().debug("<pre>" + result + "</pre>");
|
||||
System.out.println(result);
|
||||
ResponseTrans res = getResponse();
|
||||
if (res != null) {
|
||||
getResponse().debug("<pre>" + result + "</pre>");
|
||||
}
|
||||
app.logEvent(result);
|
||||
} catch (Exception x) {
|
||||
app.logError("Error in profiler: " + x, x);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue