From f1cb688da5687fd7cec704af1d38058368525ca4 Mon Sep 17 00:00:00 2001 From: Manuel Bentele Date: Wed, 5 Jun 2019 01:24:20 +0200 Subject: Added function traces of the loop device kernel module --- analysis/loop/ftrace/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 analysis/loop/ftrace/README.md (limited to 'analysis/loop/ftrace/README.md') diff --git a/analysis/loop/ftrace/README.md b/analysis/loop/ftrace/README.md new file mode 100644 index 0000000..6ac9cd7 --- /dev/null +++ b/analysis/loop/ftrace/README.md @@ -0,0 +1,29 @@ +# Tracing the loop device kernel module + +The loop device kernel module can be traced with the *ftrace* framework of the +Linux kernel. Therefore, *ftrace* must be compiled into the Linux kernel and the +user space module *trace-cmd* is necessary. + + +## Creating the trace file + +Each loop device specific operation can be traced with the following command +```bash +trace-cmd record -p function_graph --module loop -o [trace file] [cmd] +``` +where `[trace file]` is the created trace file and `[cmd]` is one of the +following loop device operation: + * add loop device: `losetup -f test.img` + * read from loop device: `dd if=/dev/loop0 bs=512 count=1 of=tmp.img` + * write to loop device: `dd of=/dev/loop0 bs=512 count=1 if=tmp.img` + * remove loop device: `losetup -D` + + +## Viewing the trace file + +The created trace file can be viewed on the command line with the following +command: +```bash +trace-cmd report -i [trace file] +``` +where `[trace file]` is the already created trace file. -- cgit v1.2.3-55-g7522