From: Ben Hutchings <ben@decadent.org.uk>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>
Cc: Neil Horman <nhorman@tuxdriver.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/5] perf: net_dropmonitor: Do not assume ordering of dictionaries
Date: Tue, 21 May 2013 01:45:34 +0100 [thread overview]
Message-ID: <1369097134.3469.134.camel@deadeye.wl.decadent.org.uk> (raw)
In-Reply-To: <1369096976.3469.131.camel@deadeye.wl.decadent.org.uk>
[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]
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>
---
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():
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2013-05-21 0:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-21 0:42 [PATCH 0/5] perf: net_dropmonitor: Make it work and make it fast Ben Hutchings
2013-05-21 0:44 ` [PATCH 1/5] perf: net_dropmonitor: Fix trace parameter order Ben Hutchings
2013-05-21 0:45 ` [PATCH 2/5] perf: net_dropmonitor: Fix symbol-relative addresses Ben Hutchings
2013-05-21 0:45 ` Ben Hutchings [this message]
2013-05-21 0:45 ` [PATCH 4/5] perf: net_dropmonitor: Use bisection in symbol lookup Ben Hutchings
2013-05-21 0:45 ` [PATCH 5/5] perf: net_dropmonitor: Remove progress indicator Ben Hutchings
2013-05-21 13:33 ` [PATCH 0/5] perf: net_dropmonitor: Make it work and make it fast Neil Horman
2013-05-21 13:54 ` Ben Hutchings
2013-05-21 16:06 ` Neil Horman
2013-05-21 16:12 ` Neil Horman
2013-05-22 22:11 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369097134.3469.134.camel@deadeye.wl.decadent.org.uk \
--to=ben@decadent.org.uk \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®