about summary refs log tree commit diff
path: root/served/things/memoryleak/files/filter.py
blob: 10594e8292ec6d9e04cf757c35fffb3900ef9398 (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
#!/usr/bin/python3
import sys as isys

with open('did') as logs:
	ln = 0

	sys = 0
	proc = 0
	persistent = 0

	for line in logs:
		ln += 1

		splits = line.strip().split(' ')
		path = splits[-1]

		if path.startswith("/sys"):
			sys += 1
			continue
		
		if path.startswith("/proc"):
			proc += 1
			continue

		persistent += 1
		print(f"{ln:>3}: {path}")
	
	# print to stderr so we can pipe the output to a file and extract the persistent deletions
	print(f"there were {sys} /sys files deleted", file=isys.stderr)
	print(f"there were {proc} /proc files deleted", file=isys.stderr)
	print(f"there were {persistent} persistent files deleted", file=isys.stderr)
	print(f"equalling {sys + proc + persistent} total files", file=isys.stderr)