From: Ben Hutchings <hidden> Date: 2013-05-21 00:43:15
Somewhat surprisingly, the net_dropmonitor reporting script doesn't work
at all. This series fixes it and then makes it slightly more efficient.
Ben.
Ben Hutchings (5):
perf: net_dropmonitor: Fix trace parameter order
perf: net_dropmonitor: Fix symbol-relative addresses
perf: net_dropmonitor: Do not assume ordering of dictionaries
perf: net_dropmonitor: Use bisection in symbol lookup
perf: net_dropmonitor: Remove progress indicator
tools/perf/scripts/python/net_dropmonitor.py | 39 ++++++++++++++------------
1 file changed, 21 insertions(+), 18 deletions(-)
From: Ben Hutchings <hidden> Date: 2013-05-21 00:44:51
This works much better if we don't treat protocol numbers as addresses.
Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <redacted>
---
tools/perf/scripts/python/net_dropmonitor.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -64,7 +64,7 @@ def trace_end():# called from perf, when it finds a correspoinding eventdefskb__kfree_skb(name,context,cpu,sec,nsec,pid,comm,-skbaddr,protocol,location):+skbaddr,location,protocol):slocation=str(location)try:drop_log[slocation]=drop_log[slocation]+1
From: Ben Hutchings <hidden> Date: 2013-05-21 00:45:33
The comparison between traced and symbol addresses is backwards: if
the traced address doesn't exactly match a symbol (which we don't
expect it to), we'll show the next symbol and the offset to it,
whereas we should show the previous symbol and the offset from it.
Cc: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <redacted>
---
tools/perf/scripts/python/net_dropmonitor.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
From: Ben Hutchings <hidden> Date: 2013-05-21 00:45:41
The sort order of dictionaries in Python is undocumented. Use
tuples instead, which are documented to be lexically ordered.
Signed-off-by: Ben Hutchings <redacted>
---
tools/perf/scripts/python/net_dropmonitor.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
@@ -40,10 +40,24 @@ def get_kallsyms_table():defget_sym(sloc):loc=int(sloc)-forsymloc,nameinkallsyms[::-1]:-ifloc>=symloc:-return(name,loc-symloc)-return(None,0)++# Invariant: kallsyms[i][0] <= loc for all 0 <= i <= start+# kallsyms[i][0] > loc for all end <= i < len(kallsyms)+start,end=-1,len(kallsyms)+whileend!=start+1:+pivot=(start+end)//2+ifloc<kallsyms[pivot][0]:+end=pivot+else:+start=pivot++# Now (start == -1 or kallsyms[start][0] <= loc)+# and (start == len(kallsyms) - 1 or loc < kallsyms[start + 1][0])+ifstart>=0:+symloc,name=kallsyms[start]+return(name,loc-symloc)+else:+return(None,0)defprint_drop_table():print"%25s%25s%25s"%("LOCATION","OFFSET","COUNT")
From: Ben Hutchings <hidden> Date: 2013-05-21 00:46:07
We can read /proc/kallsyms in a fraction of a second, so why waste
a further fraction of a second showing progress?
Signed-off-by: Ben Hutchings <redacted>
---
tools/perf/scripts/python/net_dropmonitor.py | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
From: Neil Horman <nhorman@tuxdriver.com> Date: 2013-05-21 13:34:15
On Tue, May 21, 2013 at 01:42:56AM +0100, Ben Hutchings wrote:
Somewhat surprisingly, the net_dropmonitor reporting script doesn't work
at all. This series fixes it and then makes it slightly more efficient.
Ben.
It worked fine when I first submitted it. I wonder if there was a paramter
order change at some point that I wasn't CC'ed on.
Either way, this all looks good. Thanks Ben.
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Ben Hutchings (5):
perf: net_dropmonitor: Fix trace parameter order
perf: net_dropmonitor: Fix symbol-relative addresses
perf: net_dropmonitor: Do not assume ordering of dictionaries
perf: net_dropmonitor: Use bisection in symbol lookup
perf: net_dropmonitor: Remove progress indicator
tools/perf/scripts/python/net_dropmonitor.py | 39 ++++++++++++++------------
1 file changed, 21 insertions(+), 18 deletions(-)
From: Neil Horman <nhorman@tuxdriver.com> Date: 2013-05-21 16:12:27
On Tue, May 21, 2013 at 02:54:00PM +0100, Ben Hutchings wrote:
On Tue, 2013-05-21 at 09:33 -0400, Neil Horman wrote:
quoted
On Tue, May 21, 2013 at 01:42:56AM +0100, Ben Hutchings wrote:
quoted
Somewhat surprisingly, the net_dropmonitor reporting script doesn't work
at all. This series fixes it and then makes it slightly more efficient.
Ben.
It worked fine when I first submitted it. I wonder if there was a paramter
order change at some point that I wasn't CC'ed on.
The parameter order for the trace event changed in 2.6.39, but that was
before this script went in.
Ben.
Yeah, thats how this happened. I posted right before 2.6.39, which was around
July 4th:
https://lkml.org/lkml/2011/7/4/273
So I posted it, and shortly thereafter the perf infrastructure changed. Acme
didnt actually pull the patch in until Well into August, and so it was borked
from there. I never noticed as I had been using the netlink based utility since
that time.
Thanks for catching this!
Neil
quoted
Either way, this all looks good. Thanks Ben.
Acked-by: Neil Horman <nhorman@tuxdriver.com>
quoted
Ben Hutchings (5):
perf: net_dropmonitor: Fix trace parameter order
perf: net_dropmonitor: Fix symbol-relative addresses
perf: net_dropmonitor: Do not assume ordering of dictionaries
perf: net_dropmonitor: Use bisection in symbol lookup
perf: net_dropmonitor: Remove progress indicator
tools/perf/scripts/python/net_dropmonitor.py | 39 ++++++++++++++------------
1 file changed, 21 insertions(+), 18 deletions(-)
--
Ben Hutchings
friends: People who know you well, but like you anyway.
From: David Miller <davem@davemloft.net> Date: 2013-05-22 22:11:15
From: Neil Horman <nhorman@tuxdriver.com>
Date: Tue, 21 May 2013 09:33:56 -0400
On Tue, May 21, 2013 at 01:42:56AM +0100, Ben Hutchings wrote:
quoted
Somewhat surprisingly, the net_dropmonitor reporting script doesn't work
at all. This series fixes it and then makes it slightly more efficient.
Ben.
It worked fine when I first submitted it. I wonder if there was a paramter
order change at some point that I wasn't CC'ed on.
Either way, this all looks good. Thanks Ben.
Acked-by: Neil Horman <nhorman@tuxdriver.com>