Patent ID: 8527944

Claim:
A method, implemented in an electronic data processing system, for profiling a native method call, comprising the steps of: generating a profiling template copy from a generic profiling template for profiling the native method call, in response to a native method call-associated event, the profiling template copy comprises an epilog template copy for profiling after the native method call is completed; filling information required for profiling the native method call in corresponding locations in the profiling template copy; and changing a code execution flow to execute the profiling template copy replacing a return address of the native method call with an address of the epilog template copy before executing the native method call, so that the epilog template copy is executed after the native method call is completed; and using the epilog template copy for performing the steps of (i) executing an epilog profiling for the native method call and (ii) restoring the return address of the native method call to return to the calling method which calls the native method after executing the epilog template copy.