Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- import csv
- import numpy
- import matplotlib.pyplot as plot
- if len (sys.argv) < 2:
- print "Input filename missing"
- exit(-1)
- data = list(csv.reader(open(sys.argv[1]), delimiter = ';'))
- array = numpy.array(data).astype("float")
- cpu = array[:, 0]
- mem = array[:, 1]
- fig, (a1, b1) = plot.subplots(2, 1)
- b1.hist(numpy.round(cpu))
- b1.set_title('CPU usage histogram')
- a1.set_title('Memory & CPU usage')
- a1.plot(mem, 'b--')
- a1.set_ylabel('Memory usage', color='b')
- a2 = a1.twinx()
- a2.plot(cpu, 'r*')
- a2.set_ylabel('CPU usage in %', color='r')
- plot.show()
Add Comment
Please, Sign In to add comment