Questo contenuto non è disponibile nella lingua selezionata.
1.4. Sample SystemTap scripts
Following are some example scripts that illustrate the basic operation of SystemTap. For more examples, see the examples/small_demos/ directory in the source directory, the SystemTap wiki at http://sourceware.org/systemtap/wiki/HomePage, or the SystemTap War Stories at http://sourceware.org/systemtap/wiki/WarStories page.
1.4.1. Basic SystemTap syntax and control structures Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
The following code examples demonstrate SystemTap syntax and control structures.
This prints:
Note that all variable types are inferred, and that all locals and globals are initialized.
1.4.2. Primes between 0 and 49 Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
This prints:
1.4.3. Recursive functions Copia collegamentoCollegamento copiato negli appunti!
Copia collegamentoCollegamento copiato negli appunti!
This prints:
11th fibonacci number: 118
11th fibonacci number: 118
Any larger number input to the function may exceed the MAXACTION or MAXNESTING limits, which will be caught at run time and result in an error. For more about limits see Section Section 1.6, “Safety and security”.