Skip to content

Resource Manager

trentmeester edited this page Dec 13, 2011 · 5 revisions

The resource manager is called gRsrcMngr and is of type class RsrcMngr. It is a global object, which is why it has a ‘g’ prefixed. It is created automatically by the framework and is guaranteed to exist before any test assumes control. It is also a singleton; meaning only 1 object of its kind will ever exist for each running instance of tnvme. The main job of the gRsrcMngr is to allocate resources and allow their deallocation when their lifetime has expired. All objects born of the gRsrcMngr have what is called group lifetime. Those resources are guaranteed to exist/live for the entire duration of a group's processing. In other words, after all tests have executed within a group, then and only then, will the framework force the deallocation of all resources born of the gRsrcMngr. The framework simply notifies the gRsrcMngr to initiate the deallocation of every resource.

The gRsrcMngr is meant to be used directly be tests. A test interacts with the gRsrcMngr by calling any of its public methods in any of the classes’ hierarchical infrastructure, including the base classes. For example, a test learns of which objects can be created by investigating method RsrcMngr::AllocObj().

A test may also wish to change the allocation size of all meta data buffers. This is done by first disabling the DUT and then calling MetaRsrc::SetMetaAllocSize() to the newly desired size. The MetaRsrc base class allows retrieving a meta data buffers directly, but this is really meant for a command to access the meta buffers on behalf of a test when a test calls MetaData::AllocMetaBuffer(). Meta data buffers are most often associated with commands and thus interacting with the command is the action of choice to support meta data.

The resource manager provides resources, but certain destructive actions, like disabling the DUT cause sudden lifetime annihilation of resources to occur. Hence there are tightly coupled framework relationships which must be managed. This management, or notifications, occurs via the subject-observer design pattern. And so another base class of the gRsrcMngr is an observer class which observes the gCtrlrConfig for disable actions.

Clone this wiki locally