I would like to measure CPU usage in a function within the kernel module

24 Views Asked by At

everyone.

I am studying the ZFS file system programmed in C language. I would like to measure the CPU usage of each function within ZFS. Is there a way?

At first I tried adding kernel_stat.h, but it caused numerous conflicts with ZFS's code.

Here's what I want to know:

  1. How to add kernel headers such as kernel_stat.h within ZFS without conflict.
  • Modifying DEFAULT_INCLUDE in Makefile.in in zfs adds it, but causes numerous crashes.
  1. How do other open sources generally add the kernel header?
  2. A way to obtain CPU usage for each function in general kernel code.
  • ex) I would appreciate it if you could tell me the specific usage of BPF and ftrace.

Thanks. regards

I tried adding kernel headers within ZFS. However, numerous conflicts occurred. I'm trying to use bpftrace and ftrace. However, I am studying a little more to achieve what I want.

0

There are 0 best solutions below