(PowerPoint 57Kb)

Download Report

Transcript (PowerPoint 57Kb)

Instrumentation and Optimization
of Win32 Executables with Etch
Ted Romer, Geoff Voelker, Dennis Lee, Alec
Wolman, Wayne Wong, Hank Levy, Brian Bershad,
and Brad Chen
Etch. Copyright 1996,1997 University of Washington
7/1/20164/15/97
1
What is Etch?
• Binary rewriting engine to measure and
optimize x86/Win32 applications
• API for controlling rewrite process
• Customizable runtime services
• Tools to instrument and analyze programs
• User interface for running experiments and
optimizing programs
7/1/2016
2
Basic Concepts
• A program
– one executable, several DLLs
• A tool
– instrumentation routines
– runtime routines
• An etched program
– transformed program that includes tool runtime
routines.
7/1/2016
3
Etching a Binary on NT
Original Exe and DLLs
Instrumented/Optimized
Exe and DLLs
Etch Engine
Analysis Code
7/1/2016
Instrumentation
Code
4
Example: Instruction Counting
void
InstrumentInstruction(WhenType when, InstPtr inst, int procNum)
{
void * array[1];
ArgType argt[1];
if (when == Before) {
array[0] = (void*)InstGetPC(inst);
argt[0] = ArgImmed;
InsertCall(”InstReference", 1, array, argt);
}
}
Instrumentation code
7/1/2016
5
Instruction Counting Runtime
// instruction_histo is allocated at run-time
int *instruction_histo;
void
InstReference(DWORD pc)
{
instruction_histo[pc]++;
}
Analysis Code
7/1/2016
6
A Few Applications
•
•
•
•
•
•
•
•
•
•
•
•
7/1/2016
Adobe Photoshop
Borland C
Borland/Intel C
Bomb
Corel Flow
Corel Motion
Corel PhotoPaint
Ghostscript
Ghostview
Lotus Notes/Domino
Lotus Word Pro
Microsoft Visual C++
•
•
•
•
•
•
•
•
•
•
•
•
MS Internet Explorer 3.02
MS Monster Truck Madness
MS Pinball
MS Office
MS Money
MS Schedule+
MS SQL Server
MS Word
Mpegplayer
Netscape 3.01
ParcPlace Visual Works 2.0
su2cor, tomcatv
7
Etch Demo
Etch. Copyright 1996,1997 University of Washington
7/1/20164/15/97
8
Related Work
•
•
•
•
•
7/1/2016
Pixie
Epoxie
EEL
ATOM
TracePoint, Purify, NuMega
9
Instrumentation Time
Rewriting Time for CGPROF/Winword
ETCH
HIPROF
0
500
1000
1500
2000
2500
Seconds
7/1/2016
advapi.dll
bsg32.wll
comctl32.dll
comdlg32.dll
ctl3d32.dll
gdi32.dll
inloader.dll
kernel32.dll
linkinfo.dll
mpr.dll
ms05enu.dll
ms095.dll
msreftlw.wll
mssp232.dll
msvcrt.dll
netapi32.dll
nettrap.dll
netui0.dll
netui1.dll
ntdll.dll
ntlanman.dll
ntshrui.dll
ole32.dll
openenu.dll
pscrptui.dll
rpcltc1.dll
rpcrt4.dll
samlib.dll
shell32.dll
user32.dll
wiahtm32.dll
wininet.dll
winspool.dll
winword.exe
wwintl32.dll
10
Conclusions
• Etch rewriting API makes it easy to
implement new tools.
• Etch rewriting engine is fast.
• Etch is an effective platform for
instrumenting Win32 applications.
For more information:
http://etch.cs.washington.edu
[email protected]
7/1/2016
11