babeltrace2-convert - Linux


Overview

babeltrace2-convert is a powerful tool that transforms raw binary traces collected by the babeltrace utility into human-readable and easily analyzable formats. It plays an essential role in performance analysis, system debugging, and optimizing applications in various domains.

Syntax

babeltrace2-convert [options] <input.bt> [output.json|hprof|… ]

Options/Flags

  • -h, –help: Display usage information
  • -v, –version: Print version information
  • -o, –output: Specify the output file (default: stdout)
  • -f, –format: Select the output format (default: json)
  • -s, –stream: Convert only the specified stream
  • -e, –filter: Filter the trace data based on expression
  • -M, –max-events: Set the maximum number of events to convert

Examples

Convert a raw trace to JSON

babeltrace2-convert trace.bt output.json

Convert a specific stream to HPROF

babeltrace2-convert -s 'stream == my_app' -f hprof trace.bt app.hprof

Common Issues

  • Missing input trace: Ensure the specified input trace file exists.
  • Unsupported output format: Check if the requested output format is supported by babeltrace2-convert.
  • Invalid filter expression: Syntax errors or unsupported operators in the filtering expression can lead to errors.
  • Resource exhaustion: Converting large traces may require significant memory and CPU resources. Adjust the –max-events option or use incremental conversion.

Integration

Combining with babeltrace: Use babeltrace to collect the raw traces and then pipe the output to babeltrace2-convert for analysis.

babeltrace my_app -o trace.bt | babeltrace2-convert -f json

Integrate with profiling tools: Convert traces to formats compatible with profiling tools like flamegraph or gprof2dot, enabling detailed code profiling.

Related Commands