How it works...

Kernel tracing is done using the tracing functionalities available in the Linux kernel, as we have seen in previous recipes. For the examples to work, the Linux kernel must be configured appropriately as seen in the corresponding recipes earlier.

LTTng provides a common user interface to control some of the kernel tracing features we saw previously, such as the following:

  • Static tracepoint events:
    • You can enable specific static tracepoint events with the following:
# lttng enable-event <comma separated event list> -k
    
    • You can enable all tracepoints with the following:
# lttng enable-event -a -k --tracepoint   
    • You can also enable all syscalls as follows:
# lttng enable-event -a -k --syscall    
    • You can enable all tracepoints and syscalls as follows:
# lttng enable-event -a -k   
  • Dynamic tracepoint events:
    • You can also add dynamic tracepoints by symbol with the following:
# lttng enable-event <probe_name> -k --probe <symbol>+<offset>   
    • You can also add them by specifying an address as follows:
# lttng enable-event <probe_name> -k --probe <address>    
  • Function tracing:
    • You can also use the function tracing kernel functionality as follows:
# lttng enable-event <probe_name> -k --function <symbol>
    
  • Performance counter events:
    • The hardware performance counters, for example for the CPU cycles, can be used with the following command:
# lttng add-context -t perf:cpu:cpu-cycles -k   

Use the add-context --help option to list further context options and perf counters.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset