aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2013-06-05 00:34:22 -0400
committerDave Airlie <airlied@redhat.com>2013-06-05 00:34:22 -0400
commit943079e111bde93ed972d21618d1d73e75ba0d09 (patch)
tree32626f38001c6fd69340fe44a296ae34760872fa /tools/perf/scripts/python
parentec7fdeee19474afb2169bb0939cbc972f9aa20eb (diff)
parent53d3b4d7778daf15900867336c85d3f8dd70600c (diff)
Merge tag 'drm-intel-fixes-2013-06-04' of git://people.freedesktop.org/~danvet/drm-intel into drm-fixes
Daniel writes: Three regression fixes and one no-lvds quirk update. The regression Egbert Eich tracked down goes back to 2.6.37 ... ugh. The other two are pretty minor: One bogus modeset state checker WARN and a patch to prevent X dying in a SIGBUS after a gpu hang with failed (or not implement as on gen2/3) gpu reset. * tag 'drm-intel-fixes-2013-06-04' of git://people.freedesktop.org/~danvet/drm-intel: (368 commits) drm/i915/sdvo: Use &intel_sdvo->ddc instead of intel_sdvo->i2c for DDC. drm/i915: no lvds quirk for hp t5740 drm/i915: Quirk the pipe A quirk in the modeset state checker drm/i915: Fix spurious -EIO/SIGBUS on wedged gpus Linux 3.10-rc4 parisc: parport0: fix this legacy no-device port driver! parport_pc: disable PARPORT_PC_SUPERIO on parisc architecture parisc/PCI: lba: fix: convert to pci_create_root_bus() for correct root bus resources (v2) parisc/PCI: Set type for LBA bus_num resource MAINTAINERS: update parisc architecture file list parisc: kernel: using strlcpy() instead of strcpy() parisc: rename "CONFIG_PA7100" to "CONFIG_PA7000" parisc: fix kernel BUG at arch/parisc/include/asm/mmzone.h:50 parisc: memory overflow, 'name' length is too short for using powerpc/cputable: Fix typo on P7+ cputable entry powerpc/perf: Add missing SIER support powerpc/perf: Revert to original NO_SIPR logic powerpc/pci: Remove the unused variables in pci_process_bridge_OF_ranges powerpc/pci: Remove the stale comments of pci_process_bridge_OF_ranges powerpc/pseries: Always enable CONFIG_HOTPLUG_CPU on PSERIES SMP ...
Diffstat (limited to 'tools/perf/scripts/python')
-rwxr-xr-xtools/perf/scripts/python/net_dropmonitor.py39
1 files changed, 21 insertions, 18 deletions
diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py
index a4ffc9500023..b5740599aabd 100755
--- a/tools/perf/scripts/python/net_dropmonitor.py
+++ b/tools/perf/scripts/python/net_dropmonitor.py
@@ -15,35 +15,38 @@ kallsyms = []
15 15
16def get_kallsyms_table(): 16def get_kallsyms_table():
17 global kallsyms 17 global kallsyms
18
18 try: 19 try:
19 f = open("/proc/kallsyms", "r") 20 f = open("/proc/kallsyms", "r")
20 linecount = 0
21 for line in f:
22 linecount = linecount+1
23 f.seek(0)
24 except: 21 except:
25 return 22 return
26 23
27
28 j = 0
29 for line in f: 24 for line in f:
30 loc = int(line.split()[0], 16) 25 loc = int(line.split()[0], 16)
31 name = line.split()[2] 26 name = line.split()[2]
32 j = j +1 27 kallsyms.append((loc, name))
33 if ((j % 100) == 0):
34 print "\r" + str(j) + "/" + str(linecount),
35 kallsyms.append({ 'loc': loc, 'name' : name})
36
37 print "\r" + str(j) + "/" + str(linecount)
38 kallsyms.sort() 28 kallsyms.sort()
39 return
40 29
41def get_sym(sloc): 30def get_sym(sloc):
42 loc = int(sloc) 31 loc = int(sloc)
43 for i in kallsyms: 32
44 if (i['loc'] >= loc): 33 # Invariant: kallsyms[i][0] <= loc for all 0 <= i <= start
45 return (i['name'], i['loc']-loc) 34 # kallsyms[i][0] > loc for all end <= i < len(kallsyms)
46 return (None, 0) 35 start, end = -1, len(kallsyms)
36 while end != start + 1:
37 pivot = (start + end) // 2
38 if loc < kallsyms[pivot][0]:
39 end = pivot
40 else:
41 start = pivot
42
43 # Now (start == -1 or kallsyms[start][0] <= loc)
44 # and (start == len(kallsyms) - 1 or loc < kallsyms[start + 1][0])
45 if start >= 0:
46 symloc, name = kallsyms[start]
47 return (name, loc - symloc)
48 else:
49 return (None, 0)
47 50
48def print_drop_table(): 51def print_drop_table():
49 print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT") 52 print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT")
@@ -64,7 +67,7 @@ def trace_end():
64 67
65# called from perf, when it finds a correspoinding event 68# called from perf, when it finds a correspoinding event
66def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, 69def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm,
67 skbaddr, protocol, location): 70 skbaddr, location, protocol):
68 slocation = str(location) 71 slocation = str(location)
69 try: 72 try:
70 drop_log[slocation] = drop_log[slocation] + 1 73 drop_log[slocation] = drop_log[slocation] + 1