The Driver Context

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.

Scope of the Driver Context

The driver obtains it's driver context by calling DriverContext.getContext(). 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.

The Driver Context functionality 

Obtaining Information about the Run

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.

Obtaining Common Infrastructure

Commonly, a driver will get access to certain infrastructure through the following DriverContext methods:

Other Driver Context Functionality

The driver context also helps you obtain configuration information, record times for manual timings, and allow you to collect miscellaneous statistics beyond what is provided by the Faban driver framework. Please click the respective topics for discussions on each of them.