Open topic with navigation
Using Your Application To Generate The IO Pattern
When you execute IoBenchmark, it uses a simple CRUD (create, read,
update, delete) application as the target application. This application
is located in the com.db4o.bench.crud package. If you want to use your own application for generating the I/O access patterns, here's what you have to do:
- Use a LoggingIoAdapter, delegating to your default IoAdapter:
RandomAccessFileAdapter rafAdapter =
new RandomAccessFileAdapter();
IoAdapter ioAdapter =
new LoggingIoAdapter(rafAdapter, "filename.log");
Configuration config = Db4o.cloneConfiguration();
config.io(ioAdapter);
You'll also find this code in
com.db4o.bench.crud.CrudApplication#prepare()
.
- Change IoBenchmark to call your application by modifying the
runTargetApplication()
method. You also have to exchange the calls to
CrudApplication.logFileName(itemCount)
in prepareDbFile()
and runBenchmark
with the file name of the log containing the I/O access pattern of your application. Using the code from above, this log file will be called "filename.log".
If you want to generate your log by interacting with your application, rather than having IoBenchmark calling it, do as follows: - Use a LoggingIoAdapter in your application
- Interact with your application to create the log
- Remove the stage 1 from IoBenchmark and make it start in stage 2 with your log.
If you are using your own application to generate the I/O log file, check out the IO Log File Statistics section further down.