Probing the JVM with BPF/BCC

March 31, 2016

Now that BCC has support for USDT probes, another thing I wanted to try is look at OpenJDK probes and extract some useful examples. To follow along, install a recent OpenJDK (I used 1.8) that has USDT probes enabled. On my Fedora 22, sudo dnf install java was just enough for everything. Conveniently, OpenJDK ships with a set of .stp files that contain probe definitions. Here's an example -- and there are many more in your $JAVA_HOME/tapset directory: probe hotspot.thread_start = process("/usr/lib/jvm/java-1.8.0-openjdk-").mark("thread__start") {   name = "thread_start";   thread_name = user_string_n($arg1, $arg2);   id = $arg3;   native_id = $arg4;   is_daemon = $arg5;   probestr = sprintf("%s(thread_name='%s',id=%d,native_id=%d,is_daemon=%d)",               ...
no comments

USDT Probe Support in BPF/BCC

March 30, 2016

BPF is the next Linux tracing superpower, and its potential just keeps growing. The BCC project just merged my latest PR, which introduces USDT probe support in BPF programs. Before we look at the details, here's an example of what it means: # trace -p $(pidof node) 'u:node:http__server__request "%s %s (from %s:%d)" arg5, arg6, arg3, arg4' TIME PID COMM FUNC - 04:50:44 22185 node http__server__request GET /foofoo (from ::1:51056) 04:50:46 22185 node http__server__request GET / (from ::1:51056) ^C Yep, that's Node.js running...