dont read every record unless verbose

This commit is contained in:
Doug MacEachern 2005-09-24 21:17:19 +00:00
parent d4f0bab72e
commit 7de3ef0517
1 changed files with 6 additions and 1 deletions

View File

@ -82,11 +82,15 @@ public class TestEventLog extends SigarTestCase {
log.open(logname);
int oldestRecord = log.getOldestRecord();
int numRecords = log.getNumberOfRecords();
traceln("oldest=" + oldestRecord + ", total=" + numRecords);
for (int i = oldestRecord; i < oldestRecord + numRecords; i++) {
try {
record = log.read(i);
success++;
if (!getVerbose() && (success > 500)) {
break; //read plenty
}
} catch (Win32Exception e) {
fail++;
traceln("Error reading record " + i + ": " +
@ -96,6 +100,7 @@ public class TestEventLog extends SigarTestCase {
log.close();
traceln("success=" + success + ", fail=" + fail);
return success > fail;
}