r9975 - in helma/helma/trunk/src/helma: framework framework/core scripting/rhino scripting/rhino/debug
[email protected] Tue, 29 Sep 2009 15:51:26 +0200 (CEST)
| Newsgroups | gmane.comp.java.helma.cvs |
|---|---|
| Message-ID | <20090929135126.E6C6A3D0E2@mia> |
Author: hannes
Date: 2009-09-29 15:51:26 +0200 (Tue, 29 Sep 2009)
New Revision: 9975
Modified:
helma/helma/trunk/src/helma/framework/RequestTrans.java
helma/helma/trunk/src/helma/framework/core/RequestEvaluator.java
helma/helma/trunk/src/helma/scripting/rhino/RhinoEngine.java
helma/helma/trunk/src/helma/scripting/rhino/debug/Profiler.java
Log:
Minor profiler and logging tweaks
Details at http://dev.helma.org/trac/helma/changeset/9975
Modified: helma/helma/trunk/src/helma/framework/RequestTrans.java
===================================================================
--- helma/helma/trunk/src/helma/framework/RequestTrans.java 2009-09-29 08:14:54 UTC (rev 9974)
+++ helma/helma/trunk/src/helma/framework/RequestTrans.java 2009-09-29 13:51:26 UTC (rev 9975)
@@ -621,6 +621,10 @@
}
}
+ public String toString() {
+ return method + ":" + path;
+ }
+
class ParameterMap extends SystemMap {
public ParameterMap() {
Modified: helma/helma/trunk/src/helma/framework/core/RequestEvaluator.java
===================================================================
--- helma/helma/trunk/src/helma/framework/core/RequestEvaluator.java 2009-09-29 08:14:54 UTC (rev 9974)
+++ helma/helma/trunk/src/helma/framework/core/RequestEvaluator.java 2009-09-29 13:51:26 UTC (rev 9975)
@@ -160,7 +160,7 @@
// request path object
RequestPath requestPath = new RequestPath(app);
- String txname = req.getMethod().toLowerCase() + ":" + req.getPath();
+ String txname = req.getMethod() + ":" + req.getPath();
Log eventLog = app.getEventLog();
if (eventLog.isDebugEnabled()) {
eventLog.debug(txname + " starting");
Modified: helma/helma/trunk/src/helma/scripting/rhino/RhinoEngine.java
===================================================================
--- helma/helma/trunk/src/helma/scripting/rhino/RhinoEngine.java 2009-09-29 08:14:54 UTC (rev 9974)
+++ helma/helma/trunk/src/helma/scripting/rhino/RhinoEngine.java 2009-09-29 13:51:26 UTC (rev 9975)
@@ -220,7 +220,7 @@
if (res != null) {
getResponse().debug("<pre>" + result + "</pre>");
}
- app.logEvent(result);
+ app.logEvent("Profiler data for " + getRequest() + ":\n" + 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-29 08:14:54 UTC (rev 9974)
+++ helma/helma/trunk/src/helma/scripting/rhino/debug/Profiler.java 2009-09-29 13:51:26 UTC (rev 9975)
@@ -49,7 +49,8 @@
if (script.isFunction()) {
StringBuffer b = new StringBuffer(script.getSourceName()).append(" #");
b.append(script.getLineNumbers()[0]);
- if (script.getFunctionName() != null) {
+ String funcName = script.getFunctionName();
+ if (funcName != null && funcName.length() > 0) {
b.append(": ").append(script.getFunctionName());
}
return b.toString();
@@ -66,13 +67,21 @@
}
});
int length = Math.min(100, f.length);
- int prefixLength = Integer.MAX_VALUE;
- for (int i = 0; i < length - 1; i++) {
- prefixLength = Math.min(prefixLength,
+ int prefixLength = length < 2 ? 0 : Integer.MAX_VALUE;
+ int maxLength = 0;
+ for (int i = 0; i < length; i++) {
+ maxLength = Math.max(maxLength, f[i].name.length());
+ if (i < length - 1) {
+ prefixLength = Math.min(prefixLength,
StringUtils.getCommonPrefix(f[i].name, f[i+1].name).length());
+ }
}
+ maxLength = maxLength + 30 - prefixLength;
StringBuffer buffer = new StringBuffer(" total average calls path\n");
- buffer.append("==================================================================\n");
+ for (int i = 0; i < maxLength; i++) {
+ buffer.append('-');
+ }
+ buffer.append('\n');
for (int i = 0; i < length; i++) {
buffer.append(f[i].renderLine(prefixLength));
}