Replaying Pinballs with the Replayer
Replaying is the action of taking a recording (in pinball format) and reconstructing the same execution flow. This happens in the replayer. It replay the recorded region and allow for running the analysis tools the same way as can be used with applications.
The replayer guarantees a deterministic reconstruction of the recorded region for both single-threaded and multi-threaded workloads. It eliminates run to run variations that comes from ASLR (address space layout randomizations), time based randomizations, thread order and instructions with non-deterministic behavior like RDTSC.
On Linux, the replayer tries to reserve the captured memory regions in their original locations. This allow for faster replaying. When it fails to reserve the same memory regions, it reverts to using address translation.
% sde -mix -replay -replay:basename pinballs/myapp \
-p -reserve-memory -p pinballs/myapp.address -- <path-to-kit>/intel64/nullapp
In this example we run mix analysis on a recording of myapp. This is done on Linux with reserve memory option. Alternatively, people can use the address translation mode.
% sde -mix -replay -replay:basename pinballs/myapp \
-replay:addr_trans -- <path-to-kit>/intel64/nullapp
Intel® SDE provides a shortcut for replaying. Intel® Pin requires an application to run. In the replay, Intel® SDE loads the recorded memory regions immediately at the start of the run and follow the execution according to the recorded initial state.
Since Intel® Pin must be run with application to run, and it cannot switch applications, the user needs to specify if the recorded application was a 64 bits or a 32 bits application (as can be seen in the example below).
% sde -mix -pinlit2-replay64 pinballs/myapp
Capture on One Machine Replay Everywhere
The pinball recording capture the execution flow at the instruction level, and skips the activity in the kernel (ring0). This means that people can capture the workload on one machine and replay it on different machines. This is very useful when the application requires license, special devices (like GPU), or when the machine is a critical resource with low availability.
Intel® SDE replayer also allows you to replay on different OS. This means log on Linux and replay on Windows or vice versa.
Replaying CPU Definition
As can be seen from the above examples, when running the replayer, there is no need to specify the chip knob which was used in the logging phase. The recording captured the behavior of the CPUID instruction as it was executed at the logging phase.
This means that you cannot replay a recording with a different CPU and check the impact of this change. Intel® SDE replayer purpose is to reconstruct the same execution path as was recorded.
Replaying Standard Output
Intel® SDE replayer skips all the system calls and inject their side effects as recorded in the pinball. However, it is very useful to be able to get the output of the application that happen during the logging inside the captured region. Intel® SDE default behavior is to replay the standard output when the recording what done on Linux and the replay is also in Linux. You can turn off this capability by using the knob -replay:playout 0.
Using The Controller
Intel® SDE replayer is not subject to the controller, as it needs to run the entire recording. But when running the replayer with analysis tool like mix, the analysis tool is subject to the controller like when running directly on workloads.
% sde -mix -pinlit2-replay64 pinballs/myapp -control start:ssc:1234,stop:icount:100000
In this example the mix output file will contains only the data collected from the start event to the stop event. The replay will continue until the end of the recording. You can tell the controller to end the replay at the stop event with the -early-out knob.
Relogging
Intel® SDE replayer can launch any analysis tool during the replay. Using the logger to capture a new recording during replay is called relog. It is very useful to capture the entire workload, run analysis tools on the recorded pinball and then relog a smaller portion of the records pinball with the exact region of interest.
% sde -pinlit2-replay64 pinballs/myapp -log -log:basename pinball/myroi \
-control start:address:foo:count5,stop:icount:10000000
In this example, the user relog a region after the 5th invocation of the function foo.
% sde -pinlit2-replay64 pinballs/myapp -log -log:mt -log:basename pinball/myroi \
-log:focus-thread 4 -control start:icount:10000:tid4,stop:icount:100000:tid4
In this example, the user found that thread number 4 is the most interesting to capture and it is using the focus-thread and the controller tidN option to create a new recording.
The Replayer Knobs
The replayer options have the ‘replay:’ prefix.
- -replay
Activate the logger [default 0]
- -replay:addr_trans
Replayer: Relocate address ranges and translate addresses [default 0]
- -replay:addr_trans_hash_size
Replayer: Set number of buckets in address translation hash table [default 262144]
- -replay:app_debug
Replayer: Enable application debug [default 0]
- -replay:basename
Replayer: name of the log files [default log]
- -replay:exit_on_syscall
Replayer: exit thread on seeing a system call (Works only with ‘-replay:injection 0’ ) [default 0]
- -replay:forced_exit
Replayer: exit thread on reaching logged instruction count [default 1]
- -replay:image_ops
Replayer: Replay image load and unload callbacks [default 1]
- -replay:injection
Replayer: Instrument for register/memory injection and thread synchronization [default 1]
- -replay:pause
Replayer: Pause the replay before first instruction until debugger is attached [default 0]
- -replay:pid
Replayer: Use PID for naming the message file [default 0]
- -replay:playout
Replayer: Replay writes to stdout and stderr (Linux only) [default 1]
- -replay:result
Flag if to create replay result file. [default 0]
- -replay:resultfile
Base name of the replay result file. Any directory name embedded must exist. The base name of the pinball is used as the default
- -replay:strace
Replayer: Generate a system call trace [default 0]