Thanks to visit codestin.com
Credit goes to github.com

Skip to content

btraceio/btrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dev build Download codecov.io huhu Join the chat at https://gitter.im/jbachorik/btrace Project Stats

BTrace

A safe, dynamic tracing tool for the Java platform

Overview

BTrace dynamically instruments running Java applications to inject tracing code at runtime, without stopping the application or recompiling code. Similar to DTrace for OpenSolaris, BTrace uses bytecode instrumentation to trace methods, monitor performance, and diagnose issues in production environments.

Credits

Building BTrace

Setup

You will need the following applications installed

  • Git
  • (optionally, the default launcher is the bundled gradlew wrapper) Gradle

Build

cd <btrace>
./gradlew :btrace-dist:build

Output locations:

  • Binary distributions: btrace-dist/build/distributions/ (*.tar.gz, *.zip, *.rpm, *.deb)
  • Exploded binary (BTRACE_HOME): btrace-dist/build/resources/main/

Updating golden files: When instrumentor code changes, update test golden files with:

./gradlew test -PupdateTestData

Commit the regenerated golden files to Git.

Using BTrace

Installation

Download: Get the latest release from the release page

Binary distribution:

# Extract the archive
tar -xzf btrace-*.tar.gz
# or
unzip btrace-*.zip

# Set environment variables (optional but recommended)
export BTRACE_HOME=/path/to/btrace
export PATH=$BTRACE_HOME/bin:$PATH

Package installation:

# RPM-based systems
sudo rpm -i btrace-*.rpm

# Debian-based systems
sudo dpkg -i btrace-*.deb

Quick Start

# Attach to running application
btrace <PID> <trace_script.java>

# Compile BTrace script
btracec <trace_script.java>

# Launch application with BTrace agent
btracer <compiled_script.class> <java-application-and-args>

Documentation

For comprehensive documentation, tutorials, and guides:

Maven Integration

The BTrace Maven Plugin enables:

  • Compilation of BTrace scripts during the build process
  • BTrace Project Archetype for quick project setup

Contributing

Important: Pull requests can only be accepted from signers of the Oracle Contributor Agreement.

Development

See CLAUDE.md for detailed development guidelines and project architecture.

Community

License

BTrace is licensed under GPLv2 with the Classpath Exception. See LICENSE for details.

About

BTrace - a safe, dynamic tracing tool for the Java platform

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 26

Languages