System and method for instrumenting application class files with correlation information to the instrumentation
First Claim
1. A method for supporting user specified instrumentation by modifying class files comprising:
- instrumenting a routine, wherein the instrumented routine is in a class;
injecting a first trace hook in the instrumented routine, wherein the first trace hook identifies the instrumented routine by an identification code and the first trace hook is written to a record including the routine'"'"'s identification code; and
modifying a class file for the class, wherein the modification identifies the instrumented routine, by updating a static initializer in the class to output a second trace hook, wherein the second trace hook identifies the instrumented routine.
1 Assignment
0 Petitions
Accused Products
Abstract
The present invention is directed to a system and method for modifying a class file for the purpose of instrumenting without requiring separate files to correlate the instrumentation. A class file is instrumented with hooks. Each hook is injected in a method at a critical point in the code for tracking path flow, such as where the method will be entered or exited. Each hook includes an identifier to identify the method in which it is injected. Rather than using the method'"'"'s name, hooks use unique major and minor codes to identify the method. Static initializers are declared for the class to output other hooks identifying the methods being instrumented. When a class is loaded, the static initializers are executed and hooks identifying the method name and the major and minor codes for each instrumented method are output to, for instance, a trace record. Then, when a method is entered or exited, the hooks identifying the entry or exit are also outputted to a trace record. When postprocessing the trace records, class and instrumentation correlation information is available for merging from trace records in the trace stream.
-
Citations
15 Claims
-
1. A method for supporting user specified instrumentation by modifying class files comprising:
-
instrumenting a routine, wherein the instrumented routine is in a class;
injecting a first trace hook in the instrumented routine, wherein the first trace hook identifies the instrumented routine by an identification code and the first trace hook is written to a record including the routine'"'"'s identification code; and
modifying a class file for the class, wherein the modification identifies the instrumented routine, by updating a static initializer in the class to output a second trace hook, wherein the second trace hook identifies the instrumented routine. - View Dependent Claims (2, 3)
post processing the trace stream, wherein a profiling information report is generated; and
post processing the trace stream, wherein a profiling information report is generated; and
merging the first and second trace records with the profiling information report, wherein routines in the report are identified by routine name.
-
-
4. A method for supporting user specified instrumentation by modifying class files comprising:
-
opening a class file;
executing a static initializer, wherein the static initializer contains routine identity mapping information; and
writing a record which includes the routine identity mapping information, wherein the static initializer is a first static initializer containing first routine mapping information and the record is a first record, the method further includes;
executing a second static initializer, wherein the second static initializer contains second routine identity mapping information; and
writing a second record which includes the second routine identity mapping information. - View Dependent Claims (5, 6, 7)
collecting the first and second trace records;
post processing the trace stream, wherein a profiling information report is generated; and
merging the first and second trace records with the profiling information report, wherein routines in the report are identified by routine name.
-
-
8. A method for supporting user specified instrumentation by modifying class files comprising:
-
identifying a routine in a class to be instrumented by routine name;
instrumenting the routine in the class;
modifying a class file for the class to include mapping information between routine instrumentation identifier and routine name identifier for the instrumented routine;
opening the class file;
writing a record, wherein the record comprises the mapping information between the routine instrumentation identifier and the routine name identifier for the instrumented routine;
executing the routine; and
writing a trace record, wherein the trace record describes an aspect of the execution of the routine. - View Dependent Claims (9, 10)
postprocessing the record and the trace record; and
generating a report, wherein the report identifies the routine by the routine name identifier.
-
-
11. A data processing system for supporting user specified instrumentation by modifying class files comprising:
-
identifying means for identifying a routine in a class to be instrumented by routine name;
instrumenting means for instrumenting the routine in the class;
modifying means for modifying a class file for the class to include mapping information between routine instrumentation identifier and routine name identifier for the instrumented routine;
opening means for opening the class file;
writing means for writing a record, wherein the record comprises the mapping information between the routine instrumentation identifier and the routine name identifier for the instrumented routine;
executing means for executing the routine; and
writing means for writing a trace record, wherein the trace record describes an aspect of the execution of the routine. - View Dependent Claims (12, 13)
postprocessing means for postprocessing the record and the trace record; and
generating means for generating a report, wherein the report identifies the routine by the routine name identifier.
-
-
14. A computer program product for supporting user specified instrumentation by modifying class files comprising:
-
instruction means for identifying a routine in a class to be instrumented by routine name;
instruction means for instrumenting the routine in the class;
instruction means for modifying a class file for the class to include mapping information between routine instrumentation identifier and routine name identifier for the instrumented routine;
instruction means for opening the class file;
instruction means for writing a record, wherein the record comprises the mapping information between the routine instrumentation identifier and the routine name identifier for the instrumented routine;
instruction means for executing the routine; and
instruction means for writing a trace record, wherein the trace record describes an aspect of the execution of the routine. - View Dependent Claims (15)
-
Specification