skip to main content
article

Pin: building customized program analysis tools with dynamic instrumentation

Published: 12 June 2005 Publication History

Abstract

Robust and powerful software instrumentation tools are essential for program analysis tasks such as profiling, performance evaluation, and bug detection. To meet this need, we have developed a new instrumentation system called Pin. Our goals are to provide easy-to-use, portable, transparent, and efficient instrumentation. Instrumentation tools (called Pintools) are written in C/C++ using Pin's rich API. Pin follows the model of ATOM, allowing the tool writer to analyze an application at the instruction level without the need for detailed knowledge of the underlying instruction set. The API is designed to be architecture independent whenever possible, making Pintools source compatible across different architectures. However, a Pintool can access architecture-specific details when necessary. Instrumentation with Pin is mostly transparent as the application and Pintool observe the application's original, uninstrumented behavior. Pin uses dynamic compilation to instrument executables while they are running. For efficiency, Pin uses several techniques, including inlining, register re-allocation, liveness analysis, and instruction scheduling to optimize instrumentation. This fully automated approach delivers significantly better instrumentation performance than similar tools. For example, Pin is 3.3x faster than Valgrind and 2x faster than DynamoRIO for basic-block counting. To illustrate Pin's versatility, we describe two Pintools in daily use to analyze production software. Pin is publicly available for Linux platforms on four architectures: IA32 (32-bit x86), EM64T (64-bit x86), Itanium®, and ARM. In the ten months since Pin 2 was released in July 2004, there have been over 3000 downloads from its website.

References

[1]
AMBER home page. https://amber.scripps.edu/.]]
[2]
Fluent home page. https://www.fluent.com/.]]
[3]
LS-DYNA home page. https://www.lstc.com/.]]
[4]
RenderMan home page. https://RenderMan.pixar.com/.]]
[5]
A.-R. Adl-Tabatabai, J. Bharadwaj, D.-Y. Chen, A. Ghuloum, V. Menon, B. Murphy, M. Serrano, and T. Shpeisman. The StarJIT compiler: A dynamic compiler for managed runtime environments. Intel Technology Journal, 7(1):19--31, Feb 2003.]]
[6]
D. L. Bruening. Efficient, Transparent, and Comprehensive Runtime Code Manipulation. PhD thesis, M.I.T. (https://www.cag.lcs.mit.edu/dynamorio/), September 2004.]]
[7]
B. R. Buck and J. Hollingsworth. An api for runtime code patching. Journal of High Performance Computing Applications, 14(4):317--329, 2000.]]
[8]
M. G. Burke, J.-D. Choi, S. Fink, D. Grove, M. Hind, V. Sarkar, M. J. Serrano, V. C. Sreedhar, H. Srinivasan, and J. Whaley. The Jalapeno dynamic optimizing compiler for java. In ACM Java Grande Conference, pages 129--141, June 1999.]]
[9]
B. M. Cantrill, M. W. Shapiro, and A. H. Leventhal. Dynamic instrumentation of production systems. In Proceedings of the 6th Symposium on Operating Systems Design and Implementation, 2004.]]
[10]
K.D. Cooper, M.W. Hall, and K. Kennedy. A methodology for procedure cloning. Computer Languages, 19(2), April 1993.]]
[11]
J. L. Henning. SPEC CPU2000: measuring cpu performance in the new millennium. IEEE Computer, 33(7):28--35, July 2000.]]
[12]
Intel. Pin User Manual. https://rogue.colorado.edu/Pin.]]
[13]
Intel. Intel Itanium Architecture Software Developer's Manual Vols 1-4, Oct. 2002.]]
[14]
Intel. IA-32 Intel Architecture Software Developer's Manual Vols 1-3, 2003.]]
[15]
Intel. Intel Extended Memory 64 Technology Software Developer's Guide Vols 1-2, 2004.]]
[16]
Intel. Intel PXA27x Processor Family Developer's Manual, April 2004.]]
[17]
H.-S. Kim and J. Smith. Hardware support for control transfers in code caches. In Proceedings of the 36th Annual ACM/IEEE International Symposium on Microarchitecture, Dec 2003.]]
[18]
J. Larus and E. Schnarr. EEL: Machine-independent executable editing. In Proceedings of the ACM SIGPLAN 95 Conference on Programming Language Design and Implementation, pages 291--300, June 1995.]]
[19]
P. Geoffrey Lowney, Stefan M. Freudenberger, Thomas J. Karzes, W. D. Lichtenstein, Robert P. Nix, John S. O'Donnell, and John C. Ruttenberg. The Multiflow Trace Scheduling compiler. The Journal of Supercomputing, 7(1-2):51--142, 1993.]]
[20]
Chi-Keung Luk, Robert Muth, Harish Patil, Robert Cohn, and Geoff Lowney. Ispike: A Post-link Optimizer for the Intel Itanium Architecture. In Proceedings of the 2nd Conference on Code Generation and Optimization, pages 15--26, 2004.]]
[21]
J. Maebe, M. Ronsse, and K. De Bosschere. Diota: Dynamic instrumentation, optimization and transformation of applications. In Compendium of Workshops and Tutorials held in conjunction with PACT'02, 2002.]]
[22]
N. Nethercote and J. Seward. Valgrind: A program supervision framework. In Proceedings of the 3rd Workshop on Runtime Verification. https://valgrind.kde.org/, 2003.]]
[23]
H. Patil, R. Cohn, M. Charney, R. Kapoor, A. Sun, and A. Karunanidhi. Pinpointing representative portions of large intel itanium progams with dynamic instrumentation. In Proceedings of the 37th Annual ACM/IEEE International Symposium on Microarchitecture, Dec 2004.]]
[24]
M. Poletto and V. Sarkar. Linear scan register allocation. ACM Transactions. on Programming Languages and Systems, 21(5):895--913, Sept 1999.]]
[25]
T. Romer, G. Voelker, D. Lee, A. Wolman, W. Wong, H. Levy, B. Bershad, and B. Chen. Instrumentation and optimization of win32/intel executables using Etch. In Proceedings of the USENIX Windows NT Workshop, pages 1--7, August 1997.]]
[26]
H. Saito, G. Gaertner, W. Jones, R. Eigenmann, H. Iwashita, R. Liberman, M. van Waveren, and B. Whitney. Large system performance of spec omp2001 benchmarks. In Proceedings of the 2002 Workship on OpenMP: Experiences and Implementation, 2002.]]
[27]
K. Scott, N. Kumar, S. Velusamy, B. Childers, J. Davidson, and M. L. Soffa. Reconfigurable and retargetable software dynamic translation. In Proceedings of the 1st Conference on Code Generation and Optimization, pages 36--47, 2003.]]
[28]
T. Sherwood, E. Perelman, G. Hamerly, and B. Calder. Automatically characterizing large scale program behavior. In Proceedings of the 10th International Conference on Architectural Support for Programming Languages and Operating Systems, Oct 2002.]]
[29]
A. Srivastava, A. Edwards, and H. Vo. Vulcan: Binary transformation in a distributed environment. Technical Report MSR-TR-2001-50, Microsoft Research, April 2001.]]
[30]
A. Srivastava and A. Eustace. Atom: A system for building customized program analysis tools. In Proceedings of the ACM SIGPLAN 94 Conference on Programming Language Design and Implementation, pages 196--205, 1994.]]
[31]
X. Zhang, Z. Wang, N. Gloy, J. B. Chen, and M. D. Smith. System support for automatic profiling and optimization. In Proceedings of the 16th Symposium on Operating System Principles, October 1997.]]

Cited By

View all
  • (2025)Survey of CPU and memory simulators in computer architecture: A comprehensive analysis including compiler integration and emerging technology applicationsSimulation Modelling Practice and Theory10.1016/j.simpat.2024.103032138(103032)Online publication date: Jan-2025
  • (2025)Competitive cost-effective memory access predictor through short-term online SVM and dynamic vocabulariesFuture Generation Computer Systems10.1016/j.future.2024.107592164(107592)Online publication date: Mar-2025
  • (2025)ROPGMN: Effective ROP and variants discovery using dynamic feature and graph matching networkFuture Generation Computer Systems10.1016/j.future.2024.107567164(107567)Online publication date: Mar-2025
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM SIGPLAN Notices
ACM SIGPLAN Notices  Volume 40, Issue 6
Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation
June 2005
325 pages
ISSN:0362-1340
EISSN:1558-1160
DOI:10.1145/1064978
Issue’s Table of Contents
  • cover image ACM Conferences
    PLDI '05: Proceedings of the 2005 ACM SIGPLAN conference on Programming language design and implementation
    June 2005
    338 pages
    ISBN:1595930566
    DOI:10.1145/1065010
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 12 June 2005
Published in SIGPLAN Volume 40, Issue 6

Check for updates

Author Tags

  1. dynamic compilation
  2. instrumentation
  3. program analysis tools

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)566
  • Downloads (Last 6 weeks)77
Reflects downloads up to 27 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2025)Survey of CPU and memory simulators in computer architecture: A comprehensive analysis including compiler integration and emerging technology applicationsSimulation Modelling Practice and Theory10.1016/j.simpat.2024.103032138(103032)Online publication date: Jan-2025
  • (2025)Competitive cost-effective memory access predictor through short-term online SVM and dynamic vocabulariesFuture Generation Computer Systems10.1016/j.future.2024.107592164(107592)Online publication date: Mar-2025
  • (2025)ROPGMN: Effective ROP and variants discovery using dynamic feature and graph matching networkFuture Generation Computer Systems10.1016/j.future.2024.107567164(107567)Online publication date: Mar-2025
  • (2025)AugPersist: Automatically augmenting the persistence of coverage-based greybox fuzzing for persistent softwareComputers & Security10.1016/j.cose.2024.104099148(104099)Online publication date: Jan-2025
  • (2024)CFIEE: An Open-Source Critical Metadata Extraction Tool for RISC-V Hardware-Based CFI SchemesElectronics10.3390/electronics1309168113:9(1681)Online publication date: 26-Apr-2024
  • (2024)Detection Techniques for DBI Environment in WindowsElectronics10.3390/electronics1305087113:5(871)Online publication date: 23-Feb-2024
  • (2024)Revealing the exploitability of heap overflow through PoC analysisCybersecurity10.1186/s42400-024-00244-67:1Online publication date: 18-Jul-2024
  • (2024)Detecting interference between applications and improving the scheduling using malleable application clonesInternational Journal of High Performance Computing Applications10.1177/1094342023122089838:2(108-133)Online publication date: 1-Mar-2024
  • (2024)Understanding Silent Data Corruption in Processors for Mitigating its EffectsACM Transactions on Architecture and Code Optimization10.1145/369082521:4(1-27)Online publication date: 20-Nov-2024
  • (2024)Sparrow ECC: A Lightweight ECC Approach for HBM Refresh Reduction towards Energy-efficient DNN InferenceProceedings of the 29th ACM/IEEE International Symposium on Low Power Electronics and Design10.1145/3665314.3670825(1-6)Online publication date: 5-Aug-2024
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media