diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2013-05-20 14:45:34 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-05-22 15:10:10 -0700 |
commit | 326017c757e387007c6629797d7ae22fd33c1317 (patch) | |
tree | f787bb0dbb463f1520673ad264ae16d78eec3d95 /tools | |
parent | 5a1e99dd2028e00998d42029be86835d8ef4a46e (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')
-rwxr-xr-x | tools/perf/scripts/python/net_dropmonitor.py | 8 |
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(): j = j +1 if ((j % 100) == 0): print "\r" + str(j) + "/" + str(linecount), - kallsyms.append({ 'loc': loc, 'name' : name}) + kallsyms.append((loc, name)) print "\r" + str(j) + "/" + str(linecount) kallsyms.sort() @@ -40,9 +40,9 @@ def get_kallsyms_table(): def get_sym(sloc): loc = int(sloc) - for i in kallsyms[::-1]: - if loc >= i['loc']: - return (i['name'], loc - i['loc']) + for symloc, name in kallsyms[::-1]: + if loc >= symloc: + return (name, loc - symloc) return (None, 0) def print_drop_table(): |