scripts/pacplot
2021-12-03 08:49:14 -06:00

26 lines
559 B
Python
Executable file

#!/usr/bin/env python3
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:
continue
if 'installed' in line:
cnt += 1
elif 'upgraded' in line:
pass
elif 'removed' in line:
cnt -= 1
else:
continue
x.append(datetime.fromisoformat(line[1:23] + ':00'))
y.append(cnt)
plt.scatter(x, y)
plt.show()