110 likes | 325 Views
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. What is Etch?. Binary rewriting engine to measure and optimize x86/Win32 applications API for controlling rewrite process
E N D
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
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
Basic Concepts • A program • one executable, several DLLs • A tool • instrumentation routines • runtime routines • An etched program • transformed program that includes tool runtime routines.
Etch Engine Instrumentation Code Etching a Binary on NT Original Exe and DLLs Instrumented/Optimized Exe and DLLs Analysis Code
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
Instruction Counting Runtime // instruction_histo is allocated at run-time int *instruction_histo; void InstReference(DWORD pc) { instruction_histo[pc]++; } Analysis Code
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 A Few Applications
Etch Demo Etch. Copyright 1996,1997 University of Washington
Related Work • Pixie • Epoxie • EEL • ATOM • TracePoint, Purify, NuMega
ETCH HIPROF 0 500 1000 1500 2000 2500 Seconds Instrumentation Time Rewriting Time for CGPROF/Winword 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
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 etch-info@cs.washington.edu