Real-time plots update
In several situations, data is generated in real time, and we want to plot it as it comes. Being able to process data and generate dynamic plots that are continuously updated is very interesting.
We are going to present an example where we take a sample of a quantity, and we show its progression in a real-time plot.
The information we will collect is CPU utilization; in a modern operating system, there are several processes always running on a machine, each using a part of the CPU time. On a Unix system, we can identify the major part of the time as being used by:
System processes (
sys)User processes (
user)User processes with lower priority, for example, for background processing (
nice)Time not used (
idle)
Between parenthesis, we reported the name that we will use in our code to represent that slice of CPU usage.
We will use an additional module,psutil (available at http://code.google.com/p/psutil/), to gather information about CPU usage. The module is cross-platform...