stapref (1) Linux Manual Page
NAME
stapref – systemtap language reference
SYNOPSIS
stapref
DESCRIPTION
The reference for the systemtap scripting language.
LANGUAGE
Keywords
-
• break • continue • delete • else • exit • foreach • for • function • global • private • if • in • next • probe • return • try / catch • while
Data Types and Operators
-
Integers
•
var1 = 5 & bull;
global var2 = 10 Strings & bull;
var1 = “string1” & bull;
global var2 = “string2” Associative Arrays & bull;
global array1[] & bull;
global array2[SIZE] & bull;
array[index] = 5 Context Variables & bull;
$var
•
$var$(pretty printed string form)
Binary numeric operators
•
* / % +- << >> &^ | && ||
Binary string operators
•
.(string concatenation)
Numeric assignment operators
•
= += -= *= /= %= >>= <<= &= ^= |=
String assignment operators & bull;
=.=
Unary numeric operators & bull;
+ – !~++–Numeric & string comparison operators & bull;
<> <= >= == !=
Regular expression matching operators
•
= ~!~Ternary operator& bull;
cond ? exp1 : exp2 Grouping operator& bull;
(expression)
Array operators
•
array[index](array read / write) & bull;
[index] in array
Aggregation
operator& bull;
var < < < value
Statements
-
Jump Statements
•
continue
•
break
•
next
•
return expression & bull;
try statement catch (message)
-
Selection Statements
•
if (expression)
statement
•
else
statement
-
Iteration Statements
•
foreach (variable in array)
statement
•
foreach ([ var1, var2, … ] in array)
statement
•
for (expression; expression; expression)
statement
•
while (expression)
statement
-
Declaration Statements
•
function name(variable
: type, …){statement} &
bull;
function name : type(variable
: type, …){statement} &
bull;
function name : type(variable
: type, …) %
{c_statement % } &
bull;
probe probepoint{statement} & bull;
probe label = probepoint
{
statement
}
Lexical Structure
-
Comments •
#... comment •//... comment •/*... comment ...*/
-
Preprocessor
•
% (expression % ? true_tokens % : false_tokens %) & bull;
@define label(variable, …) %
{
statement %
}
Builtin Functions
-
Aggregation Builtin Functions
•
@avg(variable) & bull;
@count(variable) & bull;
@hist_linear(variable, N, N, N) & bull;
@hist_log(variable) & bull;
@max(variable) & bull;
@min(variable) & bull;
@sum(variable)
-
Output Builtin Functions
•
print(variable) & bull;
printf(format
: string, variable, …) &
nbsp;
where format is of the form : % [flags][width][.precision][length] specifier
•
printd(delimiter
: string, variable, …) &
bull;
printdln(delimiter
: string, variable, …) &
bull;
println() & bull;
sprint : string(variable) & bull;
sprintf : string(format
: string, variable, …)
-
Variable Access Builtin Functions
•
@cast(variable, “type_name”[, “module”]) & bull;
@defined(variable)
Probepoints
-
Some of the more commonly used probepoints
•
kernel.function(PATTERN) kernel.function(PATTERN).call
•
kernel.function(PATTERN).return •
kernel.FUNCTION(PATTERN).return.maxactive(VALUE) & bull;
kernel.FUNCTION(PATTERN).inline
•
kernel.FUNCTION(PATTERN).label(LPATTERN) & bull;
module(MPATTERN).FUNCTION(PATTERN) & bull;
module(MPATTERN).FUNCTION(PATTERN).call
•
module(MPATTERN).FUNCTION(PATTERN).return.maxactive(VALUE) & bull;
module(MPATTERN).FUNCTION(PATTERN).inline
•
kernel.statement(PATTERN) & bull;
kernel.statement(ADDRESS).absolute
•
module(MPATTERN).statement(PATTERN) & bull;
kprobe.FUNCTION(FUNCTION) & bull;
kprobe.FUNCTION(FUNCTION).return •
kprobe.module(NAME).FUNCTION(FUNCTION) & bull;
kprobe.module(NAME).FUNCTION(FUNCTION).return •
kprobe.statement(ADDRESS).absolute
•
process.begin process(“PATH”).begin
•
process(PID).begin process.thread.begin
•
process(“PATH”).thread.begin
•
process(PID).thread.begin
•
process.end
•
process(“PATH”).end
•
process(PID).end
•
process.thread.end
•
process(“PATH”).thread.end
•
process(PID).thread.end
•
process(“PATH”).syscall
•
process(PID).syscall
•
process.syscall.return •
process(“PATH”).syscall.return •
process(PID).syscall.return •
process(“PATH”).FUNCTION(“NAME”) & bull;
process(“PATH”).statement(“*@FILE.c:123”) & bull;
process(“PATH”).FUNCTION(“*”).return •
process(“PATH”).FUNCTION(“myfun”).label(“foo”) & bull;
process(“PATH”).mark(“LABEL”) & bull;
java(“PNAME”).class(“CLASSNAME”).method(“PATTERN”) & bull;
java(“PNAME”).class(“CLASSNAME”).method(“PATTERN”).return •
java(PID).class(“CLASSNAME”).method(“PATTERN”) & bull;
java(PID).class(“CLASSNAME”).method(“PATTERN”).return •
python2.module(“MODULENAME”).function(“PATTERN”) & bull;
python2.module(“MODULENAME”).function(“PATTERN”).return •
python3.module(“MODULENAME”).function(“PATTERN”) & bull;
python3.module(“MODULENAME”).function(“PATTERN”).return
Tapset Functions
-
Some of the more commonly used tapset functions • addr : long() & bull; backtrace : string() & bull; caller : string() & bull; caller_addr : long() & bull; cmdline_arg : string(N : long) & bull; cmdline_args : string(N : long, m : long, delim : string) & bull; cmdline_str : string() & bull; env_var : string(name : string) & bull; execname : string() & bull; int_arg : long(N : long) & bull; isinstr : long(s1 : string, s2 : string) & bull; long_arg : long(N : long) & bull; modname : string() & bull; module_name : string() & bull; pid : long() & bull; pn : string() & bull; pointer_arg : string(N : long) & bull; pp : string() & bull; print_backtrace() & bull; probefunc : string() & bull; register : long(name : string) & bull; str_replace : string(prnt_str : string, srch_str : string, rplc_str : string) & bull; stringat : long(str : string, pos : long) & bull; strlen : long(str : string) & bull; strtol : long(str : string, base : long) & bull; substr : string(str : string, start : long, length : long) & bull; user_long : long(addr : long) & bull; user_string : string(addr : long)
SEE ALSO
stap(1)
BUGS
Use the Bugzilla link of the project web page or our mailing list. http://sourceware.org/systemtap/,<systemtap [at] sourceware.org>.
