ReplayΒΆ
Umpire provides a lightweight replay capability that can be used to investigate
performance of particular allocation patterns and reproduce bugs. By running an
executable that uses Umpire with the environment variable UMPIRE_REPLAY
set
to On
, Umpire will print out one line for each of the following events:
umpire::ResourceManager::makeAllocator()
umpire::Allocator::allocate()
umpire::Allocator::deallocate()
The log can be captured and stored as a CSV file, then used as input to the
replay
application (avaible under the bin
directory). The replay
program will read the replay log, and recreate the events that occured as part
of the run that generated the log.
The file tut_replay.cpp
makes a umpire::strategy::DynamicPool
:
auto pool = rm.makeAllocator<umpire::strategy::DynamicPool>(
"pool",
allocator);
This allocator is used to perform some randomly sized allocations, and later free them:
allocations.push_back( pool.allocate(random_number()));
pool.deallocate(ptr);
Running this program with the UMPIRE_REPLAY
environment variable set to
On
will generate the log file found in tut_replay_log.csv. You can see
that this file contains lines for making the umpire::Allocator
:
REPLAY,makeAllocator,umpire::strategy::DynamicPool,true,pool,HOST,0x7fcc98400260
Doing allocations:
REPLAY,allocate,774,0x7fcc98400260,0x116076090
and finally, doing the deallocations:
REPLAY,deallocate,0x116077940,0x7fcc98400260
Loading this file with the replay
program will replay this sequence of
umpire::Allocator
creation, allocations, and deallocations:
./bin/replay ../tutorial/examples/tut_replay_log.csv