[beast: 7/16] TESTS: revieve perftest via legacy C interface
- From: Tim Janik <timj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [beast: 7/16] TESTS: revieve perftest via legacy C interface
- Date: Sun, 13 Sep 2015 20:27:15 +0000 (UTC)
commit b314282160b5ecfd22fa92ea8964b79da856fd12
Author: Tim Janik <timj gnu org>
Date: Fri Sep 11 00:11:33 2015 +0200
TESTS: revieve perftest via legacy C interface
tests/Makefile.am | 29 +++--------------------------
tests/perftest.cc | 26 ++++++++++++++++----------
2 files changed, 19 insertions(+), 36 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index af3547b..394289d 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -12,29 +12,6 @@ SFIDL = $(top_builddir)/sfi/sfidl
SFIDL_INC = --nostdinc -I$(top_srcdir) -I$(top_builddir)
-
-# === rules to generate built sources ===
-#
-# bsecxxapi.hh
-#GENERATED_CLEANFILES += bsecxxapi.hh
-#$(srcdir)/perftest.cc: bsecxxapi.hh
-#bsecxxapi.hh: $(top_srcdir)/bse/bse.idl $(SFIDL)
-# cd . \
-# && echo -e "#include <sfi/sficxx.hh>\n" > xgen-$(@F) \
-# && $(SFIDL) --client-cxx $(SFIDL_INC) --header $(top_srcdir)/bse/bse.idl >> xgen-$(@F) \
-# && cp xgen-$(@F) $@ \
-# && rm -f xgen-$(@F)
-# bsecxxapi.cc
-#GENERATED_CLEANFILES += bsecxxapi.cc
-#$(srcdir)/perftest.cc: bsecxxapi.cc
-#bsecxxapi.cc: bsecxxapi.hh $(top_srcdir)/bse/bse.idl $(SFIDL)
-# cd . \
-# && echo -e "#include \"bsecxxapi.hh\"\n" > xgen-$(@F) \
-# && $(SFIDL) --client-cxx $(SFIDL_INC) --source $(top_srcdir)/bse/bse.idl >> xgen-$(@F) \
-# && cp xgen-$(@F) $@ \
-# && rm -f xgen-$(@F)
-
-
# === generation targets ===
# convenience targets for generated source files
.PHONY: generated clean-generated
@@ -53,9 +30,9 @@ SLOWTESTS += testwavechunk
testwavechunk_SOURCES = testwavechunk.cc
testwavechunk_LDADD = $(progs_ldadd)
# perftest
-#TESTS += perftest
-#perftest_SOURCES = perftest.cc bsecxxapi.cc
-#perftest_LDADD = $(progs_ldadd)
+TESTS += perftest
+perftest_SOURCES = perftest.cc
+perftest_LDADD = $(progs_ldadd)
# testresampler
noinst_PROGRAMS += testresampler
testresampler_SOURCES = testresampler.cc
diff --git a/tests/perftest.cc b/tests/perftest.cc
index c24c27e..f9a03af 100644
--- a/tests/perftest.cc
+++ b/tests/perftest.cc
@@ -1,39 +1,45 @@
// Licensed GNU LGPL v2.1 or later: http://www.gnu.org/licenses/lgpl.html
-#include "bsecxxapi.hh"
#include <bse/bse.hh>
+#include <../beast-gtk/bstoldbseapi.h>
#include <unistd.h>
#include <sys/time.h>
#include <time.h>
#include <stdio.h>
-static SfiGlueContext *bse_context = NULL;
+
using namespace Bse;
using namespace std;
-double
+
+static SfiGlueContext *bse_context = NULL;
+
+static double
gettime ()
{
timeval tv;
gettimeofday (&tv, 0);
return double(tv.tv_sec) + double(tv.tv_usec) * (1.0 / 1000000.0);
}
-int main (int argc, char **argv)
+
+int
+main (int argc, char **argv)
{
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
Bse::init_async (&argc, argv, "Perftest");
bse_context = Bse::init_glue_context (argv[0], []() { g_main_context_wakeup (g_main_context_default()); });
sfi_glue_context_push (bse_context);
- printf ("%s: testing remote glue layer calls via C++ interface:\n", argv[0]);
- const int max_calls = 30000;
+ printf ("%s: testing remote glue layer calls via legacy C interface:\n", argv[0]);
+ const int max_calls = 60000;
const int runs = 7;
double t = 1e7;
for (int r = 0; r < runs; r++)
{
double start = gettime ();
for(int i=0; i < max_calls; i++)
- note_to_freq (MUSICAL_TUNING_12_TET, 60, 0);
+ bse_note_to_freq (BSE_MUSICAL_TUNING_12_TET, 60, 0);
t = std::min (gettime () - start, t);
}
- printf ("%f seconds for %d invocations => %f invocations/second, %f milli seconds per invocation\n",
- t, max_calls, max_calls / t, t * 1000 / max_calls);
+ printf ("%f seconds for %d invocations => %f invocations/second, %f µseconds per invocation\n",
+ t, max_calls, max_calls / t, t * 1000000. / max_calls);
sfi_glue_context_pop ();
}
-/* vim:set ts=8 sts=2 sw=2: */
+
+#include <../beast-gtk/bstoldbseapi.cc>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]