参考:https://www.it610.com/article/1277920951371055104.htm
https://github.com/RidgeRun/gst-perf
GstShark是Ridgerun的一个开源项目,为GStreamer 1.7.1(及更高版本)提供基准和性能分析工具。它包括用于生成调试信息的跟踪器以及一些用于分析调试信息的工具。GstShark的跟踪器包含以下类型:
Tracer Description
InterLatency Measures the latency time at different points in the pipeline.
ProcTime Measures the time an element takes to produce an output given the corresponding input.
Framerate Measures the amount of frames that go through a src pad every second.
ScheduleTime Measures the amount of time between two consecutive buffers in a sink pad. T
CPUUsage Measures the CPU usage every second. In multiprocessor systems this measurements are presented per core.
Graphic Records a graphical representation of the current pipeline.
Bitrate Measures the current stream bitrate in bits per second.
Queue Level Measures the amount of data queued in every queue element in the pipeline.
Buffer Prints information of every buffer that passes through every sink pad in the pipeline. This information contains PTS and DTS, duration, size, flags and even refcount.
生成的结果有两种类型
安装依赖
sudo apt install libgstreamer1.0-dev
sudo apt install graphviz libgraphviz-dev
sudo apt install octave epstool babeltrace
下载源码
git clone https://github.com/RidgeRun/gst-shark.git
cd gst-shark
./autogen.sh --prefix /usr/ --libdir /usr/lib/aarch64-linux-gnu/
make
sudo make install
会在/usr/lib/aarch64-linux-gnu/gstreamer-1.0/下生成libgstsharktracers.la和libgstsharktracers.so
使用
export GST_SHARK_LOCATION=/your/location
GST_DEBUG=“GST_TRACER:7” GST_TRACERS=“proctime” ./deepstream-test1-app …/…/…/…/samples/streams/sample_720p.h264
会在/your/location路径生成文件夹
gstshark_2020-06-19_18:06:07/
├── datastream
└── metadata
在 gst-shark 源码目录下,有一个 scripts/graphics 文件夹,里边保存了我们要用到的 gstshark-plot 工具,所以先进入到工具目录中
cd ${GSTSHARK_REPO}/scripts/graphics
./gstshark-plot /yourpath/deepstream-test1/gstshark_2020-06-19_18:06:07 -s png
部分结果:
osd耗时:0:00:00.011110325
nvegltransform耗时:0:00:00.002927814
主检测器耗时:0:00:00.055362536 (检测车辆和人体)
nvtracker耗时:0:00:00.000509953;
secondary-infer-engine1耗时:0:00:00.00852792(lpd检测)
secondary-infer-engine2耗时:0:00:00.000504641(lpr)
nvtiler耗时:0:00:00.014010170
nvvid-converter耗时:0:00:00.001157154;
rtpjitterbuffer2不知道是干嘛的
lpr
0:01:23.667968963 20232 0x559d206d90 TRACE GST_TRACER :0:: proctime, element=(string)nv-onscreendisplay, time=(string)0:00:00.011110325;
0:01:23.672311819 20232 0x559d1f6cf0 TRACE GST_TRACER :0:: proctime, element=(string)nvegltransform, time=(string)0:00:00.002927814;
0:01:23.703432614 20232 0x559d206de0 TRACE GST_TRACER :0:: proctime, element=(string)primary1-infer-engine1, time=(string)0:00:00.055362536;
0:01:23.703721926 20232 0x559d31c140 TRACE GST_TRACER :0:: proctime, element=(string)queue2, time=(string)0:00:00.000339009;
0:01:23.704192359 20232 0x559d31c0f0 TRACE GST_TRACER :0:: proctime, element=(string)nvtracker, time=(string)0:00:00.000509953;
0:01:23.704262087 20232 0x559d31c320 TRACE GST_TRACER :0:: proctime, element=(string)queue3, time=(string)0:00:00.000075744;
0:01:23.704462632 20232 0x559d31c320 TRACE GST_TRACER :0:: proctime, element=(string)nvdsanalytics, time=(string)0:00:00.000200417;
0:01:23.713308824 20232 0x559d1f6e80 TRACE GST_TRACER :0:: proctime, element=(string)secondary-infer-engine1, time=(string)0:00:00.008527920;
0:01:23.713612921 20232 0x559cff46d0 TRACE GST_TRACER :0:: proctime, element=(string)queue5, time=(string)0:00:00.000368353;
0:01:23.714119002 20232 0x559cff4b70 TRACE GST_TRACER :0:: proctime, element=(string)secondary-infer-engine2, time=(string)0:00:00.000504641;
0:01:23.714209370 20232 0x559d31c280 TRACE GST_TRACER :0:: proctime, element=(string)queue6, time=(string)0:00:00.000083712;
0:01:23.726090448 20232 0x559d31c370 TRACE GST_TRACER :0:: proctime, element=(string)queue1, time=(string)0:00:00.077411986;
0:01:23.728243060 20232 0x559d31c280 TRACE GST_TRACER :0:: proctime, element=(string)nvtiler, time=(string)0:00:00.014010170;
0:01:23.728861302 20232 0x559d206d40 TRACE