diff options
| author | Tejun Heo <tj@kernel.org> | 2011-11-28 12:46:22 -0500 |
|---|---|---|
| committer | Tejun Heo <tj@kernel.org> | 2011-11-28 12:46:22 -0500 |
| commit | d4bbf7e7759afc172e2bfbc5c416324590049cdd (patch) | |
| tree | 7eab5ee5481cd3dcf1162329fec827177640018a /tools/perf/scripts/python | |
| parent | a150439c4a97db379f0ed6faa46fbbb6e7bf3cb2 (diff) | |
| parent | 401d0069cb344f401bc9d264c31db55876ff78c0 (diff) | |
Merge branch 'master' into x86/memblock
Conflicts & resolutions:
* arch/x86/xen/setup.c
dc91c728fd "xen: allow extra memory to be in multiple regions"
24aa07882b "memblock, x86: Replace memblock_x86_reserve/free..."
conflicted on xen_add_extra_mem() updates. The resolution is
trivial as the latter just want to replace
memblock_x86_reserve_range() with memblock_reserve().
* drivers/pci/intel-iommu.c
166e9278a3f "x86/ia64: intel-iommu: move to drivers/iommu/"
5dfe8660a3d "bootmem: Replace work_with_active_regions() with..."
conflicted as the former moved the file under drivers/iommu/.
Resolved by applying the chnages from the latter on the moved
file.
* mm/Kconfig
6661672053a "memblock: add NO_BOOTMEM config symbol"
c378ddd53f9 "memblock, x86: Make ARCH_DISCARD_MEMBLOCK a config option"
conflicted trivially. Both added config options. Just
letting both add their own options resolves the conflict.
* mm/memblock.c
d1f0ece6cdc "mm/memblock.c: small function definition fixes"
ed7b56a799c "memblock: Remove memblock_memory_can_coalesce()"
confliected. The former updates function removed by the
latter. Resolution is trivial.
Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
| -rwxr-xr-x | tools/perf/scripts/python/bin/net_dropmonitor-record | 2 | ||||
| -rwxr-xr-x | tools/perf/scripts/python/bin/net_dropmonitor-report | 4 | ||||
| -rwxr-xr-x | tools/perf/scripts/python/net_dropmonitor.py | 72 |
3 files changed, 78 insertions, 0 deletions
diff --git a/tools/perf/scripts/python/bin/net_dropmonitor-record b/tools/perf/scripts/python/bin/net_dropmonitor-record new file mode 100755 index 000000000000..423fb81dadae --- /dev/null +++ b/tools/perf/scripts/python/bin/net_dropmonitor-record | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | perf record -e skb:kfree_skb $@ | ||
diff --git a/tools/perf/scripts/python/bin/net_dropmonitor-report b/tools/perf/scripts/python/bin/net_dropmonitor-report new file mode 100755 index 000000000000..8d698f5a06aa --- /dev/null +++ b/tools/perf/scripts/python/bin/net_dropmonitor-report | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | # description: display a table of dropped frames | ||
| 3 | |||
| 4 | perf script -s "$PERF_EXEC_PATH"/scripts/python/net_dropmonitor.py $@ | ||
diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py new file mode 100755 index 000000000000..a4ffc9500023 --- /dev/null +++ b/tools/perf/scripts/python/net_dropmonitor.py | |||
| @@ -0,0 +1,72 @@ | |||
| 1 | # Monitor the system for dropped packets and proudce a report of drop locations and counts | ||
| 2 | |||
| 3 | import os | ||
| 4 | import sys | ||
| 5 | |||
| 6 | sys.path.append(os.environ['PERF_EXEC_PATH'] + \ | ||
| 7 | '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') | ||
| 8 | |||
| 9 | from perf_trace_context import * | ||
| 10 | from Core import * | ||
| 11 | from Util import * | ||
| 12 | |||
| 13 | drop_log = {} | ||
| 14 | kallsyms = [] | ||
| 15 | |||
| 16 | def get_kallsyms_table(): | ||
| 17 | global kallsyms | ||
| 18 | try: | ||
| 19 | f = open("/proc/kallsyms", "r") | ||
| 20 | linecount = 0 | ||
| 21 | for line in f: | ||
| 22 | linecount = linecount+1 | ||
| 23 | f.seek(0) | ||
| 24 | except: | ||
| 25 | return | ||
| 26 | |||
| 27 | |||
| 28 | j = 0 | ||
| 29 | for line in f: | ||
| 30 | loc = int(line.split()[0], 16) | ||
| 31 | name = line.split()[2] | ||
| 32 | j = j +1 | ||
| 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() | ||
| 39 | return | ||
| 40 | |||
| 41 | def get_sym(sloc): | ||
| 42 | loc = int(sloc) | ||
| 43 | for i in kallsyms: | ||
| 44 | if (i['loc'] >= loc): | ||
| 45 | return (i['name'], i['loc']-loc) | ||
| 46 | return (None, 0) | ||
| 47 | |||
| 48 | def print_drop_table(): | ||
| 49 | print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT") | ||
| 50 | for i in drop_log.keys(): | ||
| 51 | (sym, off) = get_sym(i) | ||
| 52 | if sym == None: | ||
| 53 | sym = i | ||
| 54 | print "%25s %25s %25s" % (sym, off, drop_log[i]) | ||
| 55 | |||
| 56 | |||
| 57 | def trace_begin(): | ||
| 58 | print "Starting trace (Ctrl-C to dump results)" | ||
| 59 | |||
| 60 | def trace_end(): | ||
| 61 | print "Gathering kallsyms data" | ||
| 62 | get_kallsyms_table() | ||
| 63 | print_drop_table() | ||
| 64 | |||
| 65 | # called from perf, when it finds a correspoinding event | ||
| 66 | def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm, | ||
| 67 | skbaddr, protocol, location): | ||
| 68 | slocation = str(location) | ||
| 69 | try: | ||
| 70 | drop_log[slocation] = drop_log[slocation] + 1 | ||
| 71 | except: | ||
| 72 | drop_log[slocation] = 1 | ||
