JSP获取CPU使用率、系统内存、虚拟机内存等情况(不用JNI)(11)
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>运行状态</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<meta http-equiv="refresh" content="5">
</head>
<body>
<%
IMonitorService service = new MonitorServiceImpl();
MonitorInfoBean monitorInfo = service.getMonitorInfoBean();
out.println("cpu占有率=" + monitorInfo.getCpuRatio() + "<br>");
out.println("可使用内存=" + monitorInfo.getTotalMemory() + "<br>");
out.println("剩余内存=" + monitorInfo.getFreeMemory() + "<br>");
out.println("最大可使用内存=" + monitorInfo.getMaxMemory() + "<br>");
out.println("操作系统=" + monitorInfo.getOsName() + "<br>");
out.println("总的物理内存=" + monitorInfo.getTotalMemorySize() + "kb"
+ "<br>");
out.println("剩余的物理内存=" + monitorInfo.getFreeMemory() + "kb"
相关新闻>>
- 发表评论
-
- 最新评论 更多>>