提交 bd74ac96 authored 作者: Thomas Mueller's avatar Thomas Mueller

Profiler: list open and close separately; only if slow.

上级 b1b82aab
......@@ -789,20 +789,38 @@ public class WebApp implements DatabaseEventListener {
session.put("user", user);
boolean isH2 = url.startsWith("jdbc:h2:");
try {
long start = System.currentTimeMillis();
String profileOpen = "", profileClose = "";
Profiler profiler = new Profiler();
profiler.startCollecting();
Connection conn;
try {
conn = server.getConnection(driver, url, user, password, this);
} finally {
profiler.stopCollecting();
profileOpen = profiler.getTop(3);
}
profiler = new Profiler();
profiler.startCollecting();
try {
Connection conn = server.getConnection(driver, url, user, password, this);
JdbcUtils.closeSilently(conn);
} finally {
profiler.stopCollecting();
profileClose = profiler.getTop(3);
}
String success = "<a class=\"error\" href=\"#\" onclick=\"var x=document.getElementById('prof').style;x.display=x.display==''?'none':'';\">" +
long time = System.currentTimeMillis() - start;
String success;
if (time > 1000) {
success = "<a class=\"error\" href=\"#\" onclick=\"var x=document.getElementById('prof').style;x.display=x.display==''?'none':'';\">" +
"${text.login.testSuccessful}</a>" +
"<span style=\"display: none;\" id=\"prof\"><br />" +
PageParser.escapeHtml(profiler.getTop(3)) +
PageParser.escapeHtml(profileOpen) +
"<br />" +
PageParser.escapeHtml(profileClose) +
"</span>";
} else {
success = "${text.login.testSuccessful}";
}
session.put("error", success);
// session.put("error", "${text.login.testSuccessful}");
return "login.jsp";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论