使用gst-shark

安裝

git clone https://github.com/RidgeRun/gst-shark/
apt install octave epstool babeltrace gtk-doc-tools
apt install graphviz libgraphviz-dev

編譯

sudo apt install python3 python3-pip ninja-build
pip3 install –user meson
sudo cp ~/.local/bin/meson /usr/bin/meson

meson builddir –prefix /usr/
ninja -C builddir

安裝

ninja install -C builddir

如果有更動gst-shark的程式碼,則需要重新編譯安裝

ninja -C builddir
ninja install -C builddir

在deepstream使用gst-shark的時候會需要修改以下程式碼並且重新編譯,以免出錯
gst_shark_tracer_hook_pad_push_pre,要檢查GST_OBJECT_PARENT的結果是不是NULL,是就return,修改如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* My hooks */
static void
gst_shark_tracer_hook_pad_push_pre (GObject * object, GstClockTime ts,
GstPad * pad, GstBuffer * buffer)
{
GstSharkTracer *self = GST_SHARK_TRACER (object);
GstSharkTracerPrivate *priv = GST_SHARK_TRACER_PRIVATE (self);
GCallback hook;
const gchar *elname;

GstObject* gst_obj = GST_OBJECT_PARENT (pad);
if (gst_obj == NULL){
return;
}
elname = GST_OBJECT_NAME (gst_obj);
if (FALSE == gst_shark_tracer_element_is_filtered (self, elname)) {
return;
}

hook = g_hash_table_lookup (priv->hooks, "pad-push-pre");
g_return_if_fail (hook);

((void (*)(GObject *, GstClockTime, GstPad *, GstBuffer *)) hook) (object, ts,
pad, buffer);
}

使用

export GST_SHARK_LOCATION=/root/apps/iisi-ds64/iisi-ds63/my_exp/shark
export GST_DEBUG=”GST_TRACER:7”
export GST_TRACERS=”queuelevel”

執行deepstream,並且用q結束程式,確認shark底下的metadata有資料

下面是產生圖片的方式

cd gst-shark/scripts/graphics

Display the plot on the screen

./gstshark-plot /root/apps/iisi-ds64/iisi-ds63/my_exp/shark -p

Save the plot to a PDF

./gstshark-plot /root/apps/iisi-ds64/iisi-ds63/my_exp/shark -s pdf

Save the plot to a PNG

./gstshark-plot /root/apps/iisi-ds64/iisi-ds63/my_exp/shark -s png

Author

Steven

Posted on

2025-04-01

Updated on

2025-04-02

Licensed under

Comments