jspenv.jsp
上传用户:jhtang88
上传日期:2014-01-27
资源大小:28528k
文件大小:21k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page contentType="text/html;charset=gb2312" %>
  2. <%@ page import="java.util.*,java.io.*,javax.servlet.*,javax.servlet.http.*,java.lang.*" %>
  3. <%
  4. /********************************************************************
  5. * Title: JspEnv v
  6. * Description : JSP环境探针
  7. * CopyRight:(c) 2005  www.soho.net.ru
  8. * @author: 若影
  9. * @version: 1.0
  10. * @Data: 2005-1-1 12:00:00
  11. *********************************************************************/
  12. long timePageStart = System.currentTimeMillis();
  13. %>
  14. <%
  15. class EnvServlet
  16. {
  17. public long timeUse=0;
  18. public Hashtable htParam=new Hashtable();
  19. private Hashtable htShowMsg=new Hashtable();
  20. public void setHashtable()
  21. {
  22. Properties me=System.getProperties();
  23. Enumeration em=me.propertyNames();
  24. while(em.hasMoreElements())
  25. {
  26. String strKey=(String)em.nextElement();
  27. String strValue=me.getProperty(strKey);
  28. htParam.put(strKey,strValue);
  29. }
  30. }
  31. public void getHashtable(String strQuery)
  32. {
  33. Enumeration em=htParam.keys();
  34. while(em.hasMoreElements())
  35. {
  36. String strKey=(String)em.nextElement();
  37. String strValue=new String();
  38. if(strKey.indexOf(strQuery,0)>=0)
  39. {
  40. strValue=(String)htParam.get(strKey);
  41. htShowMsg.put(strKey,strValue);
  42. }
  43. }
  44. }
  45. public String queryHashtable(String strKey)
  46. {
  47. strKey=(String)htParam.get(strKey);
  48. return strKey;
  49. }
  50. public long test_int()
  51. {
  52. long timeStart = System.currentTimeMillis();
  53. int i=0;
  54. while(i<3000000)i++;
  55. long timeEnd = System.currentTimeMillis();
  56. long timeUse=timeEnd-timeStart;
  57. return timeUse;
  58. }
  59. public long test_sqrt()
  60. {
  61. long timeStart = System.currentTimeMillis();
  62. int i=0;
  63. double db=(double)new Random().nextInt(1000);
  64. while(i<200000){db=Math.sqrt(db);i++;}
  65. long timeEnd = System.currentTimeMillis();
  66. long timeUse=timeEnd-timeStart;
  67. return timeUse;
  68. }
  69. }
  70. %>
  71. <%
  72. EnvServlet env=new EnvServlet();
  73. env.setHashtable();
  74. String action=new String(" ");
  75. String act=new String("action");
  76. if(request.getQueryString()!=null&&request.getQueryString().indexOf(act,0)>=0)action=request.getParameter(act);
  77. %>
  78. <html>
  79. <head>
  80. <title>JSP 探针</title>
  81. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  82. <style>
  83. A       { COLOR: #000000; TEXT-DECORATION: none}
  84. A:hover { COLOR: #f58200}
  85. body,td,span { font-size: 9pt}
  86. .input  { BACKGROUND-COLOR: #ffffff;BORDER:#f58200 1px solid;FONT-SIZE: 9pt}
  87. .backc  { BACKGROUND-COLOR: #f58200;BORDER:#f58200 1px solid;FONT-SIZE: 9pt;color:white}
  88. .PicBar { background-color: #f58200; border: 1px solid #000000; height: 12px;}
  89. .tableBorder {BORDER-RIGHT: #183789 1px solid; BORDER-TOP: #183789 1px solid; BORDER-LEFT: #183789 1px solid; BORDER-BOTTOM: #183789 1px solid; BACKGROUND-COLOR: #ffffff; WIDTH: 760;}
  90. .divcenter {
  91. position:absolute;
  92. height:30px;
  93. z-index:1000;
  94. left: 101px;
  95. top: 993px;
  96. }
  97. </STYLE>
  98. <script language="javascript">
  99. function showsubmenu(sid)
  100. {
  101. whichEl = eval("submenu" + sid);
  102. if (whichEl.style.display == "none")
  103. {
  104. eval("submenu" + sid + ".style.display="";");
  105. eval("txt" + sid + ".innerHTML="<a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a>";");
  106. }
  107. else
  108. {
  109. eval("submenu" + sid + ".style.display="none";");
  110. eval("txt" + sid + ".innerHTML="<a href='#' title='打开此项'><font face='Wingdings' color=#FFFFFF>y</font></a>";");
  111. }
  112. }
  113. </SCRIPT>
  114. </head>
  115. <body topmargin="0" leftmargin="0">
  116. <CENTER>
  117.   <table width="760" border="0" cellpadding="0" cellspacing="0">
  118.     <tr> 
  119.       <td width="30%"><P style="MARGIN-TOP: 0px; MARGIN-BOTTOM: -8px">&nbsp;<STRONG 
  120.       style="FONT-SIZE: 40pt">JSP探针</STRONG></td>
  121.       <td width="70%" align="center"><font color=red>欢迎访问<a href="http://free3.e-168.cn/cnforum/">JSP智库</a>,下载最新版程序<br>
  122.       <a href="http://free3.e-168.cn/cnforum/jspenv.rar">直接下载最新版本</font></a></td>
  123.     </tr>
  124.   </table>  
  125.   选项:<a href="#ServerInfo">服务器相关参数</a> | <a href="#JAVAInfo">JAVA相关参数</a> | <a href="#Paramter">参数查询</a>  | <a href="#ServerAbility">服务器运算能力</a> 
  126. | <a href="#ISpeedTest">服务器连接速度</a> 
  127.   | <a href="javascript:location.reload()">刷新</a><a name="ServerInfo"></a>
  128.   <table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
  129.   <tr> 
  130.     <td height="22" align="center" bgcolor="#f58200" onclick="showsubmenu(0)"><font color=#FFFFFF><strong>服务器相关参数</strong></font> 
  131.       
  132. <a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> <span id=txt0 name=txt0><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span> 
  133. </td>
  134.   </tr>
  135.   <tr> 
  136.     <td style="display" id='submenu0'><table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
  137.           <tr bgcolor="#FFFFFF" height="22"> 
  138.             <td width="130">&nbsp;服务器名</td>
  139.             <td colspan="3" height="22">&nbsp;<%= request.getServerName() %>(<%=request.getRemoteAddr()%>)</td>
  140.           </tr>
  141.           <tr bgcolor="#FFFFFF" height="22"> 
  142.             <td>&nbsp;服务器操作系统</td>
  143.             <td colspan="3">&nbsp;<%=env.queryHashtable("os.name")%> <%=env.queryHashtable("os.version")%> 
  144.               <%=env.queryHashtable("sun.os.patch.level")%></td>
  145.           </tr>
  146.           <tr bgcolor="#FFFFFF" height="22"> 
  147.             <td>&nbsp;服务器操作系统类型</td>
  148.             <td>&nbsp;<%=env.queryHashtable("os.arch")%></td>
  149.             <td>&nbsp;服务器操作系统模式</td>
  150.             <td>&nbsp;<%=env.queryHashtable("sun.arch.data.model")%>位</td>
  151.           </tr>     
  152.           <tr bgcolor="#FFFFFF" height="22"> 
  153.             <td>&nbsp;服务器所在地区</td>
  154.             <td>&nbsp;<%=env.queryHashtable("user.country")%></td>
  155.             <td>&nbsp;服务器语言</td>
  156.             <td>&nbsp;<%=env.queryHashtable("user.language")%></td>
  157.           </tr>
  158.           <tr bgcolor="#FFFFFF" height="22"> 
  159.             <td>&nbsp;服务器时区</td>
  160.             <td>&nbsp;<%=env.queryHashtable("user.timezone")%></td>
  161.             <td>&nbsp;服务器时间</td>
  162.             <td>&nbsp;<%=new java.util.Date()%> </td>
  163.           </tr>
  164.   <tr bgcolor="#FFFFFF" height="22"> 
  165.             <td>&nbsp;服务器解译引擎</td>
  166.             <td width="170">&nbsp;<%= getServletContext().getServerInfo() %></td>
  167.             <td width="130">&nbsp;服务器端口</td>
  168.             <td width="170">&nbsp;<%= request.getServerPort() %></td>
  169.           </tr>
  170.           <tr bgcolor="#FFFFFF" height="22"> 
  171.             <td height="22">&nbsp;当前用户</td>
  172.             <td height="22" colspan="3">&nbsp;<%=env.queryHashtable("user.name")%></td>
  173.           </tr>
  174.           <tr bgcolor="#FFFFFF" height="22"> 
  175.             <td>&nbsp;用户目录</td>
  176.             <td colspan="3">&nbsp;<%=env.queryHashtable("user.dir")%></td>
  177.           </tr>
  178.           <tr bgcolor="#FFFFFF" height="22"> 
  179.             <td align=left bgcolor="#FFFFFF">&nbsp;本文件实际路径</td>
  180.             <td height="8" colspan="3" bgcolor="#FFFFFF">&nbsp;<%=request.getRealPath(request.getServletPath())%></td>
  181.           </tr>
  182.         </table>
  183.     </td>
  184.   </tr>
  185. </table>
  186.   <a name="JAVAInfo" id="JAVAInfo"></a><br>
  187. <table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
  188.   <tr> 
  189.       <td height="22" align="center" bgcolor="#f58200" onclick="showsubmenu(1)"><font color=#FFFFFF><strong>JAVA相关参数</strong></font> 
  190.         <a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> 
  191.         <span id=txt1 name=txt1><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span> 
  192.       </td>
  193.   </tr>
  194.   <tr> 
  195.     <td style="display" id='submenu1'>
  196. <table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
  197.           <tr bgcolor="#fcc79b" height="22"> 
  198.             <td width="30%">&nbsp;名称</td>
  199.             <td width="50%" height="22">&nbsp;英文名称</td>
  200.             <td width="20%" height="22">&nbsp;版本</td>
  201.           </tr>
  202.           <tr bgcolor="#FFFFFF" height="22"> 
  203.             <td width="30%">&nbsp;JAVA运行环境名称</td>
  204.             <td width="50%" height="22">&nbsp;<%=env.queryHashtable("java.runtime.name")%></td>
  205.             <td width="20%" height="22">&nbsp;<%=env.queryHashtable("java.runtime.version")%></td>
  206.           </tr>
  207.           <tr bgcolor="#FFFFFF" height="22"> 
  208.             <td width="30%">&nbsp;JAVA运行环境说明书名称</td>
  209.             <td width="50%" height="22">&nbsp;<%=env.queryHashtable("java.specification.name")%></td>
  210.             <td width="20%" height="22">&nbsp;<%=env.queryHashtable("java.specification.version")%></td>
  211.           </tr>
  212.           <tr bgcolor="#FFFFFF" height="22"> 
  213.             <td width="30%">&nbsp;JAVA虚拟机名称</td>
  214.             <td width="50%" height="22">&nbsp;<%=env.queryHashtable("java.vm.name")%></td>
  215.             <td width="20%" height="22">&nbsp;<%=env.queryHashtable("java.vm.version")%></td>
  216.           </tr>
  217.           <tr bgcolor="#FFFFFF" height="22"> 
  218.             <td width="30%">&nbsp;JAVA虚拟机说明书名称</td>
  219.             <td width="50%" height="22">&nbsp;<%=env.queryHashtable("java.vm.specification.name")%></td>
  220.             <td width="20%" height="22">&nbsp;<%=env.queryHashtable("java.vm.specification.version")%></td>
  221.           </tr>
  222.   <%
  223.    float fFreeMemory=(float)Runtime.getRuntime().freeMemory();
  224. float fTotalMemory=(float)Runtime.getRuntime().totalMemory();
  225. float fPercent=fFreeMemory/fTotalMemory*100;
  226.   %>
  227.           <tr bgcolor="#FFFFFF" height="22"> 
  228.    <td height="22">&nbsp;JAVA虚拟机剩余内存:</td>
  229.             <td height="22" colspan="2"><img align=absmiddle class=PicBar width='<%=0.85*fPercent%>%'>&nbsp;<%=fFreeMemory/1024/1024%>M 
  230.             </td>
  231.           </tr>
  232.           <tr bgcolor="#FFFFFF" height="22"> 
  233.    <td height="22">&nbsp;JAVA虚拟机分配内存</td>
  234.             <td height="22" colspan="2"><img align=absmiddle class=PicBar width='85%'>&nbsp;<%=fTotalMemory/1024/1024%>M 
  235.             </td>
  236.           </tr>
  237.         </table>
  238. <table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
  239.           <tr bgcolor="#fcc79b" height="22"> 
  240.             <td width="30%">&nbsp;参数名称</td>
  241.             <td width="70%" height="22">&nbsp;参数路径</td>
  242.           </tr>
  243.           <tr bgcolor="#FFFFFF" height="22"> 
  244.             <td width="30%">&nbsp;java.class.path </td>
  245.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.class.path").replaceAll(env.queryHashtable("path.separator"),env.queryHashtable("path.separator")+"<br>&nbsp;")%>
  246. </td>
  247.           </tr>
  248.           <tr bgcolor="#FFFFFF" height="22"> 
  249.             <td width="30%">&nbsp;java.home</td>
  250.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.home")%></td>
  251.           </tr>
  252.           <tr bgcolor="#FFFFFF" height="22"> 
  253.             <td width="30%">&nbsp;java.endorsed.dirs</td>
  254.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.endorsed.dirs")%></td>
  255.           </tr>
  256.           <tr bgcolor="#FFFFFF" height="22"> 
  257.             <td width="30%">&nbsp;java.library.path</td>
  258.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.library.path").replaceAll(env.queryHashtable("path.separator"),env.queryHashtable("path.separator")+"<br>&nbsp;")%>
  259. </td>
  260.           </tr>
  261.   <tr bgcolor="#FFFFFF" height="22"> 
  262.             <td width="30%">&nbsp;java.io.tmpdir</td>
  263.             <td width="70%" height="22">&nbsp;<%=env.queryHashtable("java.io.tmpdir")%></td>
  264.           </tr>
  265.         </table>
  266.     </td>
  267.   </tr>
  268. </table>
  269.   <a name="Paramter" id="Paramter"></a><br>
  270.   <form action="?action=query" method="post" name="queryform">
  271.   <table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
  272.     <tr> 
  273.       <td height="22" align="center" bgcolor="#f58200" onclick="showsubmenu(2)"><font color=#FFFFFF><strong>参数查询</strong></font> 
  274.         <a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> 
  275.         <span id=txt2 name=txt2><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span> 
  276.       </td>
  277.     </tr>
  278.     <tr> 
  279.       <td style="display" id='submenu2'> 
  280.    <table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
  281.           <tr bgcolor="#fcc79b" height="22"> 
  282.             <td>&nbsp;请查询系统的参数信息(<a href="#" onClick="document.queryform.submit()">枚举所有参数信息</a>)</td>
  283.           </tr>
  284.           <tr bgcolor="#FFFFFF" height="22"> 
  285.             <td align=center>
  286. <input type="text" name="query" class="input" size="70">&nbsp;&nbsp;
  287. <input type="submit" value="提交" class="backc">&nbsp;
  288. <input type="reset" value="重置" class="backc"> </td>
  289.           </tr>
  290.         </table>
  291. <table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
  292.  <%
  293.   if(action.equals("query"))
  294. {
  295. String query=request.getParameter("query");
  296. env.getHashtable(query);
  297. if(env.htShowMsg.size()>0)
  298. out.println("<tr bgcolor="#fcc79b" height="22">n<td>&nbsp;参数名称</td>n<td>&nbsp;参数信息</td>n</tr>");
  299. else
  300. out.println("<tr bgcolor="#fcc79b" height="22">n<td>&nbsp;<font color=red>出错信息:</font></td>n<td>&nbsp;<font color=red>没有找到你所查询的内容,请输入所要查询的参数,如果不确认,可以进行抽象查询,输入所包含字母。</font></td>n</tr>");
  301. Enumeration em=env.htShowMsg.keys();
  302. while(em.hasMoreElements())
  303.     {
  304.     String strParam=(String)em.nextElement();
  305. String strParamValue=(String)env.htShowMsg.get(strParam);
  306. if(strParam.indexOf(".path",0)>=0){strParamValue=strParamValue.replaceAll(env.queryHashtable("path.separator"),env.queryHashtable("path.separator")+"<br>&nbsp;");}
  307.     out.println ("<tr bgcolor="#FFFFFF" height="22"><td width="30%">&nbsp;"+strParam+"</td><td width="70%">&nbsp;"+strParamValue+"</td></tr>");
  308.     }
  309. }
  310.  %>
  311.   </table>  
  312. </td>
  313.     </tr>
  314.   </table>
  315.   </form>
  316.   <a name="ServerAbility" id="ServerAbility"></a> 
  317.   <table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
  318.     <tr> 
  319.       <td height="22" align="center" bgcolor="#f58200" onclick="showsubmenu(3)"><font color=#FFFFFF><strong>服务器运算能力</strong></font> 
  320.         <a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> 
  321.         <span id=txt3 name=txt3><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span> 
  322.       </td>
  323.     </tr>
  324.     <tr> 
  325.       <td style="display" id='submenu3'> <table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#f58200">
  326.           <tr bgcolor="#fcc79b" height="22"> 
  327.             <td colspan="3">&nbsp;&nbsp;<font face='Webdings'>4</font> 让服务器执行300万次加法(<font color="#000000">整数运算</font>)和20万次开方(浮点运算),记录其所使用的时间。 
  328.             </td>
  329.           </tr>
  330.           <tr height="22"bgcolor="#FFFFFF" > 
  331.             <td align=center bgcolor="#FFFFFF"><font color="#000000">可 供 参 考 的 
  332.               服 务 器 列 表</font></td>
  333.             <td align="center">整数运算</td>
  334.             <td align="center">浮点运算</td>
  335.           </tr>
  336.           <tr bgcolor="#FFFFFF" height="22"> 
  337.             <td align=left>&nbsp;公司的电脑&nbsp;(CPU:Celeron 1G&nbsp; 内存:256M)</td>
  338.             <td align="center">60 毫秒</td>
  339.             <td align="center">70 毫秒</td>
  340.           </tr>
  341.           <tr bgcolor="#FFFFFF" height="22"> 
  342.             <td align=left>&nbsp;家里的电脑&nbsp;(CPU:Duron 1G&nbsp; 内存:384M) </td>
  343.             <td align="center">20 毫秒</td>
  344.             <td align="center">10 毫秒</td>
  345.           </tr>
  346.           <tr bgcolor="#FFFFFF" height="22"> 
  347.             <td align=left>&nbsp;<a href="http://free3.e-168.cn/cnforum/jspenv.jsp" target="_blank">中国网聚服务器&nbsp; 
  348.               (CPU:Intel Pentium III 1G 内存:768M)</a></td>
  349.             <td align="center">20 毫秒</td>
  350.             <td align="center">3 毫秒</td>
  351.           </tr>
  352.           <tr bgcolor="#FFFFFF" height="22"> 
  353.             <td align=left>&nbsp;<a href="http://ibmclub.hust.edu.cn/myweb/ggyy/jspenv.jsp" target="_blank">IBM俱乐部&nbsp; 
  354.               (CPU:IIntel(R) Celeron(R) CPU 1.70G 内存:256M)</a></td>
  355.             <td align="center">3 毫秒 </td>
  356.             <td align="center">7 毫秒</td>
  357.           </tr>
  358.           <tr bgcolor="#FFFFFF" height=25> 
  359.             <td align=left>&nbsp;<font color=red>您正在使用的这台服务器</font>&nbsp; <INPUT name="button2" type="button" class=backc onclick="javascript:location.reload()" value="重新测试"> 
  360.             </td>
  361.             <td align="center"><font color=red><%=env.test_int()%> 毫秒</font></td>
  362.             <td align="center"><font color=red><%=env.test_sqrt()%> 毫秒</font></td>
  363.           </tr>
  364.         </table></td>
  365.     </tr>
  366.   </table>
  367.   <a name="ISpeedTest" id="ISpeedTest"></a><br>
  368.  <%
  369.   if(action.equals("SpeedTest"))
  370. {
  371.  %>
  372. <div id="testspeed" align="center"> 
  373.   <table width="200" border="0" cellspacing="0" cellpadding="0" class="divcenter">
  374.     <tr> 
  375.       <td height="30" align=center><p><font color="#000000"><span id=txt5>网速测试中,请稍候...</span></font></p></td>
  376.     </tr>
  377.   </table>
  378. </div>
  379. <%}%>
  380.   <table border="0" cellpadding="0" cellspacing="1" bgcolor="#f58200" class="tableBorder">
  381.   <tr> 
  382.     <td height="25" align="center" bgcolor="#f58200" onclick="showsubmenu(4)"><font color="#FFFFFF"><strong>服务器连接速度</strong></font> 
  383.       
  384. <a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> <span id=txt4 name=txt4><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span> 
  385.     </td>
  386.   </tr>
  387.   <tr> 
  388.     <td bgcolor="#F8F9FC" style="display" id='submenu4'> <table width="100%" border="0" cellspacing=1 cellpadding=3 bgcolor="#f58200">
  389.         <tr bgcolor="#FFFFFF"> 
  390.           <td width="80">接入设备</td>
  391.           <td width="420">&nbsp;连接速度(理想值)</td>
  392.           <td width="100">下载速度(理想值)</td>
  393.         </tr>
  394. <tr bgcolor="#FFFFFF"> 
  395.           <td>56k Modem</td>
  396.           <td><img align=absmiddle class=PicBar width='1%'> 56 Kbps</td><td>&nbsp;7.0 k/s</td>
  397.         </tr>
  398.         <tr bgcolor="#FFFFFF"> 
  399.           <td>64k ISDN</td>
  400.           <td><img align=absmiddle class=PicBar width='1%'> 64 Kbps</td><td>&nbsp;8.0 k/s</td>
  401.         </tr>
  402.         <tr bgcolor="#FFFFFF"> 
  403.           <td>512k ADSL</td>
  404.           <td><img align=absmiddle class=PicBar width='5%'> 512 Kbps</td><td>&nbsp;64.0 k/s</td>
  405.         </tr>
  406.         <tr bgcolor="#FFFFFF"> 
  407.           <td height="19">1.5M Cable</td>
  408.           <td><img align=absmiddle class=PicBar width='15%'> 1500 Kbps</td><td>&nbsp;187.5 k/s</td>
  409.         </tr>
  410.         <tr bgcolor="#FFFFFF"> 
  411.           <td>5M FTTP</td>
  412.           <td><img align=absmiddle class=PicBar width='50%'> 5000 Kbps</td><td>&nbsp;625.0 k/s</td>
  413.         </tr>
  414.         <tr bgcolor="#FFFFFF"> 
  415.           <td>当前连接速度</td>
  416. <%
  417. if(action.equals("SpeedTest"))
  418. {
  419. out.println("<script language='JavaScript'>var tSpeedStart=new Date();</script>") ;
  420. out.println("<!--n");
  421. for(int i=0;i<1000;i++)
  422. {out.println("####################################################################################################");}
  423. out.println("-->n");
  424. out.println("<script language='JavaScript'>var tSpeedEnd=new Date();</script>n");
  425. out.println("<script language='JavaScript'>");
  426. out.println("var iSpeedTime=0;iSpeedTime=(tSpeedEnd - tSpeedStart) / 1000;");
  427. out.println("if(iSpeedTime>0) iKbps=Math.round(Math.round(100 * 8 / iSpeedTime * 10.5) / 10); else iKbps=10000 ;");
  428. out.println("var iShowPer=Math.round(iKbps / 100);");
  429. out.println("if(iShowPer<1) iShowPer=1;  else if(iShowPer>82)   iShowPer=82;");
  430. out.println("</script>n");
  431. out.println("<script language='JavaScript'>") ;
  432. out.println("document.write('<td><img align=absmiddle class=PicBar width="' + iShowPer + '%">' + iKbps + ' Kbps');");
  433. out.println("</script>n");
  434. out.println("</td><td>&nbsp;<a href='?action=SpeedTest' title=测试连接速度><u>");
  435. out.println("<script language='JavaScript'>");
  436. out.println("document.write(Math.round(iKbps/8*10)/10+ ' k/s');");
  437. out.println("</script>n") ;
  438. out.println("</u></a></td>");
  439. %>
  440. <script>
  441. txt5.innerHTML="网速测试完毕!"
  442. testspeed.style.visibility="hidden"
  443. </script>
  444. <%
  445. }
  446. else
  447. {out.println("<td></td><td>&nbsp;<a href='?action=SpeedTest' title=测试连接速度><u>开始测试</u></a></td>");}
  448. %>
  449.         </tr>
  450.       </table></td>
  451.   </tr>
  452. </table>
  453. <%
  454. long timePageEnd = System.currentTimeMillis();
  455. long timePageUse=timePageEnd-timePageStart;
  456. %>
  457. <table border=0 cellpadding=0 cellspacing=1 class=tableBorder>
  458.   <tr>
  459.     <td height="59" align=center>Copyright ? 2005-2008 , All Rights Reserved. 
  460. <br>
  461. 欢迎访问★<a href="http://free3.e-168.cn/cnforum/">JSP智库</a>★,下载最新版程序<br>
  462. 页面执行时间:约<%=timePageUse%>毫秒  JspEnv V1.0</td>
  463.   </tr>
  464. </table>
  465. </CENTER>
  466. </body>
  467. </html>