GstShark - Example: CPU usage analysis
Open-source project from Ridgerun. |
GstShark |
---|
Getting Started |
Generating trace files |
Tracer Parameters |
Available Tracers |
Results |
Visualization Tools |
Examples |
Contact Us |
The CPU usage tracer was developed with the purpose of measuring the load on the CPU at the time of running a determined pipeline; this tracer has the capability of measuring every core of the system, which means that in a multiprocessor system the tracer is capable of measuring the load on every core, giving an idea of the effort that running the pipeline means for the CPU and the effect on the total CPU consumption. Refer to the GstShark User's Guide GstShark for more detailed information.
|
Description
The following pipeline is an example used for showing the load on the CPU introduced by running an encoding pipeline. The caps of the pipeline set a frame rate value of 30 FPS and the fakesink element is configured to not synchronize with the clock of the pipeline (normally it is the system clock), therefore the pipeline tries to produce the maximum frame rate using the 100% of the resources of the cores available in the processor as it can be seen on the plot of the results obtained right after the test pipeline.
Original pipeline
Pipeline:
GST_DEBUG="GST_TRACER:7" GST_TRACERS="cpuusage" gst-launch-1.0 videotestsrc num-buffers=10000 ! 'video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=(fraction)30/1' ! videorate max-rate=30 ! videoconvert ! queue ! avenc_h263p ! queue ! avimux ! fakesink
Result:
Improving the pipeline
With the purpose of making a comparison and checking the behavior of the CPU usage tracer to different circumstances, the element fakesink was configured to be synchronized with the clock of pipeline, which means that each element is executed 30 times per second, according to the caps of the pipeline; and therefore the CPU usage will decrease as it is shown on the plot at following.
Pipeline:
GST_DEBUG="GST_TRACER:7" GST_TRACERS="cpuusage" gst-launch-1.0 videotestsrc num-buffers=900 ! 'video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=(fraction)30/1' ! videorate max-rate=30 ! videoconvert ! queue ! avenc_h263p ! queue ! avimux ! fakesink sync=true
Result:
Result comparison
In addition to the results obtained through the CPU usage tracer and the plots through the scripts from the GstShark application, is possible to get a comparison graph between CPU Usage and frame rate depending only on the tracers selected at the time of running the pipeline. This is a feature, limited only to the CPU usage and frame rate tracers, and the only extra step needed is to add the frame rate tracer to the previous pipeline as it is shown on the following box, the resulting plot is presented after the pipeline run:
GST_DEBUG="GST_TRACER:7" GST_TRACERS="cpuusage;framerate" gst-launch-1.0 videotestsrc num-buffers=900 ! 'video/x-raw, format=(string)YUY2, width=(int)640, height=(int)480, framerate=(fraction)30/1' ! videorate max-rate=30 ! videoconvert ! queue ! avenc_h263p ! queue ! avimux ! fakesink sync=true