CSI Guide
← Prev Next →

Running CSI


Coverage Optimization

csi-cc can optimize its statement and call-site coverage instrumentation. It also supports various levels of optimization, trading off compilation time for a reduction in the number of probed locations. This page describes the levels of coverage optimization currently available in csi-cc.

To specify the level of coverage optimization, use the flag -csi-opt=<arg>. arg can be any of 0, 1, 2, or 3. For example, to compile for call-site coverage instrumentation optimized at level 1, use the following command:
csi-cc --trace=$CSI_DIR/schemas/cc.schema -csi-opt=1 <input file>
Optimization level 2 has two variants, based on the -opt-style flag. Specifically, -opt-style=simple will use a cheaper dominator-based approximation, while -opt-style=local-prepass (the default) will compute a locally-optimal approximation of optimal coverage probe placement.
Optimization level 3 also has two variants, based on the -opt-style flag. Specifically, -opt-style=gams (the default) will use the older optimization style built with the GAMS modeling system, while -opt-style=lemon will use the newer and more efficient optimization techniques based on Set Covering, per the 2023 INFORMS JOC article. The following table specifies the effect of each level of optimization.

CC BBC
-csi-opt=0 All call sites are instrumented. All basic blocks are instrumented.
-csi-opt=1 One call site is instrumented per basic block. Same as level 2.
-csi-opt=2
-opt-style=simple
A simple dominator-based approximation further reduces the number of call sites that need to be probed. A simple dominator-based approximation further reduces the number of blocks that need to be probed to obtain full statement coverage.
-csi-opt=2 A more expensive locally-optimal approximation to the minimal number of probes necessary to obtain full call-site coverage. A more expensive locally-optimal approximation to the minimal number of probes necessary to obtain full statement coverage.
-csi-opt=3 Fully-optimal call-site coverage instrumentation. Requires that the optimization framework GAMS be installed on your system. Fully-optimal statement coverage instrumentation. Requires that the optimization framework GAMS be installed on your system.
-csi-opt=3
-opt-style=lemon
Fully-optimal call-site coverage instrumentation. Requires that the C++ optimization and graph library LEMON and the GUROBI Optimizer be installed on your system. Fully-optimal statement coverage instrumentation. Requires that the C++ optimization and graph library LEMON and the GUROBI Optimizer be installed on your system.

Thus, the results in the ASE 2016 paper [1] are gathered as follows:

Statement coverage [No optimization]: csi-cc --trace=$CSI_DIR/schemas/bb.schema -csi-opt=0
Statement coverage [Dominator approximation]: csi-cc --trace=$CSI_DIR/schemas/bb.schema -csi-opt=2 -opt-style=simple
Statement coverage [Locally optimal]: csi-cc --trace=$CSI_DIR/schemas/bb.schema -csi-opt=2

Call-site coverage [No optimization]: csi-cc --trace=$CSI_DIR/schemas/cc.schema -csi-opt=1
Call-site coverage [Dominator approximation]: csi-cc --trace=$CSI_DIR/schemas/cc.schema -csi-opt=2 -opt-style=simple
Call-site coverage [Locally optimal]: csi-cc --trace=$CSI_DIR/schemas/cc.schema -csi-opt=2

The results in the 2023 INFORMS JOC paper are gathered as follows:

Statement coverage [Netflow]: csi-cc --trace=$CSI_DIR/schemas/bb.schema -csi-opt=3 -opt-style=gams
Statement coverage [Set-Cover]: csi-cc --trace=$CSI_DIR/schemas/bb.schema -csi-opt=3 -opt-style=lemon

Call-site coverage [Netflow]: csi-cc --trace=$CSI_DIR/schemas/cc.schema -csi-opt=3 -opt-style=gams
Call-site coverage [Set-Cover]: csi-cc --trace=$CSI_DIR/schemas/cc.schema -csi-opt=3 -opt-style=lemon

Those gathering detailed performance experiments for a fully-optimal solver may find the flag -log-stats useful. For example, for stats shown in the 2023 INFORMS JOC paper using the set-covering solver for basic-block coverage, the command would be
csi-cc --trace=bb.schema -csi-opt=3 -opt-style=lemon -log-stats

Finally, the flag -complete-exe will cause CSI to optimize instrumentation such that full coverage data is only guaranteed under the assumption that the program always terminates normally (i.e., by returning from the main function). This facilitates more efficient instrumentation, but means that crashing executions may result in incomplete coverage data. By default, csi-cc optimizes instrumentation pessimistically assuming that the program could crash at any statement.


← Prev Next →