LoginSignup
16
12

trace-cmdコマンドの使い方

Last updated at Posted at 2017-10-26

#1 trace-cmdとは
Linuxカーネルのftrace(カーネル内の各種処理を追跡するツール)を操作するためのコマンドです。
障害対応等のデバッグのときに使います。

#2 環境
VMware Workstation 12 Player上のゲストマシンを使っています。

[root@server ~]# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

[root@server ~]# uname -r
3.10.0-514.el7.x86_64

#3 事前準備
##3.1 trace-cmdパッケージのインストール

[root@server ~]# yum -y install trace-cmd
[root@server ~]# rpm -qa|grep trace-cmd
trace-cmd-2.6.0-8.el7.x86_64

#4 trace-cmdのコマンド一覧

[root@server ~]# trace-cmd
trace-cmd version 2.6.

usage:
  trace-cmd [COMMAND] ...

  commands:
     record - record a trace into a trace.dat file
     start - start tracing without recording into a file
     extract - extract a trace from the kernel
     stop - stop the kernel from recording trace data
     restart - restart the kernel trace data recording
     show - show the contents of the kernel tracing buffer
     reset - disable all kernel tracing and clear the trace buffers
     report - read out the trace stored in a trace.dat file
     stream - Start tracing and read the output directly
     profile - Start profiling and read the output directly
     hist - show a historgram of the trace.dat information
     stat - show the status of the running tracing (ftrace) system
     split - parse a trace.dat file into smaller file(s)
     options - list the plugin options available for trace-cmd report
     listen - listen on a network socket for trace clients
     list - list the available events, plugins or options
     restore - restore a crashed record
     snapshot - take snapshot of running trace
     stack - output, enable or disable kernel stack tracing
     check-events - parse trace event formats
コマンド 概要
record トレースを開始する。終了はCtrl + cを押下する。トレースはファイル(trace.dat)に保存される。  
report 保存したトレース(trace.dat)をテキストファイルに変換する
start トレースを開始する(トレースのメモリへの保存を開始)
stop トレースを停止する(トレースのメモリへの保存を停止)
extract メモリに保存されているトレースをファイルに保存する
reset メモリに保存されているトレースを消去する
show メモリに保存されているトレースを表示する
listen あるマシンで採取したトレースを別のマシンに転送するときに使います。詳細は8章を参照ください。

最新版は以下に記載しました。
https://hana-shin.hatenablog.com/entry/2022/05/08/200215

16
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
12