aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorBen Hutchings <ben@decadent.org.uk>2013-05-20 10:45:34 -0400
committerDavid S. Miller <davem@davemloft.net>2013-05-22 18:10:10 -0400
commit326017c757e387007c6629797d7ae22fd33c1317 (patch)
treef787bb0dbb463f1520673ad264ae16d78eec3d95 /tools/perf/scripts/python
parent5a1e99dd2028e00998d42029be86835d8ef4a46e (diff)
perf: net_dropmonitor: Do not assume ordering of dictionaries
The sort order of dictionaries in Python is undocumented. Use tuples instead, which are documented to be lexically ordered. Signed-off-by: Ben Hutchings <ben@decadent.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools/perf/scripts/python')
-rwxr-xr-xtools/perf/scripts/python/net_dropmonitor.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py
index 4c1160560917..6acdc82ef47f 100755
--- a/tools/perf/scripts/python/net_dropmonitor.py
+++ b/tools/perf/scripts/python/net_dropmonitor.py
@@ -32,7 +32,7 @@ def get_kallsyms_table():
32 j = j +1 32 j = j +1
33 if ((j % 100) == 0): 33 if ((j % 100) == 0):
34 print "\r" + str(j) + "/" + str(linecount), 34 print "\r" + str(j) + "/" + str(linecount),
35 kallsyms.append({ 'loc': loc, 'name' : name}) 35 kallsyms.append((loc, name))
36 36
37 print "\r" + str(j) + "/" + str(linecount) 37 print "\r" + str(j) + "/" + str(linecount)
38 kallsyms.sort() 38 kallsyms.sort()
@@ -40,9 +40,9 @@ def get_kallsyms_table():
40 40
41def get_sym(sloc): 41def get_sym(sloc):
42 loc = int(sloc) 42 loc = int(sloc)
43 for i in kallsyms[::-1]: 43 for symloc, name in kallsyms[::-1]:
44 if loc >= i['loc']: 44 if loc >= symloc:
45 return (i['name'], loc - i['loc']) 45 return (name, loc - symloc)
46 return (None, 0) 46 return (None, 0)
47 47
48def print_drop_table(): 48def print_drop_table():