<?xml version="1.0" encoding="UTF-8"?>
<page>
  <created-at type="datetime">2009-06-02T08:38:31Z</created-at>
  <description></description>
  <id type="integer">2045</id>
  <name>Home</name>
  <number type="integer">9</number>
  <person-id type="integer">448</person-id>
  <text>= BTrace =

BTrace is a safe, dynamic tracing tool for the Java platform. BTrace can be used to dynamically trace a running Java program (similar to [http://opensolaris.org/os/community/dtrace/ DTrace for OpenSolaris] applications and OS). BTrace dynamically instruments the classes of the target application to inject tracing code (&quot;bytecode tracing&quot;). Tracing code is expressed in Java programming language. There is also integration with DTrace for the OpenSolaris platform.

You can enhance [https://visualvm.dev.java.net/ VisualVM] with the [[BTrace plugin]] to be able to write and deploy BTrace scripts directly from VisualVM.
Alternatively, if you'd prefer you can run BTrace from command line shells as well.

There is also a [http://www.netbeans.org/ NetBeans] plugin that makes it easier to write and deploy BTrace scripts. You can get it [http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=10920 here]. 

== License ==

BTrace is available under [https://visualvm.dev.java.net/legal/gplv2+ce.html GNU Public License v.2 w/Classpath Exception].

== Download ==

Actual BTrace binary realease is available for download from Documents &amp; files link. 

== Maven ==

BTrace binaries are available as Maven artifacts as well. You can get them [http://download.java.net/maven/2/com/sun/tools/btrace/ here]
== User Guide ==

[[UserGuide|BTrace User's Guide]]

== Building from the sources ==

BTrace sources are available from Mercurial repository. After checking out the sources, you can use NetBeans to build BTrace using the [[NetBeans project setup instructions]]. There is also a [[DeveloperGuide|BTrace Developer's Guide]]. 

== Known Issues ==

*JVM crash: We have seen JVM crashes with BTrace. We have fixed few such crashes as well. JVM could crash due to the following reasons:
# BTrace submits invalid .class file to VM (bug in BTrace instrumentor)
# Hotswap bug in HotSpot JVM. 

To enable debugging such scenarios, please turn on the following options in $BTRACE/bin/btrace (or btrace.bat) script. By default, the System properties com.sun.btrace.debug amd com.sun.btrace.dumpClasses are set to false in the scripts. Please change these to true. Also, you may want to add -verify:all option as well - which will force bytecode verification of all loaded classes. When you report a JVM crash with BTrace, please attach/send the following:
# BTrace trace class that caused the crash.
# hs_err_pidXXX log produced by JVM.
# *.class file(s) saved by BTrace setting the com.sun.btrace.dumpClasses option.
# debug output from BTrace by setting the com.sun.btrace.debug option. 

== How to contribute to BTrace? ==

If you like BTrace and want to contribute fixes/features to BTrace, your are always welcome! You (or your company) have to sign the [http://www.sun.com/software/opensource/contributor_agreement.jsp Sun Contributor Agreement]. Then, please join this project as &quot;developer&quot; using your kenai.com id. 

=== BTrace on the web ===
* [http://netbeans.dzone.com/articles/debugging-netbeans-with-visualvm-and-btrace Using VisualVM, BTrace &amp; Good Old Web Search]
* [http://ice09.wordpress.com/2009/07/12/analysing-memory-leaks-with-btrace Analysing Memory Leaks with BTrace]
* [http://www.devwebsphere.com/devwebsphere/2009/06/btrace-for-performance-tuning.html btrace for performance tuning]
* [http://blog.scalablej.com/2009/05/btrace-ultimate-jvm-probe.html BTrace the ultimate JVM probe]
* [http://www.dzone.com/links/socket_monitoring_now_using_btrace.html Socket Monitoring: Now Using BTrace]
* [http://kensipe.blogspot.com/2009/02/btrace-fix-on-mac.html BTrace Fix on the Mac]
* [http://raymondtay.blogspot.com/2008/06/using-btrace-in-java-6.html Using BTrace in Java 6]
* [http://http//blog.igorminar.com/2008/06/btrace-dtrace-for-java.html BTrace == DTrace for Java]
* [http://blogs.sun.com/theaquarium/entry/btrace_showing_promises BTrace showing promises]
* [http://weblogs.java.net/blog/binod/archive/2008/06/sailfin_work_an.html SailFin work and BTrace]
* [http://www.carlobonamico.com/blog/tag/btrace/ Runtime profiling and monitoring Java apps with btrace]

</text>
  <text-as-html>&lt;h1&gt;&lt;a name='BTrace'&gt;&lt;/a&gt; BTrace &lt;/h1&gt;
&lt;p&gt;
BTrace is a safe, dynamic tracing tool for the Java platform. BTrace can be used to dynamically trace a running Java program (similar to &lt;a class='external' href=&quot;http://opensolaris.org/os/community/dtrace/&quot;&gt;DTrace for OpenSolaris&lt;/a&gt; applications and OS). BTrace dynamically instruments the classes of the target application to inject tracing code (&amp;quot;bytecode tracing&amp;quot;). Tracing code is expressed in Java programming language. There is also integration with DTrace for the OpenSolaris platform.

&lt;/p&gt;&lt;p&gt;You can enhance &lt;a class='external' href=&quot;https://visualvm.dev.java.net/&quot;&gt;VisualVM&lt;/a&gt; with the &lt;a href='&lt;?url_for_page BTrace plugin?&gt;' class='internal'&gt;BTrace plugin&lt;/a&gt; to be able to write and deploy BTrace scripts directly from VisualVM.
Alternatively, if you'd prefer you can run BTrace from command line shells as well.

&lt;/p&gt;&lt;p&gt;There is also a &lt;a class='external' href=&quot;http://www.netbeans.org/&quot;&gt;NetBeans&lt;/a&gt; plugin that makes it easier to write and deploy BTrace scripts. You can get it &lt;a class='external' href=&quot;http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=10920&quot;&gt;here&lt;/a&gt;. 

&lt;/p&gt;&lt;h2&gt;&lt;a name='License'&gt;&lt;/a&gt; License &lt;/h2&gt;
&lt;p&gt;
BTrace is available under &lt;a class='external' href=&quot;https://visualvm.dev.java.net/legal/gplv2+ce.html&quot;&gt;GNU Public License v.2 w/Classpath Exception&lt;/a&gt;.

&lt;/p&gt;&lt;h2&gt;&lt;a name='Download'&gt;&lt;/a&gt; Download &lt;/h2&gt;
&lt;p&gt;
Actual BTrace binary realease is available for download from Documents &amp;amp; files link. 

&lt;/p&gt;&lt;h2&gt;&lt;a name='Maven'&gt;&lt;/a&gt; Maven &lt;/h2&gt;
&lt;p&gt;
BTrace binaries are available as Maven artifacts as well. You can get them &lt;a class='external' href=&quot;http://download.java.net/maven/2/com/sun/tools/btrace/&quot;&gt;here&lt;/a&gt;&lt;/p&gt;&lt;h2&gt;&lt;a name='User_Guide'&gt;&lt;/a&gt; User Guide &lt;/h2&gt;
&lt;p&gt;&lt;a href='&lt;?url_for_page UserGuide?&gt;' class='internal'&gt;BTrace User's Guide&lt;/a&gt;

&lt;/p&gt;&lt;h2&gt;&lt;a name='Building_from_the_sources'&gt;&lt;/a&gt; Building from the sources &lt;/h2&gt;
&lt;p&gt;
BTrace sources are available from Mercurial repository. After checking out the sources, you can use NetBeans to build BTrace using the &lt;a href='&lt;?url_for_page NetBeans project setup instructions?&gt;' class='internal'&gt;NetBeans project setup instructions&lt;/a&gt;. There is also a &lt;a href='&lt;?url_for_page DeveloperGuide?&gt;' class='internal'&gt;BTrace Developer's Guide&lt;/a&gt;. 

&lt;/p&gt;&lt;h2&gt;&lt;a name='Known_Issues'&gt;&lt;/a&gt; Known Issues &lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;JVM crash: We have seen JVM crashes with BTrace. We have fixed few such crashes as well. JVM could crash due to the following reasons:
&lt;/li&gt;&lt;/ul&gt;&lt;ol&gt;&lt;li&gt; BTrace submits invalid .class file to VM (bug in BTrace instrumentor)
&lt;/li&gt;&lt;li&gt; Hotswap bug in HotSpot JVM. 
&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;
To enable debugging such scenarios, please turn on the following options in $BTRACE/bin/btrace (or btrace.bat) script. By default, the System properties com.sun.btrace.debug amd com.sun.btrace.dumpClasses are set to false in the scripts. Please change these to true. Also, you may want to add -verify:all option as well - which will force bytecode verification of all loaded classes. When you report a JVM crash with BTrace, please attach/send the following:
&lt;/p&gt;&lt;ol&gt;&lt;li&gt; BTrace trace class that caused the crash.
&lt;/li&gt;&lt;li&gt; hs_err_pidXXX log produced by JVM.
&lt;/li&gt;&lt;li&gt; *.class file(s) saved by BTrace setting the com.sun.btrace.dumpClasses option.
&lt;/li&gt;&lt;li&gt; debug output from BTrace by setting the com.sun.btrace.debug option. 
&lt;/li&gt;&lt;/ol&gt;&lt;h2&gt;&lt;a name='How_to_contribute_to_BTrace?'&gt;&lt;/a&gt; How to contribute to BTrace? &lt;/h2&gt;
&lt;p&gt;
If you like BTrace and want to contribute fixes/features to BTrace, your are always welcome! You (or your company) have to sign the &lt;a class='external' href=&quot;http://www.sun.com/software/opensource/contributor_agreement.jsp&quot;&gt;Sun Contributor Agreement&lt;/a&gt;. Then, please join this project as &amp;quot;developer&amp;quot; using your kenai.com id. 

&lt;/p&gt;&lt;h3&gt;&lt;a name='BTrace_on_the_web'&gt;&lt;/a&gt; BTrace on the web &lt;/h3&gt;
&lt;ul&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://netbeans.dzone.com/articles/debugging-netbeans-with-visualvm-and-btrace&quot;&gt;Using VisualVM, BTrace &amp;amp; Good Old Web Search&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://ice09.wordpress.com/2009/07/12/analysing-memory-leaks-with-btrace&quot;&gt;Analysing Memory Leaks with BTrace&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://www.devwebsphere.com/devwebsphere/2009/06/btrace-for-performance-tuning.html&quot;&gt;btrace for performance tuning&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://blog.scalablej.com/2009/05/btrace-ultimate-jvm-probe.html&quot;&gt;BTrace the ultimate JVM probe&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://www.dzone.com/links/socket_monitoring_now_using_btrace.html&quot;&gt;Socket Monitoring: Now Using BTrace&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://kensipe.blogspot.com/2009/02/btrace-fix-on-mac.html&quot;&gt;BTrace Fix on the Mac&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://raymondtay.blogspot.com/2008/06/using-btrace-in-java-6.html&quot;&gt;Using BTrace in Java 6&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://http//blog.igorminar.com/2008/06/btrace-dtrace-for-java.html&quot;&gt;BTrace == DTrace for Java&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://blogs.sun.com/theaquarium/entry/btrace_showing_promises&quot;&gt;BTrace showing promises&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://weblogs.java.net/blog/binod/archive/2008/06/sailfin_work_an.html&quot;&gt;SailFin work and BTrace&lt;/a&gt;&lt;/li&gt;&lt;li&gt; &lt;a class='external' href=&quot;http://www.carlobonamico.com/blog/tag/btrace/&quot;&gt;Runtime profiling and monitoring Java apps with btrace&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;</text-as-html>
  <updated-at type="datetime">2009-08-20T12:29:01Z</updated-at>
  <wiki-id type="integer">8601</wiki-id>
</page>
