use CpuTimer

This commit is contained in:
Doug MacEachern 2005-03-22 05:09:48 +00:00
parent f658fa20db
commit 491ff005ac
1 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package net.hyperic.sigar.test; package net.hyperic.sigar.test;
import net.hyperic.sigar.CpuTimer;
import net.hyperic.sigar.Sigar; import net.hyperic.sigar.Sigar;
import net.hyperic.sigar.SigarNotImplementedException; import net.hyperic.sigar.SigarNotImplementedException;
import net.hyperic.sigar.ThreadCpu; import net.hyperic.sigar.ThreadCpu;
@ -26,13 +27,15 @@ public class TestThreadCpu extends SigarTestCase {
assertGtEqZeroTrace("Total", cpu.getTotal()); assertGtEqZeroTrace("Total", cpu.getTotal());
CpuTimer timer = new CpuTimer(sigar);
for (int i=0; i<1000000; i++) { for (int i=0; i<1000000; i++) {
System.getProperty("java.home"); System.getProperty("java.home");
} }
traceln("\nDiff...\n"); traceln("\nDiff...\n");
ThreadCpu diff = sigar.getThreadCpuDiff(cpu); ThreadCpu diff = timer.getDiff();
assertGtEqZeroTrace("User", diff.getUser()); assertGtEqZeroTrace("User", diff.getUser());