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


被折叠的 条评论
为什么被折叠?



