DynamoRIO
Tracing a Subset of Execution

While the cache simulator supports skipping references, for large applications the overhead of the tracing itself is too high to conveniently trace the entire execution. There are several methods of tracing only during a desired window of execution.

The -trace_after_instrs option delays tracing by the specified number of dynamic instruction executions. This can be used to skip initialization and arrive at the desired starting point. The trace's length can be limited in several ways:

  • The -trace_for_instrs option stops tracing after the specified number of dynamic instrutions in the current window (since the last -retrace_every_instrs trigger, if set).
  • The -retrace_every_instrs option augments -p -trace_for_instrs by executing its specified instruction count without tracing and then re-enabling tracing for -trace_for_instrs again, resulting in tracing windows repeated at regular intervals throughout the execution. There are two options for how these windows are stored for offline traces. If the -split_windows option is set (which is the default), each window produces a separate set of output files inside a window.NNNN subdirectory. Post-processing by default targets the first window; the others must be explicitly passed to separate post-processing invocations. If -no_split_windows is set, a single trace is created with dynamorio::drmemtrace::TRACE_MARKER_TYPE_WINDOW_ID markers (see Other Records) identifying the trace window transitions.
  • The -max_global_trace_refs option causes the recording of trace data to cease once the specified threshold is exceeded by the sum of all trace references across all threads. One trace reference entry equals one recorded address, but due to post-processing expansion a final offline line trace will be larger. Once recording ceases, the application will continue to run. Threads that are newly created after the threshold is reached will not appear in the trace.
  • The -exit_after_tracing option similarly specifies a global trace reference count, but once it is exceeded, the process is terminated.
  • The -max_trace_size option sets a cap on the number of bytes written by each thread. This is a per-thread limit, and if one thread hits the limit it does not affect the trace recoding of other threads.
  • The -L0_filter_until_instrs option collects a filtered trace before transitioning to a full trace. It is compatible with the tracing options listed above. The filter trace and full trace are stored in a single file separated by a dynamorio::drmemtrace::TRACE_MARKER_TYPE_FILTER_ENDPOINT marker. When used with windows (i.e., -retrace_every_instrs), each window contains a filter trace and a full trace. The dynamorio::drmemtrace::TRACE_MARKER_TYPE_WINDOW_ID markers indicate start of filtered records.

If the application can be modified, it can be linked with the drcachesim tracer and use DynamoRIO's start/stop API routines dr_app_setup_and_start() and dr_app_stop_and_cleanup() to delimit the desired trace region. As an example, see our burst_static test application.