Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 45add05 commit ff81c9cCopy full SHA for ff81c9c
1 file changed
examples/pylab_examples/system_monitor.py
@@ -1,24 +1,27 @@
1
-#!/usr/bin/env python
2
-# -*- noplot -*-
3
import time
4
import matplotlib.pyplot as plt
5
import numpy as np
6
+
7
def get_memory():
8
"Simulate a function that returns system memory"
9
return 100*(0.5 + 0.5*np.sin(0.5*np.pi*time.time()))
10
11
def get_cpu():
12
"Simulate a function that returns cpu usage"
13
return 100*(0.5 + 0.5*np.sin(0.2*np.pi*(time.time() - 0.25)))
14
15
16
def get_net():
17
"Simulate a function that returns network bandwidth"
18
return 100*(0.5 + 0.5*np.sin(0.7*np.pi*(time.time() - 0.1)))
19
20
21
def get_stats():
22
return get_memory(), get_cpu(), get_net()
23
24
25
# turn interactive mode on for dynamic updates. If you aren't in
26
# interactive mode, you'll need to use a GUI event handler/timer.
27
plt.ion()
0 commit comments