Debian Codegraph @

testsuite/systemtap.examples/profiling/ioctl_handler.stp

raw
1 #! /usr/bin/env stap
2 # Copyright (C) 2018 Red Hat, Inc.
3 # Written by William Cohen <[email protected]>
4 #
5
6 global ioctl_requests, ioctl_func
7
8 probe syscall.ioctl {
9 ioctl_requests[execname()] <<< 1
10 try {
11 # Dig down through the task struct to find the actual function handling ioctl.
12 ioctl_func_address = @cast(task_current(), "struct task_struct", "kernel")->files->fdt->fd[fd]->f_op->unlocked_ioctl
13 if (ioctl_func_address)
14 ioctl_func[execname(), ioctl_func_address] <<< 1
15 } catch {
16 ioctl_func[execname(), 0] <<< 1
17 }
18 }
19
20 probe end {
21 printf("Per execname ioctl information\n")
22 foreach ([e+, f] in ioctl_func) {
23 if (current_exec != e){
24 printf("%s %d\n", e, @sum(ioctl_requests[e]))
25 current_exec = e
26 }
27 printf(" %s %d\n", symdata(f), @sum(ioctl_func[e,f]))
28 }
29 }
30