GstShark使用简介

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

1. OverView

  GstShark is an open-source project from RidgeRun that provides benchmarks and profiling tools for GStreamer 1.7.1 (and above). It includes tracers for generating debug information plus some tools to analyze the debug information.It's a set of data acquisition tools that yield some intermediate results and some data analysis tools that process those results.

  GstShark currently includes nine different tracers.

2. Generating Trace Files

2.1 Select Tracers

  GST_DEBUG="GST_TRACER:7" GST_TRACERS="buffer;proctime" gst-launch-1.0 -v alsasrc provide-clock=false device=hw:1,0 ! spdifdemux ! decodebin ! playsink audio-sink="alsasink device=hw:2,0 buffer-time=40000 sync=false“

2.2 Define output location

  Setting the desired location of the GstShark output files

export GST_SHARK_LOCATION=/tmp/profile

  Use the default location of the GstShark output files

unset GST_SHARK_LOCATION

2.3 Enable Or Disable Output File

  Disable the generation of the output files on GstShark

export GST_SHARK_CTF_DISABLE=TRUE

  Enable the generation of the GstShark output files

unset GST_SHARK_CTF_DISABLE

3. Trace Parameters Introduction

3.1 Syntax

tracer: the tracer to activate, i.e.: framerate, cpuusage, scheduletime, etc...

Parameters: the name of the parameter to set for the tracer

Value: the value to set to the tracer's parameter

GST_TRACERS="tracer1(parameter1=value1);tracer2(parameter2=value2)" gst-launch-1.0 ...

3.2 Examples

1. Print the amount of frames that flow every 5 seconds through the different src pads in the pipe

GST_TRACERS="framerate(period=5)" GST_DEBUG=GST_TRACER:7

2. Print the amount of frames that flow every 5 seconds and bits that flow every 3 seconds through the different src pads in the pipe

GST_TRACERS="framerate(period=5);bitrate(period=3)" GST_DEBUG=GST_TRACER:7

3. Print the amount of frames that flow every 5 through the identity

GST_TRACERS="framerate(period=5,filter=identity);bitrate(period=3)" GST_DEBUG=GST_TRACER:7

4. Store log to the files

GST_DEBUG_NO_COLOR=1 GST_DEBUG_FILE=spdifdemux_auto_mode_shark.log GST_DEBUG="GST_TRACER:7" GST_TRACERS="buffer;proctime" gst-launch-1.0 -v alsasrc provide-clock=false device=hw:1,0 ! spdifdemux ! decodebin ! playsink audio-sink="alsasink device=hw:2,0 buffer-time=40000 sync=false"

4. File Directory Structure

  GstShark outputs two sets of data that are relevant for the debug of the pipelines.

4.1 Common Trace Format files

  The Common Trace Format (CTF) describes a very fast, yet flexible way of storing trace data. The data is stored in binary format.The CTF output folder include two files, datastream and metadata. The file directory is as below.

gstshark_2021-11-20_16:15:30

  • datastream
  • Graphic: pipeline0_2021-11-20_16\:15\:34.dot …
  • metadata

4.2 Pipeline Diagram

  The GstShark graphic tracers triggers a local window to open using the Graphviz libraries. It also saves the diagram in the directed-graph dot format.

4.2.1 Using the local window

  A local window is generated using the Graphviz libraries showing the diagram of the current pipeline. This diagram window lives during the lifetime of the pipeline and will be closed once the pipeline finishes or it is ended by the user. Likewise, closing the diagram window will terminate the pipeline

4.2.2 Using an external viewer

  For Ubuntu and Debian systems, the Python-based dot utility is available from the repositories and can be easily installed.

  1. Generate dot file

GST_DEBUG="GST_TRACER:7" GST_TRACERS="graphic" gst-launch-1.0 -v alsasrc provide-clock=false device=hw:1,0 ! spdifdemux ! decodebin ! playsink audio-sink="alsasink device=hw:2,0 buffer-time=40000 sync=false“

  2. Convert dot file to a PNG format image

dot -Tpng pipeline0_2021-11-20_16\:15\:34.dot -o pipeline.png

5. Analysis tools

  GstShark provides some analysis tools that will help in parsing and extracting useful information from the trace data.

  Gstshark-plot script needs to run from the path inside the repository

1. Enter the path inside the repo

cd gst-shark\scripts\graphics

2. Run the script

./gstshark-plot  gstshark_xxx/ –s png

6. Build GstShark

1. Getting the code

git clone https://github.com/RidgeRun/gst-shark/

2. Install compiler toolchain

According to the specific platform. May need to modify configure.ac file in Gstshark repo to fix some compiling errors on some platforms, the details are shown below.

7. Install

7.1 Install GstShark lib

  • /usr/lib/: libgstshark.la, libgstshark.so, libgstshark.so.0, libgstshark.so.0.0.0
  • /usr/lib/gstreamer-1.0: libgstsharktracers.so libgstsharktracers.la

7.2 Dependencies

  • GStreamer 1.7.1+
  • Graphviz: Graphviz is used to display the pipeline diagrams as obtained by the graphic tracer
  • octave, epstool and babeltrace: Octave scripts are provided to generate charts of the traces. Octave scripts use babeltrace to parse the trace files to be used by Octave and epstool to generate the PDF outputs. Octave, epstool and babeltrace are not required for compiling GstShark but are required to run the scripts

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值