public long getTotalByte(){ Sigar sigar = new Sigar(); long totalByte = 0; try { FileSystem[] fslist = sigar.getFileSystemList(); for (int i = 0; i < fslist.length; i++){ if (fslist[i].getType() == 2){ FileSystemUsage usage = sigar.getFileSystemUsage(fslist[i].getDirName()); totalByte += usage.getDiskReadBytes(); totalByte += usage.getDiskWriteBytes(); } } } catch (SigarException e) { // TODO Auto-generated catch block e.printStackTrace(); } return totalByte; } public static void main(String[] args) { TestIO io = new TestIO(); long tempTotal = io.getTotalByte(); for (int i = 0; i < 200; i++) { try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } long total = io.getTotalByte(); System.out.println( Integer.valueOf((int) ((total - tempTotal) / 1000)) + "kb"); tempTotal = total; } } 引用jar包:http://sourceforge.net/projects/sigar/