forked from hyperic/sigar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Sigar.getProcDiskIO to Java API on Linux
Returns the total bytes read and written for a process using /proc/pid/io.
- Loading branch information
nettag
committed
Jul 30, 2013
1 parent
ec489fb
commit a62558a
Showing
7 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
bindings/java/src/org/hyperic/sigar/test/TestProcDiskIO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.hyperic.sigar.test; | ||
|
||
import org.hyperic.sigar.ProcDiskIO; | ||
import org.hyperic.sigar.Sigar; | ||
import org.hyperic.sigar.SigarException; | ||
|
||
public class TestProcDiskIO extends SigarTestCase { | ||
|
||
public TestProcDiskIO(String name) { | ||
super(name); | ||
} | ||
|
||
|
||
private void traceDiskIO(Sigar sigar, long pid) throws Exception { | ||
ProcDiskIO procDiskIO; | ||
|
||
try { | ||
procDiskIO = sigar.getProcDiskIO(pid); | ||
} catch (SigarException e) { | ||
traceln("pid " + pid + ": " + e.getMessage()); | ||
return; | ||
} | ||
|
||
traceln("Pid=" + pid); | ||
traceln("Bytes Read=" + Sigar.formatSize(procDiskIO.getBytesRead())); | ||
traceln("Bytes Written=" + Sigar.formatSize(procDiskIO.getBytesWritten())); | ||
} | ||
|
||
public void testCreate() throws Exception { | ||
Sigar sigar = getSigar(); | ||
|
||
try { | ||
sigar.getProcDiskIO(getInvalidPid()); | ||
} catch (SigarException e) { | ||
} | ||
|
||
long[] pids = sigar.getProcList(); | ||
for (int i=0; i<pids.length; i++) { | ||
traceDiskIO(sigar, pids[i]); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters