Skip to content

Instantly share code, notes, and snippets.

@tshev
Last active August 29, 2015 14:01
Show Gist options
  • Save tshev/8e6eaeeedda6be5e3e26 to your computer and use it in GitHub Desktop.
Save tshev/8e6eaeeedda6be5e3e26 to your computer and use it in GitHub Desktop.
Siege visualisation
%pylab inline
import matplotlib.pylab as plt
import re
class Vs:
def __init__(self,fname):
self.fname = fname
self.readDate()
self.count = 0
self.time = []
def readDate(self):
self.count = 0
self.time = []
resL, timeL = [], []
regex = re.compile("\s+")
for i in open(self.fname):
self.count+=1
res, time = regex.split(i)[1:3]
resL.append(res.strip())
timeL.append(time.strip())
return resL[0:-5], timeL[0:-5]
res, time = Vs("/home/tshev/higload.test").readDate()
r = [float(i) for i in time if i.find(".")]
plt.hist(r)
plt.xlabel("Time of the page load")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment