[Performance/debug] Implement debug feature
authorsewon.oh <sewon.oh@samsung.com>
Fri, 20 Jul 2018 05:38:08 +0000 (14:38 +0900)
committer함명주/동작제어Lab(SR)/Principal Engineer/삼성전자 <myungjoo.ham@samsung.com>
Fri, 27 Jul 2018 01:24:18 +0000 (10:24 +0900)
- Make png file about pipeline when run ./testAll.sh

Signed-off-by: Sewon Oh <sewon.oh@samsung.com>
.gitignore
tests/README.md [new file with mode: 0644]
tests/testAPI.sh
tests/testAll.sh

index d7952fe..35e529e 100644 (file)
@@ -9,6 +9,7 @@
 /tests/*/*.golden
 /tests/*/*.png
 /tests/*/*.bmp
+/tests/performance
 
 # vi files
 *.h~
diff --git a/tests/README.md b/tests/README.md
new file mode 100644 (file)
index 0000000..e3a6f81
--- /dev/null
@@ -0,0 +1,43 @@
+# How to measure performance of testcases.
+
+This documents is for describing how to measure performance of testcase.
+
+Three features will be supported.
+
+- Tracing(TBD)
+- Debugging
+- Profiling(TBD)
+
+refer: https://github.sec.samsung.net/STAR/nnstreamer/issues/67
+
+## Tracing
+
+Not implemented yet.
+
+## Debugging
+
+### Pre-requirements
+
+- eog
+- gsteamer1.0-tools
+- graphviz(dot)
+
+```bash
+sudo apt install graphviz
+```
+
+- Build with cmake in nnstreamer/build folder.
+
+### How to
+
+```bash
+nnstreamer/test$ ./testAll.sh 1
+nnstreamer/test$ cd performance/debug/tensor_convertor
+$ eog ${number_of_test_case}.png
+```
+
+then, you can see elements and caps in pipeline.
+
+## Profiling
+
+Not implemented yet.
index 4cd9c1d..8190d71 100644 (file)
@@ -65,6 +65,10 @@ function gstTest {
                lfail=$((lfail+1))
                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
+               rm $GST_DEBUG_DUMP_DOT_DIR/*.dot
+       fi
 }
 
 ##
index b316281..59ebdb6 100755 (executable)
@@ -1,8 +1,17 @@
 #!/usr/bin/env bash
-dirpath=`dirname $0`
+dirpath="$( cd "$( dirname "$0")" && pwd )"
 
-source $dirpath/testAPI.sh
+if [[ $1 -eq 1 ]]; then
+export GST_DEBUG_DUMP_DOT_DIR=$dirpath/performance/debug
+export PERFORMANCE=1
+mkdir -p $GST_DEBUG_DUMP_DOT_DIR
+fi
+shift 1
+source $dirpath/testAPI.sh 
 
+if [[ $PERFORMANCE -eq 1 ]]; then
+       checkDependency dot
+fi
 checkDependency dirname
 checkDependency basename
 checkDependency sed
@@ -18,7 +27,11 @@ declare -i failed=0
 
 while IFD= read -r -d $'\0' line; do
        dir=$(dirname "${line}")
-       base=$(basename ${dir})
+       export base=$(basename ${dir})
+
+       if [[ $PERFORMANCE -eq 1 ]]; then
+               mkdir -p $GST_DEBUG_DUMP_DOT_DIR/$base
+       fi
 
        log="${log}=================================================\n"
        log="${log}${BLUE}Testing${NC}: ${PURPLE}${base}${NC}\n"