[Performance/profile] Implement profile feature
authorsewon.oh <sewon.oh@samsung.com>
Thu, 2 Aug 2018 03:58:14 +0000 (12:58 +0900)
committer함명주/동작제어Lab(SR)/Principal Engineer/삼성전자 <myungjoo.ham@samsung.com>
Mon, 6 Aug 2018 07:10:40 +0000 (16:10 +0900)
You can know time and cpu usage in pipeline using same command './testAll.sh 1'.

Signed-off-by: sewon.oh <sewon.oh@samsung.com>
tests/README.md
tests/testAPI.sh
tests/testAll.sh

index e3a6f81..febf336 100644 (file)
@@ -6,7 +6,7 @@ Three features will be supported.
 
 - Tracing(TBD)
 - Debugging
-- Profiling(TBD)
+- Profiling(in progress)
 
 refer: https://github.sec.samsung.net/STAR/nnstreamer/issues/67
 
@@ -40,4 +40,28 @@ then, you can see elements and caps in pipeline.
 
 ## Profiling
 
-Not implemented yet.
+### Pre-requirements
+
+- autoreconf
+- pkg-config
+- automake
+- libtool
+- gst-instruments
+
+```bash
+$ git clone https://github.com/kirushyk/gst-instruments.git
+$ cd gst-instruments
+$ ./autogen.sh
+$ make
+$ sudo make install
+```
+
+### How to
+
+```bash
+nnstreamer/test$ ./testAll.sh 1
+nnstreamer/test$ cd performance/profile/tensor_convertor
+$ eog ${number_of_test_case}.svg
+```
+
+then, you can see time and cpu usage in pipeline.
index de32579..5455a19 100644 (file)
@@ -66,8 +66,10 @@ function gstTest {
                log="${log}$RED[FAILED] gst-launch with case $2$NC\n"
        fi
        if [[ $PERFORMANCE -eq 1 ]]; then
-               dot -Tpng $GST_DEBUG_DUMP_DOT_DIR/*.PLAYING_PAUSED.dot > $GST_DEBUG_DUMP_DOT_DIR/$base/$2.png
+               dot -Tpng $GST_DEBUG_DUMP_DOT_DIR/*.PLAYING_PAUSED.dot > $GST_DEBUG_DUMP_DOT_DIR/debug/$base/$2.png
+               gst-report-1.0 --dot $GST_DEBUG_DUMP_DOT_DIR/*.gsttrace | dot -Tsvg > $GST_DEBUG_DUMP_DOT_DIR/profile/$base/$2.svg
                rm $GST_DEBUG_DUMP_DOT_DIR/*.dot
+               rm $GST_DEBUG_DUMP_DOT_DIR/*.gsttrace
        fi
 }
 
index 59ebdb6..d649d76 100755 (executable)
@@ -2,7 +2,9 @@
 dirpath="$( cd "$( dirname "$0")" && pwd )"
 
 if [[ $1 -eq 1 ]]; then
-export GST_DEBUG_DUMP_DOT_DIR=$dirpath/performance/debug
+export GST_DEBUG_DUMP_DOT_DIR=$dirpath/performance
+export LD_PRELOAD=/usr/local/lib/libgstintercept.so
+export GST_DEBUG_DUMP_TRACE_DIR=$GST_DEBUG_DUMP_DOT_DIR
 export PERFORMANCE=1
 mkdir -p $GST_DEBUG_DUMP_DOT_DIR
 fi
@@ -11,6 +13,7 @@ source $dirpath/testAPI.sh
 
 if [[ $PERFORMANCE -eq 1 ]]; then
        checkDependency dot
+       checkDependency gst-report-1.0
 fi
 checkDependency dirname
 checkDependency basename
@@ -30,7 +33,8 @@ while IFD= read -r -d $'\0' line; do
        export base=$(basename ${dir})
 
        if [[ $PERFORMANCE -eq 1 ]]; then
-               mkdir -p $GST_DEBUG_DUMP_DOT_DIR/$base
+               mkdir -p $GST_DEBUG_DUMP_DOT_DIR/debug/$base
+               mkdir -p $GST_DEBUG_DUMP_DOT_DIR/profile/$base
        fi
 
        log="${log}=================================================\n"