aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkilesh Kailash <akailash@google.com>2023-08-21 13:19:05 -0700
committerAkilesh Kailash <akailash@google.com>2023-08-21 14:03:04 -0700
commit576520ced87d1a3a16f27f3e6f90d37d3d52b14c (patch)
tree07c5f0717f4a9e5a156d29233d3adf74f4265512
parent406e44b96ec8a78c3705dbe26ec1eb5cba8f025b (diff)
downloadbcc-576520ced87d1a3a16f27f3e6f90d37d3d52b14c.tar.gz
libbpf-tools: biopatter, bitesize and exitsnoop
These tools will require upstream libbpf patch: https://lore.kernel.org/bpf/20220523212808.603526-1-connoro@google.com/T/#u That upstream patch will be merged seperately; however, we can build these tools independantly for now for debugging purposes. $:/data/bcc # ./bitesize 1 Process Name = dd Kbytes : count distribution 0 -> 1 : 0 | | 2 -> 3 : 0 | | 4 -> 7 : 1 |* | 8 -> 15 : 0 | | 16 -> 31 : 1 |* | 32 -> 63 : 1 |* | 64 -> 127 : 1 |* | 128 -> 255 : 1 |* | 256 -> 511 : 2 |** | 512 -> 1023 : 37 |****************************************| $:/data/bcc # ./exitsnoop -t TIME(s) PCOMM PID PPID TID AGE(s) EXIT_CODE 13:08:03 dd 16338 16299 16338 0.43 0 13:08:04 kworker/dying 30194 2 30194 7110.01 0 13:08:05 kworker/dying 30172 2 30172 7112.14 0 $:/data/bcc # ./biopattern 1 Tracing block device I/O requested seeks... Hit Ctrl-C to end. DISK %RND %SEQ COUNT KBYTES sda 75 25 4 144 sda 100 0 3 12 sda 0 100 6 24 sda 100 0 31 324 sda 83 16 24 2244 Bug: 296512575 Test: On Pixel running 5.10 kernel Change-Id: I99884884a8bbb221fb2e039ad98b84cceec307cd Signed-off-by: Akilesh Kailash <akailash@google.com>
-rw-r--r--libbpf-tools/Android.bp71
1 files changed, 71 insertions, 0 deletions
diff --git a/libbpf-tools/Android.bp b/libbpf-tools/Android.bp
index edac3816..ec860e81 100644
--- a/libbpf-tools/Android.bp
+++ b/libbpf-tools/Android.bp
@@ -630,3 +630,74 @@ cc_binary {
generated_headers: ["biosnoop.skel.h"],
defaults: ["bcc_binary_defaults"],
}
+
+// The following tools viz. exitsnoop, biopattern and bitesize
+// will not work on Android without this libbpf patch:
+//
+// https://lore.kernel.org/bpf/20220523212808.603526-1-connoro@google.com/T/#u
+//
+// The patch is trivial but important as it looks for tracepoints under /sys/kernel/tracing
+// as there is no debugfs on Android.
+//
+// Additionally, any new tools which depend on kernel static tracepoints should
+// have this libbpf patch.
+
+cc_object {
+ name: "exitsnoop.bpf.o",
+ srcs: ["exitsnoop.bpf.c"],
+ defaults: ["bcc_bpf_defaults"],
+}
+
+genrule {
+ name: "exitsnoop.skel.h",
+ srcs: [":exitsnoop.bpf.o"],
+ out: ["exitsnoop.skel.h"],
+ defaults: ["bpf_skeleton_hdr_defaults"],
+}
+
+cc_binary {
+ name: "exitsnoop",
+ srcs: ["exitsnoop.c"],
+ generated_headers: ["exitsnoop.skel.h"],
+ defaults: ["bcc_binary_defaults"],
+}
+
+cc_object {
+ name: "biopattern.bpf.o",
+ srcs: ["biopattern.bpf.c"],
+ defaults: ["bcc_bpf_defaults"],
+}
+
+genrule {
+ name: "biopattern.skel.h",
+ srcs: [":biopattern.bpf.o"],
+ out: ["biopattern.skel.h"],
+ defaults: ["bpf_skeleton_hdr_defaults"],
+}
+
+cc_binary {
+ name: "biopattern",
+ srcs: ["biopattern.c"],
+ generated_headers: ["biopattern.skel.h"],
+ defaults: ["bcc_binary_defaults"],
+}
+
+cc_object {
+ name: "bitesize.bpf.o",
+ srcs: ["bitesize.bpf.c"],
+ defaults: ["bcc_bpf_defaults"],
+}
+
+genrule {
+ name: "bitesize.skel.h",
+ srcs: [":bitesize.bpf.o"],
+ out: ["bitesize.skel.h"],
+ defaults: ["bpf_skeleton_hdr_defaults"],
+}
+
+cc_binary {
+ name: "bitesize",
+ srcs: ["bitesize.c"],
+ generated_headers: ["bitesize.skel.h"],
+ defaults: ["bcc_binary_defaults"],
+}