i#3995: tracing windows at irregular instruction intervals
Currently we can only perform window-tracing at regular intervals on pre-compiled binaries using the -trace_after_instrs, -trace_for_instrs, -retrace_every_instrs options. Sometimes it's useful to trace windows of different sizes at irregular instruction intervals (e.g., for tracing simpoints).
We do so introducing a new option:
-trace_instr_intervals_file path/to/instr/intervals.csv
which takes a CSV file where every line has <start,duration> pairs representing intervals in terms of number of instructions.
The implementation relies on the same window-tracing mechanism
used by -trace_after_instrs, -trace_for_instrs, -retrace_every_instrs.
We add a level of indirection to obtain the values of these options through
the get_trace_after_instrs_value(), get_trace_for_instrs_value(), and
get_retrace_every_instrs_value() functions. This allows us to change the
returned value of these options depending on the window we are tracing at
that point. We do so using two global, read-only vectors containing the
to-trace/to-not-trace number of instructions, and an atomic (also global)
index that we increment every time we finish tracing a window to go to the
next one in the two vectors.
We add a new end-to-end test: tool.drcachesim.irregular-windows-simple.
Issue #3995
Fail to build on windows noted. Won't change the logic. Will fix.