GstShark - CPU usage tracer

From RidgeRun Developer Connection
Revision as of 15:30, 6 July 2017 by Jrivera (talk | contribs)
Jump to: navigation, search


Schedule time tracer

Home

Graphic tracer

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.

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.

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.

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.

Pipeline

 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

Test cpuusage.png

Output

0:00:00.021681078 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)0, load=(double)5,965772;
0:00:00.021712923 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)1, load=(double)3,932041;
0:00:00.021720127 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)2, load=(double)6,802571;
0:00:00.021725434 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)3, load=(double)4,453254;
0:00:00.021730069 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)4, load=(double)5,946335;
0:00:00.021734686 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)5, load=(double)2,949401;
0:00:00.021739030 13940 0xce2c50 TRACE GST_TRACER :0:: cpuusage, number=(uint)6, load=(double)6,299569;
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;


Additional notes

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.


Schedule time tracer

Home

Graphic tracer