Information Technology Reference
In-Depth Information
Table 4. Slow-down incurred by GNU GCC profiling
Test
No profiling
With profiling
% Slow Down
Numeric Sort
812.32
498.2
38.67
String Sort
103.24
76.499
25.90
Bitfield
4.35E+08
1.65E+08
62.11
FP Emulation
73.76
52.96
28.20
Fourier
15366
15245
0.79
Assignment
24.292
9.77
59.78
Huffman
1412.7
1088.7
22.93
Neural Net
18.091
12.734
29.61
LU Decomp
909.76
421.48
53.67
enable profiling on selected compilation units,
thereby minimizing instrumentation costs.
This type of code instrumentation is termed
static because the code is modified before execu-
tion of the program (Figure 2, label C). COTS
compiler-based instrumentation for profiling is
generally limited to function calls and iteration
counts. Another more powerful form of static
binary instrumentation involves the use of a set
of libraries and APIs that enable users to quickly
write applications that perform binary rewriting
(Hunt & Brubacher, 1999; Larus & Schnarr,
1995; Srivastava & Eustace, 1994; Romer, et al.,
1997; Hollingsworth, Miller , & Cargille, 1994).
The following capabilities are typical of binary
rewriting libraries:
EEL code “snippets” encapsulate of pieces
of code that can be inserted into existing binary
code. They are either written directly in assembly
language (which makes the instrumentation ma-
chine dependent) or written using a higher-level
language that is compiled into assembly. To graft
snippet code into existing code, each snippet
identifies registers used in the snippet that must
be assigned to unused registers.
dynamic binary-code instrumentation
An alternative to static binary instrumentation
is dynamic instrumentation. Dynamic instru-
mentation, implemented as Just-in Time (JIT)
compilation, is performed after a program has
been loaded into memory and immediately
prior to execution (Figure 2, label D). Dynamic
instrumentation has the advantage that profiling
functionality can be selectively added or removed
from the program without the need to recompile:
Trace functionality is only present when needed.
Moreover, dynamic instrumentation can be ap-
plied reactively, for example, in response to some
event in the system, such as processor slow down.
Dynamic instrumentation is particularly useful for
facilitating conditional breakpoints in code, for
example, Buck and Hollingsworth (2000) show
that this approach is 600 times more ef ficient than
conventional trap-based debug breakpoints.
Redirection of function calls and insertion
of trampoline functions that execute the
originally called function;
Insertion of additional code and data; and
Control and data-flow analysis to guide
instrumentation.
The following code illustrates the use of con-
trol-flow analysis and insertion of additional code
through the Editing Executable Library (EEL)
(Larus & Schnarr, 1995), machine-independent,
executable editing API: (Box 5)
Search WWH ::




Custom Search