scripts/pacplot

27 lines
558 B
Text
Raw Normal View History

2022-01-06 00:34:40 +00:00
#!/usr/bin/python
2021-12-03 14:49:14 +00:00
from datetime import datetime
from matplotlib import pyplot as plt
with open('/var/log/pacman.log', 'r') as f:
cnt = 0
x = []
y = []
for line in f.readlines():
if 'PACKAGEKIT' in line:
# Ignore packagekit operations
2021-12-03 14:49:14 +00:00
continue
if ' installed' in line:
2021-12-03 14:49:14 +00:00
cnt += 1
elif 'removed' in line:
cnt -= 1
else:
continue
2021-12-03 14:49:14 +00:00
x.append(datetime.fromisoformat(line[1:23] + ':00'))
y.append(cnt)
plt.scatter(x, y)
plt.show()