A method, an apparatus, and a computer program product in a data
processing system are presented for using hardware assistance for
gathering performance information that significantly reduces the overhead
in gathering such information. Performance indicators are associated with
instructions or memory locations, and processing of the performance
indicators enables counting of events associated with execution of those
instructions or events associated with accesses to those memory
locations. The performance information that has been dynamically gathered
from the assisting hardware is available to the software application
during runtime in order to autonomically affect the behavior of the
software application, particularly to enhance its performance. For
example, the counted events may be used to autonomically improve the
performance of the execution of an application by relocating code
segments and data areas.