Analyzing a programs run-time behavior on a real system is a difficult challenge. Basic
UNIX tools only provide data such as execution time. Conventional profilers, such as gprof, only
give information on how many times a function might be called, or how long a function might
take to execute. Neither of these tools, however, provides insight as to why a particular section
of code takes as long to execute as it does. Modern processors contain multiple execution units,
high-speed caches, and other performance-enhancing features. Obtaining the greatest possible
performance requires following a complicated set of rules during compilation. In an effort to
characterize how real code runs on a real processor, special hardware can be added to monitor
performance. In the case of Intels Pentium processor, the architects added two performance
monitoring counters that can count 38 different events related to processor performance. The
designers provided an interface to allow users to access these counters and measure various
aspects of system performance.
This thesis serves several purposes. First, it is designed to give some background
information about the monitoring hardware found in the Pentium. Second, it is a source of
documentation for both low-level and high-level software developed as part of this thesis work to
provide access to these counters. Finally, it offers insight on how to use this hardware and
software to obtain meaningful results. The rest of this thesis is organized as follows: Chapter 1
provides motivation for this work, as well as describing some related work. Chapter 2 then
describes the performance monitoring hardware found in the Pentium processor. Chapter 3
describes the low-level software and library routines developed to provide user-level access to the
2
hardware. Chapter 4 documents a high-level program, run_p5mon, which gathers data on
program execution. Chapter 5 provides some examples of using this software to monitor various
programs. Finally, Chapter 6 discusses conclusions as well as possible future work.