Created
May 11, 2019 17:44
-
-
Save JustAPerson/d7e0c25ad60b91e2b9c6614298e64469 to your computer and use it in GitHub Desktop.
convert output of `ping domain > file` into a graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
import matplotlib.pyplot as plot | |
file_name = sys.argv[1] | |
with open(file_name) as f: | |
data = f.read() | |
domain = re.search('PING (.+) 56', data) | |
seq = re.findall('icmp_seq=(\d+)', data) | |
time = re.findall('time=([\d\.]+) ms', data) | |
seq = list(map(int, seq)) | |
time = list(map(float, time)) | |
plot.title(domain.group(1)) | |
plot.ylabel('rtt (ms)') | |
plot.xlabel('time (s)') | |
plot.plot(seq, time) | |
plot.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment