Add statistics object

This commit is contained in:
Ankit Gupta
2014-04-14 21:06:13 -07:00
parent c87ed0942c
commit a044398260
10 changed files with 73 additions and 12 deletions

View File

@@ -34,11 +34,13 @@ public class RocksDBSample {
}
options.setCreateIfMissing(true)
.createStatistics()
.setWriteBufferSize(8 * SizeUnit.KB)
.setMaxWriteBufferNumber(3)
.setDisableSeekCompaction(true)
.setBlockSize(64 * SizeUnit.KB)
.setMaxBackgroundCompactions(10);
Statistics stats = new Statistics(options.statisticsPtr());
assert(options.createIfMissing() == true);
assert(options.writeBufferSize() == 8 * SizeUnit.KB);
@@ -120,13 +122,25 @@ public class RocksDBSample {
assert(new String(testValue).equals(
new String(enoughArray, 0, len)));
writeOpts.dispose();
try {
for(StatisticsType statsType : StatisticsType.values()) {
stats.getTickerCount(statsType);
}
System.out.println("getTickerCount() passed.");
}
catch(Exception e) {
System.out.println("Failed in call to getTickerCount()");
assert(false); //Should never reach here.
}
} catch (RocksDBException e) {
System.err.println(e);
}
if (db != null) {
db.close();
}
// be sure to dispose c++ pointer
// be sure to dispose c++ pointers
options.dispose();
}
}