r9971 - in helma/helma/trunk/src/helma/scripting/rhino: . debug
[email protected] Mon, 28 Sep 2009 14:55:24 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090928125524.70FC43D0E2@mia> |
Author: hannes
Date: 2009-09-28 14:55:24 +0200 (Mon, 28 Sep 2009)
New Revision: 9971
Modified:
helma/helma/trunk/src/helma/scripting/rhino/RhinoEngine.java
helma/helma/trunk/src/helma/scripting/rhino/debug/Profiler.java
Log:
Some obvious profiler fixes
Details at http://dev.helma.org/trac/helma/changeset/9971
Modified: helma/helma/trunk/src/helma/scripting/rhino/RhinoEngine.java
===================================================================
--- helma/helma/trunk/src/helma/scripting/rhino/RhinoEngine.java 2009-09-28 12:37:01 UTC (rev 9970)
+++ helma/helma/trunk/src/helma/scripting/rhino/RhinoEngine.java 2009-09-28 12:55:24 UTC (rev 9971)
@@ -216,8 +216,11 @@
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);
}
Modified: helma/helma/trunk/src/helma/scripting/rhino/debug/Profiler.java
===================================================================
--- helma/helma/trunk/src/helma/scripting/rhino/debug/Profiler.java 2009-09-28 12:37:01 UTC (rev 9970)
+++ helma/helma/trunk/src/helma/scripting/rhino/debug/Profiler.java 2009-09-28 12:55:24 UTC (rev 9971)
@@ -46,11 +46,12 @@
*/
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 @@
* 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
}
/**