Guest User

Untitled

a guest
May 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/usr/bin/python
  2. import sys
  3. import csv
  4. import numpy
  5. import matplotlib.pyplot as plot
  6.  
  7. if len (sys.argv) < 2:
  8. print "Input filename missing"
  9. exit(-1)
  10.  
  11. data = list(csv.reader(open(sys.argv[1]), delimiter = ';'))
  12. array = numpy.array(data).astype("float")
  13. cpu = array[:, 0]
  14. mem = array[:, 1]
  15. fig, (a1, b1) = plot.subplots(2, 1)
  16. b1.hist(numpy.round(cpu))
  17. b1.set_title('CPU usage histogram')
  18. a1.set_title('Memory & CPU usage')
  19. a1.plot(mem, 'b--')
  20. a1.set_ylabel('Memory usage', color='b')
  21. a2 = a1.twinx()
  22. a2.plot(cpu, 'r*')
  23. a2.set_ylabel('CPU usage in %', color='r')
  24.  
  25. plot.show()
Add Comment
Please, Sign In to add comment