Este contenido no está disponible en el idioma seleccionado.
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 Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
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 Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
This prints:
1.4.3. Recursive functions Copiar enlaceEnlace copiado en el portapapeles!
Copiar enlaceEnlace copiado en el portapapeles!
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”.