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

H2 Console: new built-in command @sleep to help profile another session.

上级 81904b30
......@@ -384,6 +384,17 @@ otherwise they are not parsed correctly. If in doubt, add ';' before the command
(if there are 3).
</td>
</tr>
<tr>
<td class="notranslate">
@prof_stop;<br />
@sleep 10;<br />
@prof_stop;
</td>
<td>
Sleep for a number of seconds. Used to profile a long running query or
operation that is running in another session (but in the same process).
</td>
</tr>
<tr>
<td class="notranslate">
@transaction_isolation;<br />
......
......@@ -1277,6 +1277,14 @@ public class WebApp {
profiler = new Profiler();
profiler.startCollecting();
return "Ok";
} else if (isBuiltIn(sql, "@sleep")) {
String s = sql.substring("@sleep".length()).trim();
int sleep = 1;
if (s.length() > 0) {
sleep = Integer.parseInt(s);
}
Thread.sleep(sleep * 1000);
return "Ok";
} else if (isBuiltIn(sql, "@transaction_isolation")) {
String s = sql.substring("@transaction_isolation".length()).trim();
if (s.length() > 0) {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论