Comparison between perf, Ftrace, LTTng and GDB...

13
  1 Comparison between perf, Ftrace, LTTng and GDB tracepoints June 29, 2010 École Polytechnique, Montreal Rafik Fahem Department of Computer and Software Engineering

Transcript of Comparison between perf, Ftrace, LTTng and GDB...

Page 1: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    1

Comparison between perf, Ftrace, LTTng and GDB tracepoints

June 29, 2010École Polytechnique, Montreal

Rafik FahemDepartment of Computer and Software Engineering

Page 2: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    22 Comparison between perf, Ftrace, LTTng and GDB tracepoints

ContentPerf

Ftrace

LTTng

GDB tracepoints

Discussion

Questions

Page 3: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    33 Comparison between perf, Ftrace, LTTng and GDB tracepoints

Perf

● Used for performance analysis● Static tracepoints: 

● Makes use of the tracepoints available in the kernel(version 2.6.32 and higher)

● Dynamic tracepoints can be defined with:● Symbols and registers without debuginfo● C line numbers, function names and local variables with 

debuginfo

Page 4: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    44 Comparison between perf, Ftrace, LTTng and GDB tracepoints

Perf

● Dynamic tracepoints are implemented with kprobes

● Vmlinux containing the debuginfo has to be a Dwarf binary

● Traces only the events generated by a specific program

Page 5: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    55 Comparison between perf, Ftrace, LTTng and GDB tracepoints

Perf

● Available data:● Number of times the tracepoint was hit● Execution time● Calling functions

● Trace is available only after execution

Page 6: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    66 Comparison between perf, Ftrace, LTTng and GDB tracepoints

Ftrace

● Can be used for debugging and latency analysis

● Includes six different tracers: function calls, context switches...etc

● Uses the static tracepoints available in the kernel source

● Dynamic tracepoints unavailable

Page 7: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    77 Comparison between perf, Ftrace, LTTng and GDB tracepoints

Ftrace

● Available data depends on the tracer enabled: execution time, calling functions, PIDs...

● Thousands of filters available to trace only some selected events

● Trace is recorded in debugfs● Trace can be viewed when tracing

Page 8: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    88 Comparison between perf, Ftrace, LTTng and GDB tracepoints

LTTng

● Optimized for static tracing● Uses the static tracepoints available in the 

kernel● Dynamic tracepoints implemented using 

kprobes● Several probes can be connected to the same 

tracepoint● Live monitoring under development

Page 9: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    99 Comparison between perf, Ftrace, LTTng and GDB tracepoints

GDB tracepoints

● Can only be used in user space● Only dynamic tracepoints are supported in the 

current version● UST tracepoints can be used● Tracepoints inserted using traps● Fast tracepoints: 

● Faster but restricted in where they may be installed● Inserted with a jump

Page 10: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    1010 Comparison between perf, Ftrace, LTTng and GDB tracepoints

GDB tracepoints

● Data collected can include registers, local variables and global data.

● Tracepoints can be defined with line numbers, function names and addresses

● A trace snapshot is collected every time a tracepoint is hit

● These snapshots are stored in buffers and can be examined later

Page 11: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    1111 Comparison between perf, Ftrace, LTTng and GDB tracepoints

Discussion

● Perf:● Tracing a single program● Statistics: execution time, calling functions, number 

of times the tracepoint was hit● Hardware performance counters

● Ftrace:● Filters● Trace in debugfs

Page 12: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    1212 Comparison between perf, Ftrace, LTTng and GDB tracepoints

Discussion

● LTTng:● Optimized static tracing● User­space tracing● Trace streaming

● GDB tracepoints:● Fast tracepoints using jumps

● Debuginfo is needed to access variables(SystemTap)

Page 13: Comparison between perf, Ftrace, LTTng and GDB tracepointsdmct.dorsal.polymtl.ca/sites/dmct.dorsal.polymtl... · 10 Comparison between perf, Ftrace, LTTng and GDB tracepoints 10 GDB

    1313 Comparison between perf, Ftrace, LTTng and GDB tracepoints

Questions?