Debian Codegraph @

testsuite/systemtap.examples/general/also_ran.stp

raw
1 #! /usr/bin/env stap
2 # Copyright (C) 2018 Red Hat, Inc.
3 # Written by William Cohen <[email protected]>
4 #
5 # also_ran.stp provides a tally of the executables and
6 # shared libraries used on the system formatted for
7 # consumption by prometheus.
8 # The data is read from /proc/systemtap/*/also_ran.stp
9 #
10 # Run the script with:
11 # stap also_ran.stp
12 #
13 # control-c to exit data collection
14
15 global arr
16
17 # count processes starting up
18 probe kprocess.exec {
19 arr[filename]++
20 }
21
22 # count shared libraries opened via dlopen operations
23 probe process("/usr/lib*/ld-*.so").function("_dl_map_object_from_fd")?
24 {
25 # get 5th argument (char* realname) from the function
26 arr[user_string_quoted(pointer_arg(5))]++
27 }
28
29 probe prometheus {
30 @prometheus_dump_array1_map_unquoted(arr, "usage_count", "path", sprint, sprint)
31 }