Byteman: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
=External=
* http://byteman.jboss.org
* Using Byteman to troubleshoot Java issues https://access.redhat.com/solutions/31283
=Internal=
=Internal=


* [[ASM]]
* [[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>

Latest revision as of 21:15, 12 July 2018

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