mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 16:21:17 +00:00
Benchmark rippling
This commit is contained in:
parent
feb85a1456
commit
f2d389d37f
4 changed files with 124 additions and 2 deletions
14
configure.ac
14
configure.ac
|
@ -246,6 +246,19 @@ fi
|
||||||
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
|
AM_CONDITIONAL(HAVE_GTK, test "x$HAVE_GTK" = "xyes")
|
||||||
AM_CONDITIONAL(HAVE_GTK_X11, test "x$HAVE_GTK_X11" = "xyes")
|
AM_CONDITIONAL(HAVE_GTK_X11, test "x$HAVE_GTK_X11" = "xyes")
|
||||||
|
|
||||||
|
dnl building of benchmarks
|
||||||
|
AC_ARG_ENABLE(benchmarks,
|
||||||
|
AS_HELP_STRING([--disable-benchmarks],[disable building benchmarks apps]),
|
||||||
|
[
|
||||||
|
case "${enableval}" in
|
||||||
|
yes) BUILD_BENCHMARKS=yes ;;
|
||||||
|
no) BUILD_BENCHMARKS=no ;;
|
||||||
|
*) AC_MSG_ERROR(bad value ${enableval} for --disable-benchmarks) ;;
|
||||||
|
esac
|
||||||
|
],
|
||||||
|
[BUILD_BENCHMARKS=yes]) dnl Default value
|
||||||
|
AM_CONDITIONAL(BUILD_BENCHMARKS, test "x$BUILD_BENCHMARKS" = "xyes")
|
||||||
|
|
||||||
dnl set license and copyright notice
|
dnl set license and copyright notice
|
||||||
GST_LICENSE="LGPL"
|
GST_LICENSE="LGPL"
|
||||||
AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
|
AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license])
|
||||||
|
@ -335,6 +348,7 @@ m4/Makefile
|
||||||
ges/Makefile
|
ges/Makefile
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
tests/check/Makefile
|
tests/check/Makefile
|
||||||
|
tests/benchmarks/Makefile
|
||||||
tests/examples/Makefile
|
tests/examples/Makefile
|
||||||
tools/Makefile
|
tools/Makefile
|
||||||
docs/Makefile
|
docs/Makefile
|
||||||
|
|
|
@ -10,7 +10,13 @@ else
|
||||||
EXAMPLES_SUBDIRS=
|
EXAMPLES_SUBDIRS=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
SUBDIRS= $(CHECK_SUBDIRS) $(EXAMPLES_SUBDIRS)
|
if BUILD_BENCHMARKS
|
||||||
|
BENCHMARKS_SUBDIR=benchmarks
|
||||||
|
else
|
||||||
|
BENCHMARKS_SUBDIR=
|
||||||
|
endif
|
||||||
|
|
||||||
DIST_SUBDIRS = check examples
|
SUBDIRS= $(CHECK_SUBDIRS) $(EXAMPLES_SUBDIRS) $(BENCHMARKS_SUBDIR)
|
||||||
|
|
||||||
|
DIST_SUBDIRS = check examples benchmarks
|
||||||
|
|
||||||
|
|
5
tests/benchmarks/Makefile.am
Normal file
5
tests/benchmarks/Makefile.am
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
noinst_PROGRAMS = timeline
|
||||||
|
|
||||||
|
AM_CFLAGS = -I$(top_srcdir) $(GST_PBUTILS_CFLAGS) $(GST_CFLAGS)
|
||||||
|
AM_LDFLAGS = -export-dynamic
|
||||||
|
LDADD = $(top_builddir)/ges/libges-@GST_API_VERSION@.la $(GST_PBUTILS_LIBS) $(GST_LIBS)
|
97
tests/benchmarks/timeline.c
Normal file
97
tests/benchmarks/timeline.c
Normal file
|
@ -0,0 +1,97 @@
|
||||||
|
/* Gstreamer Editing Services
|
||||||
|
*
|
||||||
|
* Copyright (C) <2012> Thibault Saunier <thibault.saunier@collabora.com>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Library General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Library General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Library General Public
|
||||||
|
* License along with this library; if not, write to the
|
||||||
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
* Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ges/ges.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define NUM_OBJECTS 1000
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar * argv[])
|
||||||
|
{
|
||||||
|
guint i;
|
||||||
|
GESAsset *asset;
|
||||||
|
GESTimeline *timeline;
|
||||||
|
GESTimelineLayer *layer;
|
||||||
|
GESTimelineObject *object;
|
||||||
|
GstClockTime start, start_ripple, end, end_ripple, max_rippling_time = 0,
|
||||||
|
min_rippling_time = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
ges_init ();
|
||||||
|
asset = ges_asset_request (GES_TYPE_TIMELINE_TEST_SOURCE, NULL, NULL);
|
||||||
|
|
||||||
|
layer = ges_timeline_layer_new ();
|
||||||
|
timeline = ges_timeline_new_audio_video ();
|
||||||
|
ges_timeline_add_layer (timeline, layer);
|
||||||
|
|
||||||
|
start = gst_util_get_timestamp ();
|
||||||
|
object = GES_TIMELINE_OBJECT (ges_timeline_layer_add_asset (layer, asset, 0,
|
||||||
|
0, 1000, 1, GES_TRACK_TYPE_UNKNOWN));
|
||||||
|
|
||||||
|
for (i = 1; i < NUM_OBJECTS; i++)
|
||||||
|
ges_timeline_layer_add_asset (layer, asset, i * 1000, 0,
|
||||||
|
1000, 1, GES_TRACK_TYPE_UNKNOWN);
|
||||||
|
end = gst_util_get_timestamp ();
|
||||||
|
g_print ("%" GST_TIME_FORMAT " - adding %d object to the timeline\n",
|
||||||
|
GST_TIME_ARGS (end - start), i);
|
||||||
|
|
||||||
|
start_ripple = gst_util_get_timestamp ();
|
||||||
|
for (i = 1; i < 501; i++) {
|
||||||
|
start = gst_util_get_timestamp ();
|
||||||
|
ges_timeline_object_edit (object, NULL, 0, GES_EDIT_MODE_NORMAL,
|
||||||
|
GES_EDGE_NONE, i * 1000);
|
||||||
|
end = gst_util_get_timestamp ();
|
||||||
|
max_rippling_time = MAX (max_rippling_time, end - start);
|
||||||
|
min_rippling_time = MIN (min_rippling_time, end - start);
|
||||||
|
}
|
||||||
|
end_ripple = gst_util_get_timestamp ();
|
||||||
|
g_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
|
||||||
|
GST_TIME_FORMAT " min: %" GST_TIME_FORMAT "\n",
|
||||||
|
GST_TIME_ARGS (end_ripple - start_ripple), i - 1,
|
||||||
|
GST_TIME_ARGS (max_rippling_time), GST_TIME_ARGS (min_rippling_time));
|
||||||
|
|
||||||
|
|
||||||
|
min_rippling_time = GST_CLOCK_TIME_NONE;
|
||||||
|
max_rippling_time = 0;
|
||||||
|
ges_timeline_layer_set_auto_transition (layer, TRUE);
|
||||||
|
start_ripple = gst_util_get_timestamp ();
|
||||||
|
for (i = 1; i < 501; i++) {
|
||||||
|
start = gst_util_get_timestamp ();
|
||||||
|
ges_timeline_object_edit (object, NULL, 0, GES_EDIT_MODE_NORMAL,
|
||||||
|
GES_EDGE_NONE, i * 1000);
|
||||||
|
end = gst_util_get_timestamp ();
|
||||||
|
max_rippling_time = MAX (max_rippling_time, end - start);
|
||||||
|
min_rippling_time = MIN (min_rippling_time, end - start);
|
||||||
|
}
|
||||||
|
end_ripple = gst_util_get_timestamp ();
|
||||||
|
g_print ("%" GST_TIME_FORMAT " - rippling %d times, max: %"
|
||||||
|
GST_TIME_FORMAT " min: %" GST_TIME_FORMAT " (with auto-transition on)\n",
|
||||||
|
GST_TIME_ARGS (end_ripple - start_ripple), i - 1,
|
||||||
|
GST_TIME_ARGS (max_rippling_time), GST_TIME_ARGS (min_rippling_time));
|
||||||
|
|
||||||
|
start = gst_util_get_timestamp ();
|
||||||
|
gst_object_unref (timeline);
|
||||||
|
end = gst_util_get_timestamp ();
|
||||||
|
g_print ("%" GST_TIME_FORMAT " - freeing the timeline\n",
|
||||||
|
GST_TIME_ARGS (end - start));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue