mchr3k / org.intrace

Java tracing agent and live trace client
http://mchr3k.github.com/org.intrace/
73 stars 18 forks source link

method-level tracing to lower overhead #41

Closed eostermueller closed 8 years ago

eostermueller commented 8 years ago

This pull request adds the enhancement for issue InTrace #36 .

It allows end users to trace individual methods instead of just all methods for a single class. For example, wuqiSpank uses intrace to capture a few individual methods from JDBC classes, but 100s of methods are invoked (and traced) that provide no tracing benefit. This enhancement provides a new method specifier syntax so you can capture (and incur the overhead of) only the methods you care about, and ignore the rest.

Run "ant example2" , which runs perpetually...you'll have to kill it Ctrl+c done. This class's startup banner provides an example of the syntax to specify individual methods.

You can find a rough overview of the java signature details here: http://journals.ecs.soton.ac.uk/java/tutorial/native1.1/implementing/method.html

...or you can use "javap -s" to show the signature.

...or you can turnon InTrace "Verbose Mode" prior to adding the package/class name. For example, I turned on verbose mode than traced "org.intracetest.agent.ArgumentTypes" ...and then the DEBUG will show you required syntax for all methods in the specified class, as follows:

[13:00:56.792]:[19]:DEBUG: method signature: org.intracetest.agent.ArgumentTypes#boolArrayArrayArg([[Z)V

....or you can look at the method-level javadoc I have added to this class:

https://github.com/eostermueller/org.intrace/blob/issue36/org.intrace/testsrc/org/intracetest/agent/ArgumentTypes.java

--Erik

eostermueller commented 8 years ago

Here is a better link to document Java Type Signatures, the basis for new InTrace syntax used to identify methods to trace:

http://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/types.html#wp276

mchr3k commented 8 years ago

Thanks for the contribution :)