systemtap_with_examples
  • Introduction
  • Installation
    • Build systap from source
    • Build package from source
  • Systemtap Language
    • Syntax
    • Variables
    • Control Flow
    • Function & Macro
    • TypeCase
    • Guru Mode
    • Probe Point
    • Predefined Functions
  • Examples
    • Call Graph
    • Dump Stack Trace
    • Duration
    • CPU Performance
    • Network DEV Analysis
    • KVM MMU
  • Reference
Powered by GitBook
On this page

Was this helpful?

  1. Systemtap Language

Syntax

Below is the syntax of systemtap language.

probe PROBEPOINT [, PROBEPOINT] { [STMT ...] }

This is something like awk syntax, specify the PROBEPOINT to trigger the action and specify what to do with STMT.

This would be to boring to just look at the definition. Take the HelloWorld as an example.

probe begin
{ 
    printf("HelloWorld\n");
    exit(); 
}
  • begin is a special probe point means at the beginning of the probe process

  • printf()/exit() is what should do on begin event

With this script and write into file helloworld.stp, we can run it with

sudo stap -v helloworld.stp

The syntax seems simple, right?

PreviousSystemtap LanguageNextVariables

Last updated 6 years ago

Was this helpful?