aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/plugins/kernel.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/sos/plugins/kernel.py b/sos/plugins/kernel.py
index 19a33b97..39874ad0 100644
--- a/sos/plugins/kernel.py
+++ b/sos/plugins/kernel.py
@@ -9,6 +9,7 @@
from sos.plugins import Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin
import os
import glob
+import json
class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
@@ -25,6 +26,28 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
("with-timer", "gather /proc/timer* statistics", "slow", False)
]
+ def get_bpftool_prog_ids(self, prog_file):
+ out = []
+ try:
+ prog_data = json.load(open(prog_file))
+ except Exception, e:
+ self._log_info("Could not parse bpftool prog list as JSON: %s" % e)
+ return out
+ for item in range(len(prog_data)):
+ out.append(prog_data[item]["id"])
+ return out
+
+ def get_bpftool_map_ids(self, map_file):
+ out = []
+ try:
+ map_data = json.load(open(map_file))
+ except Exception, e:
+ self._log_info("Could not parse bpftool map list as JSON: %s" % e)
+ return out
+ for item in range(len(map_data)):
+ out.append(map_data[item]["id"])
+ return out
+
def setup(self):
# compat
self.add_cmd_output("uname -a", root_symlink="uname")
@@ -104,4 +127,14 @@ class Kernel(Plugin, RedHatPlugin, DebianPlugin, UbuntuPlugin):
# and may also cause softlockups
self.add_copy_spec("/proc/timer*")
+ # collect list of eBPF programs and maps and their dumps
+ prog_file = self.get_cmd_output_now("bpftool -j prog list")
+ for prog_id in self.get_bpftool_prog_ids(prog_file):
+ for dumpcmd in ["xlated", "jited"]:
+ self.add_cmd_output("bpftool prog dump %s id %s" %
+ (dumpcmd, prog_id))
+ map_file = self.get_cmd_output_now("bpftool -j map list")
+ for map_id in self.get_bpftool_map_ids(map_file):
+ self.add_cmd_output("bpftool map dump id %s" % map_id)
+
# vim: set et ts=4 sw=4 :