LuaJIT bindings to libstapsdt for eBPF tracing.
README is markdown
Modified README
Cleaned up example


browse  log 



You can also use your local clone with git send-email.


luajit-stapsdt is a library lets you define SystemTap Statically Defined Tracing (stapsdt) probes in LuaJIT. This gives you the power of Linux's eBPF tracing infrastructure in LuaJIT. It does this by binding the libstapsdt library, which can be acquired here.

luajit-stapsdt has only been tested on x86_64 Linux, it may work on other arches as well eventually, but this depends on libstapsdt. Currently, libstapsdt seems to only claim support for x86_64 Linux.


  • libstapsdt
  • luajit


Lightweight tracing is very useful. Lightweight tracing with useful contextual information is even more useful. We can get this with Linux's eBPF subsystem, as long as we provide the probes it can hook into. This library lets you define such hooks in your LuaJIT programs.

#Example and API

-- Load the library
local trace = require "stapsdt"
-- Make a provider
local p = trace.provider "myprovider"
-- Add a probe to the provider
p:probe("myprobe", "u8")
-- load the provider, after this, you can start tracing with eBPF. bcc-tools is
-- recommended for this purpose.
-- fire off a probe
p:fire("myprobe", 42)
-- Unload the provider (this is not normally necessary)
-- The underlying structures will be cleaned up automatically
p = nil

Read the source in stapsdt.lua for more information. There is a more in-depth example at example_primes.lua



#More information

Brendan Gregg's book "BPF Performance Tools" is very good and recommended to learn more. His blog is great as well.