summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python/net_dropmonitor.py
blob: a4ffc95000238cde8f086970f9d23d042ba99c59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Monitor the system for dropped packets and proudce a report of drop locations and counts

import os
import sys

sys.path.append(os.environ['PERF_EXEC_PATH'] + \
		'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')

from perf_trace_context import *
from Core import *
from Util import *

drop_log = {}
kallsyms = []

def get_kallsyms_table():
	global kallsyms
	try:
		f = open("/proc/kallsyms", "r")
		linecount = 0
		for line in f:
			linecount = linecount+1
		f.seek(0)
	except:
		return


	j = 0
	for line in f:
		loc = int(line.split()[0], 16)
		name = line.split()[2]
		j = j +1
		if ((j % 100) == 0):
			print "\r" + str(j) + "/" + str(linecount),
		kallsyms.append({ 'loc': loc, 'name' : name})

	print "\r" + str(j) + "/" + str(linecount)
	kallsyms.sort()
	return

def get_sym(sloc):
	loc = int(sloc)
	for i in kallsyms:
		if (i['loc'] >= loc):
			return (i['name'], i['loc']-loc)
	return (None, 0)

def print_drop_table():
	print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT")
	for i in drop_log.keys():
		(sym, off) = get_sym(i)
		if sym == None:
			sym = i
		print "%25s %25s %25s" % (sym, off, drop_log[i])


def trace_begin():
	print "Starting trace (Ctrl-C to dump results)"

def trace_end():
	print "Gathering kallsyms data"
	get_kallsyms_table()
	print_drop_table()

# called from perf, when it finds a correspoinding event
def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm,
			skbaddr, protocol, location):
	slocation = str(location)
	try:
		drop_log[slocation] = drop_log[slocation] + 1
	except:
		drop_log[slocation] = 1
elease() for updating new cache slot instead of cmpxchg()Ard Biesheuvel 2022-10-21EDAC/ghes: Make ghes_edac a proper moduleJia He 2022-10-21EDAC/ghes: Prepare to make ghes_edac a proper moduleJia He 2022-10-20EDAC/ghes: Add a notifier for reporting memory errorsJia He 2022-10-13ACPI: APEI: Fix integer overflow in ghes_estatus_pool_init()Ashish Kalra 2022-10-04ACPI: APEI: do not add task_work to kernel thread to avoid memory leakShuai Xue 2022-09-24ACPI: APEI: Remove unneeded result variablesye xingchen 2022-09-03ACPI: APEI: Add BERT error log footerDmitry Monakhov 2022-06-29ACPI: APEI: Fix _EINJ vs EFI_MEMORY_SPDan Williams 2022-06-29ACPI: APEI: Better fix to avoid spamming the console with old error logsTony Luck 2022-06-09ACPI: APEI: Fix double word in a commentXiang wangx 2022-04-22ACPI, APEI, EINJ: Refuse to inject into the zero pageTony Luck 2022-04-13ACPI: APEI: Fix missing ERST record idLiu Xinpeng 2022-03-22ACPI, APEI: Use the correct variable for sizeof()Jakob Koschel 2022-03-09ACPI/APEI: Limit printable size of BERT table dataDarren Hart 2022-03-08ACPI: APEI: fix return value of __setup handlersRandy Dunlap 2022-03-03ACPI: APEI: rename ghes_init() with an "acpi_" prefixShuai Xue 2022-03-03ACPI: APEI: explicit init of HEST and GHES in apci_init()Shuai Xue 2021-11-15x86/sgx: Add check for SGX pages to ghes_do_memory_failure()Tony Luck 2021-11-15x86/sgx: Add hook to error injection address validationTony Luck 2021-10-27ACPI: APEI: mark apei_hest_parse() staticChristoph Hellwig 2021-10-27ACPI: APEI: EINJ: Relax platform response timeout to 1 secondShuai Xue