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.
-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:
-trace_for_instrsoption stops tracing after the specified number of dynamic instrutions in the current window (since the last
-retrace_every_instrstrigger, if set).
-retrace_every_instrsoption augments -p -trace_for_instrs by executing its specified instruction count without tracing and then re-enabling tracing for
-trace_for_instrsagain, 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_windowsoption 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_windowsis set, a single trace is created with dynamorio::drmemtrace::TRACE_MARKER_TYPE_WINDOW_ID markers (see Other Records) identifying the trace window transitions.
-max_global_trace_refsoption 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.
-exit_after_tracingoption similarly specifies a global trace reference count, but once it is exceeded, the process is terminated.
-max_trace_sizeoption 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.
-L0_filter_until_instrsoption 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.