1. A method in a data processing system for instrumenting a target program comprising routines running in the data processing system, the method comprising the steps of: indicating a routine in the target program as a root routine to profile; identifying a transitive closure of routines called by the root routine; and adding profiling code into at least one routine in the transitive closure of routines.