Fix the bug of LogicalDiskServicewindows and LogicalDiskTest

This commit is contained in:
fanfuxiaoran 2013-07-25 09:54:02 +08:00
parent d694d00563
commit 964dd3185b
2 changed files with 15 additions and 3 deletions

View File

@ -24,7 +24,8 @@ public class LogicalDiskServiceWindows {
public LogicalDiskModel getLogicalDiskInfo(int idleTime){
String[] instances;
String []temp;
Map<String,Double> freeSpacePercent=new HashMap<String, Double>();
Map<String,Double> freeMegabytes=new HashMap<String, Double>();
@ -49,8 +50,12 @@ public class LogicalDiskServiceWindows {
// µ±Ç°ÓÁг¤È
Map<String,Double> currentDiskQueueLength=new HashMap<String, Double>();
instances=this.getLogicalDiskMonitor().getInstances();
temp=this.getLogicalDiskMonitor().getInstances();
String[] instances=new String[temp.length-1];
for(int i=0;i<temp.length-1;i++)
instances[i]=temp[i];
for(String elem:instances){
freeSpacePercent.put(elem, this.getLogicalDiskMonitor().getFreeSpacePercent(elem));
freeMegabytes.put(elem, this.getLogicalDiskMonitor().getFreeSpacePercent(elem));

View File

@ -36,7 +36,7 @@ public class LogicalDiskTest {
String urlString = "http://localhost:5555/Monitor/LogicalDisk";
atx = new ClassPathXmlApplicationContext("org/Bench4Q/Monitor/Config/application-context.xml");
LogicalDiskTest monitorServiceTest =(LogicalDiskTest)atx.getBean("monitorServiceTest");
LogicalDiskTest monitorServiceTest =(LogicalDiskTest)atx.getBean("logicalDiskTest");
try {
@ -89,6 +89,13 @@ public class LogicalDiskTest {
+ logicalDiskModel.getAverageDiskBytesPerRead().get(elem));
System.out.println("averageDiskBytesPerWrite" + ": "
+ logicalDiskModel.getAverageDiskBytesPerWrite().get(elem));
System.out.println("idelTimePercent"+":"+logicalDiskModel.getIdleTimePercent().get(elem));
System.out.println("averageDiskQueueLength"+":"+logicalDiskModel.getAverageDiskQueueLength().get(elem));
System.out.println("currentDiskQueueLength"+":"+logicalDiskModel.getCurrentDiskQueueLength().get(elem));
// ƽ¾ùÓÁг¤È
// µ±Ç°ÓÁг¤È
}
}