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
  • if condition
  • for loop

Was this helpful?

  1. Systemtap Language

Control Flow

PreviousVariablesNextFunction & Macro

Last updated 6 years ago

Was this helpful?

This part is really simple, if you have some basic knowledge about any programming language.

I would like to give two examples here, and for more information you could refer to .

if condition

probe begin
{ 
    if (pid())
        printf("%d:%s\n", pid(), execname());
    else
        printf("invalid pid\n");
    exit();
}

for loop

probe begin
{ 
    index = 0;
    for (; index < 10; index++)
        arr[index] = index;
    exit();
}
Ref 1