The DriverContext defines the driver's view of the framework it is running in. It allows the driver to know about the benchmark and thread it is running in, obtain configuration information and supporting infrastructure such as the random value generator and the logger, demarcate the critical section of an operation, and much more. It is the first place to obtain any information about the benchmark or the run and a factory for many other benchmark facilities. Click here to go to the DriverContext javadoc references.
The driver obtains it's driver context by
This is typically done in the driver's constructor. Each thread or
simulated user has it's own instance of the DriverContext so access to
the DriverContext will never be synchronized or a source of contention.
A driver context should also never be shared among threads, i.e.
assigned to any static variable.
Many of the methods in the DriverContext are used for obtaining information about the current run. These can be used for generating the user id, collect stats, etc. Below are the common methods being used, but by far not an exclusive list. To obtain the whole list of DriverContext methods, please refer to the DriverContext javadoc pages.