diff options
author | Stefan Sauer <ensonic@users.sf.net> | 2016-01-16 13:30:34 +0100 |
---|---|---|
committer | Stefan Sauer <ensonic@users.sf.net> | 2016-01-16 13:31:51 +0100 |
commit | 7801a46e5fedef6f0f89a4d9b0ffe50434875e99 (patch) | |
tree | 8251115f9f55e3f0b43cf94c3b9bfcf349a2c11c /tests | |
parent | 2d5ba30606378e1d018a77a2f9e2ca686518c495 (diff) |
benchmarks: update the tracer benchmark and add a shell benchmark
Diffstat (limited to 'tests')
-rw-r--r-- | tests/benchmarks/tracerserialize.c | 27 | ||||
-rwxr-xr-x | tests/benchmarks/tracing.sh | 37 |
2 files changed, 63 insertions, 1 deletions
diff --git a/tests/benchmarks/tracerserialize.c b/tests/benchmarks/tracerserialize.c index 814750610..5d2c3e4fc 100644 --- a/tests/benchmarks/tracerserialize.c +++ b/tests/benchmarks/tracerserialize.c @@ -49,6 +49,19 @@ log_gst_structure (const gchar * name, const gchar * first, ...) } static void +log_gst_structure_tmpl (const gchar * format, ...) +{ + va_list var_args; + + va_start (var_args, format); + if (G_LIKELY (GST_LEVEL_TRACE <= _gst_debug_min)) { + gst_debug_log_valist (GST_CAT_DEFAULT, GST_LEVEL_TRACE, __FILE__, + GST_FUNCTION, __LINE__, NULL, format, var_args); + } + va_end (var_args); +} + +static void log_g_variant (const gchar * format, ...) { va_list var_args; @@ -78,6 +91,7 @@ main (gint argc, gchar * argv[]) "ts", G_TYPE_UINT64, (guint64) 0, "index", G_TYPE_UINT, 10, "test", G_TYPE_STRING, "hallo", + "bool", G_TYPE_BOOLEAN, TRUE, "flag", GST_TYPE_PAD_DIRECTION, GST_PAD_SRC, NULL); } end = gst_util_get_timestamp (); @@ -85,7 +99,18 @@ main (gint argc, gchar * argv[]) start = gst_util_get_timestamp (); for (i = 0; i < NUM_LOOPS; i++) { - log_g_variant ("(stusu)", "name", (guint64) 0, 10, "hallo", GST_PAD_SRC); + log_gst_structure_tmpl ("name, ts=(guint64)%" G_GUINT64_FORMAT + ", index=(uint)%u, test=(string)%s, bool=(boolean)%s, flag=(GstPadDirection)%d;", + (guint64) 0, 10, "hallo", (TRUE ? "true" : "false"), GST_PAD_SRC); + } + end = gst_util_get_timestamp (); + g_print ("%" GST_TIME_FORMAT ": GstStructure template\n", + GST_TIME_ARGS (end - start)); + + start = gst_util_get_timestamp (); + for (i = 0; i < NUM_LOOPS; i++) { + log_g_variant ("(stusbu)", "name", (guint64) 0, 10, "hallo", TRUE, + GST_PAD_SRC); } end = gst_util_get_timestamp (); g_print ("%" GST_TIME_FORMAT ": GVariant\n", GST_TIME_ARGS (end - start)); diff --git a/tests/benchmarks/tracing.sh b/tests/benchmarks/tracing.sh new file mode 100755 index 000000000..1717c591d --- /dev/null +++ b/tests/benchmarks/tracing.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# simple benchmark to check the overhead of the tracers +# +# tracers can be a list of tracers separated using ';' + +if [ -z "$1" ]; then + echo "Usage: $0 <tracer(s)> [<file>]" + exit 1 +fi + +tracer=$1 + +if [ -z "$2" ]; then + file=$(ls -1R $HOME/Music/ | grep -v "/:" | head -n1) + file=$(ls $HOME/Music/$file) +else + file=$2 +fi + +echo "testing $tracer on $file" +cat $file >/dev/null + +function test() { + GST_DEBUG_FILE=trace.log /usr/bin/gst-launch-1.0 playbin uri=file://$file audio-sink="fakesink sync=false" video-sink="fakesink sync=false" | grep "Execution ended after" | sed 's/Execution ended after//' +} + +echo "$tracer" +GST_DEBUG="GST_TRACER:7" GST_TRACE="$tracer" test +GST_DEBUG= + +echo "no-log" +GST_TRACER_PLUGINS="$tracer" test +GST_TRACER_PLUGINS= + +echo "reference" +test + |