Replay

Umpire provides a lightweight replay capability that can be used to investigate performance of particular allocation patterns and reproduce bugs.

Input Example

When replay is enabled, Umpire captures replay events and writes them as JSON-formatted lines into a .stats file. This file can be used as input to the replay application (available under the bin directory), which will recreate the events that occurred as part of the run that generated the log.

The file tut_replay.cpp makes a umpire::strategy::QuickPool:

  auto allocator = rm.getAllocator("HOST");
  auto pool = rm.makeAllocator<umpire::strategy::QuickPool>("pool", allocator);

This allocator is used to perform some randomly sized allocations, and later free them:

  std::generate(allocations.begin(), allocations.end(), [&]() { return pool.allocate(random_number()); });
  for (auto& ptr : allocations)
    pool.deallocate(ptr);

Running the Example

Running this program:

UMPIRE_REPLAY="On" ./bin/examples/tutorial/tut_replay

will write Umpire replay events to a file with a name like umpire.<pid>.<uid>.stats in the current directory (or in the directory specified by UMPIRE_OUTPUT_DIR). This file contains JSON formatted lines.

Replaying the session

Loading this .stats file with the replay program will replay this sequence of umpire::Allocator creation, allocations, and deallocations:

./bin/replay -i umpire.<pid>.<uid>.stats