GstShark - CPU usage tracer: Difference between revisions

From RidgeRun Developer Wiki
No edit summary
No edit summary
Line 3: Line 3:
|next=[[GstShark - Graphic tracer|Graphic tracer]]
|next=[[GstShark - Graphic tracer|Graphic tracer]]
|name=CPUusage
|name=CPUusage
|description=The CPU usage tracer was designed to measure the load on the CPU at the time of running a determined pipeline, giving the user the possibility of knowing immediately if the host system is capable of running the pipeline without overcharging the cores of the CPU. It is important to mention that the measurements displayed every second by the tracer correspond to the total load of the CPU and it is not the exact data of the load of the pipeline at the time of running it; but regarding of this, the measurements done and printed on the output log give a pretty good idea of how the load of the CPU is behaving at the time of running the pipeline and with this it is possible to check if the pipeline produces an unexpected and undesired increase of the load of the CPU that could cause a failure on the system or a wrong operation of the pipeline, without mattering if it is correctly designed.
|description=The CPU usage tracer measures the load on the CPU at the time of running a determined pipeline. This gives the user a way of knowing immediately if the host system is capable of running the pipeline without overcharging the cores of the CPU. It is important to mention that the measurements displayed every second by the tracer correspond to the total load of the CPU and it is not the exact data of the load caused by the pipeline at the time of running it. However, the measurements made and printed on the output log give a good idea of how the load of the CPU is behaving at the time of running the pipeline. With this information, it is possible to check if the pipeline produces an unexpected and undesired increase of the load of the CPU that could cause a failure on the system or a failure of the pipeline due to lack of resources.


The CPU usage tracer has the capability of measuring every core of the system, ergo, in a multiprocessor system the tracer is capable of measuring the load on every core of the CPU and showing it to the user on the output log, giving an idea of the effect that the pipeline has on the total CPU consumption on the system.
The CPU usage tracer has the capability of measuring every core of the system. In a multiprocessor system, the output log will include the load of each individual core, giving an idea of the effect that the pipeline has on the total CPU consumption on the system.  


Currently this tracer is only available for GNU/Linux based systems, since the method used to determine the load on every core available is reading the /proc/stat file and this path belongs only the GNU/Linux system the CPU usage tracer cannot be use on any other systems like a Macintosh box or a Microsoft Windows box; GstShark has already integrated a functionality to check the Operating System of the host in which it is running and depending on this it will disable the CPU usage tracer if it is needed, preventing the user of dealing with unnecessary errors.  
Currently this tracer is only available for GNU/Linux based systems, since the method used to determine the load on every core available is by reading the /proc/stat file. Windows and Mac systems do not support this method, so are not supported. The GstShark tracers check the Operating System of the host in which it is running and depending on this it will disable the CPU usage tracer if it is needed, preventing the user of dealing with unnecessary errors.
 
The CPU usage tracer has no limitation with using elements of any category.


In order to provide an example and show the output log that the CPU usage tracer generates; the following pipeline was tested, it contents nine elements numbered from left to right connected as the following graph shows. It is important to notice that the CPU usage tracer has no limitation with any element category which means, and as it exemplified on the following pipeline, that the tracer is able of providing the CPU consumption, in-live, at the time of running the pipeline regardless of the elements used on the pipeline; in this example there are elements of all categories available to demonstrate this point. Besides de the pipeline and graph of it, there is also the output log obtained with the CPU usage tracer that in this case was tested on a multiprocessor system with a total 8 cores available.
|graph=[[File:test_cpuusage.png|1000px|center]]
|graph=[[File:test_cpuusage.png|1000px|center]]
|pipeline=
|pipeline=
<pre style="white-space:pre-wrap; width:100%;">
The following pipeline provides a guide of the usage of the CPU usage tracer and the results obtained.  It provides the CPU usage, regardless of the elements of the pipeline. In this example there are elements of all categories available.
GST_DEBUG="GST_TRACER:7" GST_TRACERS="cpuusage" gst-launch-1.0 videotestsrc ! '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
 
</pre>
<syntaxhighlight lang=bash>
$ GST_DEBUG="GST_TRACER:7" GST_TRACERS="cpuusage" gst-launch-1.0 videotestsrc ! '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
</syntaxhighlight>
|output=
|output=
<font size=1>
<font size=1>
<pre>
<pre>0:00:14.941266921 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)0, load=(double)7.000000;
0:00:00.021681078 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)0, load=(double)5,965772;
0:00:14.941324948 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)1, load=(double)7.000000;
0:00:00.021712923 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)1, load=(double)3,932041;
0:00:14.941396919 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)2, load=(double)7.000000;
0:00:00.021720127 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)2, load=(double)6,802571;
0:00:14.941420125 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)3, load=(double)8.080808;
0:00:00.021725434 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)3, load=(double)4,453254;
0:00:14.941441788 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)4, load=(double)6.122449;
0:00:00.021730069 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)4, load=(double)5,946335;
0:00:14.941461533 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)5, load=(double)11.000000;
0:00:00.021734686 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)5, load=(double)2,949401;
0:00:14.941485901 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)6, load=(double)8.000000;
0:00:00.021739030 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)6, load=(double)6,299569;
0:00:14.941507391 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)7, load=(double)8.163265;</pre>
0:00:00.021743425 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)7, load=(double)3,650192;
0:00:01.022001083 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)0, load=(double)5,050505;
0:00:01.022046715 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)1, load=(double)10,891088;
0:00:01.022060643 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)2, load=(double)8,000000;
0:00:01.022070346 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)3, load=(double)19,387754;
0:00:01.022079678 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)4, load=(double)23,762377;
0:00:01.022088843 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)5, load=(double)2,020202;
0:00:01.022097063 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)6, load=(double)9,900990;
0:00:01.022105207 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)7, load=(double)4,040404;
0:00:02.022299915 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)0, load=(double)4,901961;
0:00:02.022336454 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)1, load=(double)3,030303;
0:00:02.022347269 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)2, load=(double)7,070707;
0:00:02.022356243 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)3, load=(double)10,101010;
0:00:02.022366425 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)4, load=(double)7,843138;
0:00:02.022377344 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)5, load=(double)14,141414;
0:00:02.022390904 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)6, load=(double)23,000000;
0:00:02.022405063 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)7, load=(double)0,000000;
0:00:03.022832110 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)0, load=(double)4,950495;
0:00:03.022934822 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)1, load=(double)3,030303;
0:00:03.022973647 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)2, load=(double)5,940594;
0:00:03.023005315 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)3, load=(double)10,101010;
0:00:03.023039830 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)4, load=(double)7,920792;
0:00:03.023075592 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)5, load=(double)15,000001;
0:00:03.023110909 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)6, load=(double)10,784314;
0:00:03.023144687 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)7, load=(double)2,000000;
0:00:04.023416231 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)0, load=(double)6,862745;
0:00:04.023451754 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)1, load=(double)3,960396;
0:00:04.023461598 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)2, load=(double)20,202021;
0:00:04.023468868 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)3, load=(double)18,181818;
0:00:04.023475339 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)4, load=(double)8,823529;
0:00:04.023481643 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)5, load=(double)2,020202;
0:00:04.023487167 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)6, load=(double)5,102041;
0:00:04.023492490 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)7, load=(double)1,010101;
</pre>
</font>
</font>
|closing=The output log of the CPU usage presents the ID of the core that is being measured and the load of it in percentage format with 0% as the minimum value and 100% as the maximum value; the measurements are also displayed with several decimals values in order to increase the accuracy. From the results above is not possible to specify the load that the pipeline is consuming but it is possible to ensure that the pipeline does not represent a heavy task for the system and that the system is capable of running pipeline, along with some others processes, successfully without affecting the performance neither of the system or pipeline.
 
For each line in the output log, the tracer provides a {{code|number}} field that identifies the core number and a {{code|load}} field that identifies the core's load at the time. The test run shown in the output was done using an 8-core processor, so cores from 0 to 7 are listed.
 
|plot=[[File:test_cpuusage_plot.png|1000px|center]]
 
}}
}}

Revision as of 21:02, 17 August 2017


Schedule time tracer

Home

Graphic tracer

The CPU usage tracer measures the load on the CPU at the time of running a determined pipeline. This gives the user a way of knowing immediately if the host system is capable of running the pipeline without overcharging the cores of the CPU. It is important to mention that the measurements displayed every second by the tracer correspond to the total load of the CPU and it is not the exact data of the load caused by the pipeline at the time of running it. However, the measurements made and printed on the output log give a good idea of how the load of the CPU is behaving at the time of running the pipeline. With this information, it is possible to check if the pipeline produces an unexpected and undesired increase of the load of the CPU that could cause a failure on the system or a failure of the pipeline due to lack of resources.

The CPU usage tracer has the capability of measuring every core of the system. In a multiprocessor system, the output log will include the load of each individual core, giving an idea of the effect that the pipeline has on the total CPU consumption on the system.

Currently this tracer is only available for GNU/Linux based systems, since the method used to determine the load on every core available is by reading the /proc/stat file. Windows and Mac systems do not support this method, so are not supported. The GstShark tracers check the Operating System of the host in which it is running and depending on this it will disable the CPU usage tracer if it is needed, preventing the user of dealing with unnecessary errors.

The CPU usage tracer has no limitation with using elements of any category.

Pipeline

The following pipeline provides a guide of the usage of the CPU usage tracer and the results obtained. It provides the CPU usage, regardless of the elements of the pipeline. In this example there are elements of all categories available.

$ GST_DEBUG="GST_TRACER:7" GST_TRACERS="cpuusage" gst-launch-1.0 videotestsrc ! '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

Sample diagram

Output

0:00:14.941266921 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)0, load=(double)7.000000;
0:00:14.941324948 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)1, load=(double)7.000000;
0:00:14.941396919 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)2, load=(double)7.000000;
0:00:14.941420125 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)3, load=(double)8.080808;
0:00:14.941441788 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)4, load=(double)6.122449;
0:00:14.941461533 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)5, load=(double)11.000000;
0:00:14.941485901 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)6, load=(double)8.000000;
0:00:14.941507391 20322      0x15c5400 TRACE             GST_TRACER :0:: cpuusage, number=(uint)7, load=(double)8.163265;

For each line in the output log, the tracer provides a number field that identifies the core number and a load field that identifies the core's load at the time. The test run shown in the output was done using an 8-core processor, so cores from 0 to 7 are listed.

Plot

File:Test cpuusage plot.png

Schedule time tracer

Home

Graphic tracer