blob: 235064670873e163a591380aa28a65fe2d239c55 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
#!/usr/bin/python3
from sys import stdin
from struct import unpack
profile = stdin.buffer.read()
hosts = {}
for resp in [profile[i:i+32] for i in range(0, len(profile), 32)]:
ssec, snsec, rsec, rusec = unpack("!LLLL", resp[0:16])
ipaddr = resp[16:32]
if ipaddr not in hosts:
hosts[ipaddr] = {}
stime = ssec*1000000000+snsec
rtime = rsec*1000000000+rusec
hosts[ipaddr][stime] = rtime-stime
from numpy.fft import rfft
import numpy as np
import matplotlib
matplotlib.use("GTK3Cairo")
from matplotlib import pyplot as plt
for host in hosts:
N = 10
fft = np.absolute(rfft(list(hosts[host].values())))
fft = np.convolve(fft, np.ones(N)/N, mode='valid')
plt.plot(list(range(len(fft))), fft)
plt.show()
|