[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1369097134.3469.134.camel@deadeye.wl.decadent.org.uk>
Date: Tue, 21 May 2013 01:45:34 +0100
From: Ben Hutchings <ben@...adent.org.uk>
To: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>,
Ingo Molnar <mingo@...hat.com>
Cc: Neil Horman <nhorman@...driver.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 3/5] 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@...adent.org.uk>
---
tools/perf/scripts/python/net_dropmonitor.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/scripts/python/net_dropmonitor.py b/tools/perf/scripts/python/net_dropmonitor.py
index 4c11605..6acdc82e 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():
Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)
Powered by blists - more mailing lists