Skip to content

Instantly share code, notes, and snippets.

@jpetazzo
Created July 30, 2012 13:41
Show Gist options
  • Save jpetazzo/3206987 to your computer and use it in GitHub Desktop.
Save jpetazzo/3206987 to your computer and use it in GitHub Desktop.
Analyze dmesg kernel stack traces
#!/usr/bin/env python
"""
We're looking for stuff like this:
dump_header+0x92/0x200
"""
import re
import sys
data = sys.stdin.read()
counters = {}
matches = re.findall(r' [a-z_]+\+0x[0-9]+/', data)
for m in matches:
if m not in counters:
counters[m] = 0
counters[m] += 1
sorted_counters = sorted((c,m) for (m,c) in counters.items())
for c in sorted_counters:
print c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment