Byteman: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:
* [[javaagent]]
* [[javaagent]]
* [[WildFly#Related|WildFly]]
* [[WildFly#Related|WildFly]]
=Organizatorium=
==Byteman Example==
In clustered.conf:
<pre>
BYTEMAN_HOME=/path/to/byteman-download-3.0.6
...
JAVA_OPTS="$JAVA_OPTS -javaagent:${BYTEMAN_HOME}/lib/byteman.jar=sys:${BYTEMAN_HOME}/lib/byteman.jar,script:/path/to/debug-stat.btm"
</pre>
debug-stat.btm:
<pre>
RULE debug stat getAverageReadTime
CLASS org.infinispan.interceptors.CacheMgmtInterceptor
METHOD getAverageReadTime
AT EXIT
IF TRUE
DO System.out.println("hitTimes.sum(): " + $this.hitTimes.sum() + ", missTimes.sum(): " + $this.missTimes.sum());
ENDRULE
RULE debug stat getAverageWriteTime
CLASS org.infinispan.interceptors.CacheMgmtInterceptor
METHOD getAverageWriteTime
AT EXIT
IF TRUE
DO System.out.println("stores.sum(): " + $this.stores.sum());
ENDRULE
RULE debug stat getAverageRemoveTime
CLASS org.infinispan.interceptors.CacheMgmtInterceptor
METHOD getAverageRemoveTime
AT EXIT
IF TRUE
DO System.out.println("removeTimes.sum(): " + $this.removeTimes.sum());
ENDRULE
</pre>

Revision as of 15:44, 27 October 2016

External

Internal

Organizatorium

Byteman Example

In clustered.conf:

BYTEMAN_HOME=/path/to/byteman-download-3.0.6
...
JAVA_OPTS="$JAVA_OPTS -javaagent:${BYTEMAN_HOME}/lib/byteman.jar=sys:${BYTEMAN_HOME}/lib/byteman.jar,script:/path/to/debug-stat.btm"

debug-stat.btm:

RULE debug stat getAverageReadTime
CLASS org.infinispan.interceptors.CacheMgmtInterceptor
METHOD getAverageReadTime
AT EXIT
IF TRUE
DO System.out.println("hitTimes.sum(): " + $this.hitTimes.sum() + ", missTimes.sum(): " + $this.missTimes.sum());
ENDRULE

RULE debug stat getAverageWriteTime
CLASS org.infinispan.interceptors.CacheMgmtInterceptor
METHOD getAverageWriteTime
AT EXIT
IF TRUE
DO System.out.println("stores.sum(): " + $this.stores.sum());
ENDRULE

RULE debug stat getAverageRemoveTime
CLASS org.infinispan.interceptors.CacheMgmtInterceptor
METHOD getAverageRemoveTime
AT EXIT
IF TRUE
DO System.out.println("removeTimes.sum(): " + $this.removeTimes.sum());
ENDRULE