summaryrefslogtreecommitdiffstats
path: root/analysis/loop/ftrace/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'analysis/loop/ftrace/README.md')
-rw-r--r--analysis/loop/ftrace/README.md29
1 files changed, 29 insertions, 0 deletions
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.