benchmark1.jsp
来自「jakarta-taglibs」· JSP 代码 · 共 76 行
JSP
76 行
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<%@ page session="false" %>
<%@ taglib uri="http://jakarta.apache.org/taglibs/benchmark" prefix="benchmark" %>
<html>
<body>
<%--
--
-- Benchmark example application. Author: Shawn Bayern
--
-- NOTE: You might not want to run this page as-is, since it just
-- pauses for a number of seconds, and you might think there's
-- something wrong with your container. :-)
--
--%>
<%-- Typically returns between 1000 - 1010 on my system. --%>
<p>
Duration of a Thread.sleep(1000ms):
<benchmark:duration>
<% Thread.sleep(1000); %>
</benchmark:duration>
</p>
<%-- Typically returns about 1010 on my system. --%>
<p>
Duration of a Thread.sleep(1000ms) excluding a nested Thread.sleep(1000ms):
<benchmark:duration>
<% Thread.sleep(1000); %>
<benchmark:exclude>
<% Thread.sleep(1000); %>
</benchmark:exclude>
</benchmark:duration>
</p>
<%-- Typically returns about 2020 on my system. --%>
<p>
Duration of a Thread.sleep(1000ms) excluding a nested Thread.sleep(1000ms),
followed by another Thread.sleep(1000ms):
<benchmark:duration>
<% Thread.sleep(1000); %>
<benchmark:exclude>
<% Thread.sleep(1000); %>
</benchmark:exclude>
<% Thread.sleep(1000); %>
</benchmark:duration>
</p>
<%-- Typically returns about 5050 on my system. --%>
<p>
Duration of a Thread.sleep(1000ms) repeated 5 times:
<benchmark:duration repeat="5">
<% Thread.sleep(1000); %>
</benchmark:duration>
</p>
<%-- Typically returns 0 or 1 on my system. --%>
<p>
Duration of repeat 1000 times of nothing:
<benchmark:duration repeat="1000">
...
</benchmark:duration>
</p>
<%-- Typically returns between 40 and 200 on my system. --%>
<p>
Duration of repeat 10000 times of nothing:
<benchmark:duration repeat="10000">
...
</benchmark:duration>
</p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?