diff options
Diffstat (limited to 'src/stream')
-rw-r--r-- | src/stream/Makefile.am | 58 | ||||
-rw-r--r-- | src/stream/Makefile.in | 245 | ||||
-rw-r--r-- | src/stream/perf_stream_api.c | 1047 | ||||
-rw-r--r-- | src/stream/stream.h (renamed from src/stream/stream_protocol.h) | 31 | ||||
-rw-r--r-- | src/stream/stream_api.c | 1814 | ||||
-rw-r--r-- | src/stream/test_stream_2peers.c | 449 | ||||
-rw-r--r-- | src/stream/test_stream_2peers_halfclose.c | 488 | ||||
-rw-r--r-- | src/stream/test_stream_big.c | 429 | ||||
-rw-r--r-- | src/stream/test_stream_local.c | 225 | ||||
-rw-r--r-- | src/stream/test_stream_local.conf | 37 | ||||
-rw-r--r-- | src/stream/test_stream_sequence_wraparound.c | 425 |
11 files changed, 3987 insertions, 1261 deletions
diff --git a/src/stream/Makefile.am b/src/stream/Makefile.am index 8d74417..0994697 100644 --- a/src/stream/Makefile.am +++ b/src/stream/Makefile.am @@ -12,22 +12,39 @@ endif lib_LTLIBRARIES = libgnunetstream.la libgnunetstream_la_SOURCES = \ - stream_api.c stream_protocol.h + stream_api.c stream.h libgnunetstream_la_LIBADD = \ $(top_builddir)/src/mesh/libgnunetmesh.la \ + $(top_builddir)/src/lockmanager/libgnunetlockmanager.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/util/libgnunetutil.la $(XLIB) libgnunetstream_la_LDFLAGS = \ - $(GN_LIB_LDFLAGS) + $(GN_LIB_LDFLAGS) \ + -version-info 1:0:0 + +if HAVE_BENCHMARKS + STREAM_BENCHMARKS = \ + perf_stream_api +endif check_PROGRAMS = \ - test-stream-2peers \ - test-stream-2peers_halfclose \ - test-stream-local + test_stream_2peers \ + test_stream_2peers_halfclose \ + test_stream_local \ + test_stream_big \ + test_stream_sequence_wraparound \ + $(STREAM_BENCHMARKS) EXTRA_DIST = test_stream_local.conf if ENABLE_TEST_RUN -TESTS = $(check_PROGRAMS) +TESTS = \ + test_stream_2peers \ + test_stream_2peers_halfclose \ + test_stream_local \ + test_stream_big \ + test_stream_sequence_wraparound \ + $(STREAM_BENCHMARKS) endif test_stream_2peers_SOURCES = \ @@ -35,18 +52,41 @@ test_stream_2peers_SOURCES = \ test_stream_2peers_LDADD = \ $(top_builddir)/src/stream/libgnunetstream.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la + $(top_builddir)/src/testbed/libgnunettestbed.la + test_stream_2peers_halfclose_SOURCES = \ test_stream_2peers_halfclose.c test_stream_2peers_halfclose_LDADD = \ $(top_builddir)/src/stream/libgnunetstream.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la + $(top_builddir)/src/testbed/libgnunettestbed.la test_stream_local_SOURCES = \ test_stream_local.c test_stream_local_LDADD = \ $(top_builddir)/src/stream/libgnunetstream.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la
\ No newline at end of file + $(top_builddir)/src/testing/libgnunettesting.la + +test_stream_big_SOURCES = \ + test_stream_big.c +test_stream_big_LDADD = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la + +test_stream_sequence_wraparound_SOURCES = \ + test_stream_sequence_wraparound.c +test_stream_sequence_wraparound_LDADD = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la + +perf_stream_api_SOURCES = \ + perf_stream_api.c +perf_stream_api_LDADD = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/testbed/libgnunettestbed.la
\ No newline at end of file diff --git a/src/stream/Makefile.in b/src/stream/Makefile.in index 9f1c278..2422602 100644 --- a/src/stream/Makefile.in +++ b/src/stream/Makefile.in @@ -1,9 +1,9 @@ -# Makefile.in generated by automake 1.11.1 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -16,6 +16,23 @@ @SET_MAKE@ VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -35,22 +52,30 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -check_PROGRAMS = test-stream-2peers$(EXEEXT) \ - test-stream-2peers_halfclose$(EXEEXT) \ - test-stream-local$(EXEEXT) +check_PROGRAMS = test_stream_2peers$(EXEEXT) \ + test_stream_2peers_halfclose$(EXEEXT) \ + test_stream_local$(EXEEXT) test_stream_big$(EXEEXT) \ + test_stream_sequence_wraparound$(EXEEXT) $(am__EXEEXT_1) +@ENABLE_TEST_RUN_TRUE@TESTS = test_stream_2peers$(EXEEXT) \ +@ENABLE_TEST_RUN_TRUE@ test_stream_2peers_halfclose$(EXEEXT) \ +@ENABLE_TEST_RUN_TRUE@ test_stream_local$(EXEEXT) \ +@ENABLE_TEST_RUN_TRUE@ test_stream_big$(EXEEXT) \ +@ENABLE_TEST_RUN_TRUE@ test_stream_sequence_wraparound$(EXEEXT) \ +@ENABLE_TEST_RUN_TRUE@ $(am__EXEEXT_1) subdir = src/stream DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/absolute-header.m4 \ $(top_srcdir)/m4/align.m4 $(top_srcdir)/m4/argz.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ - $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libcurl.m4 \ - $(top_srcdir)/m4/libgcrypt.m4 $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/libunistring.m4 $(top_srcdir)/m4/ltdl.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glib-2.0.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libcurl.m4 $(top_srcdir)/m4/libgcrypt.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/libunistring.m4 \ + $(top_srcdir)/m4/ltdl.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/acinclude.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ @@ -80,28 +105,44 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__uninstall_files_from_dir = { \ + test -z "$$files" \ + || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ + || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ + $(am__cd) "$$dir" && rm -f $$files; }; \ + } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) am__DEPENDENCIES_1 = libgnunetstream_la_DEPENDENCIES = \ $(top_builddir)/src/mesh/libgnunetmesh.la \ + $(top_builddir)/src/lockmanager/libgnunetlockmanager.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(am__DEPENDENCIES_1) am_libgnunetstream_la_OBJECTS = stream_api.lo libgnunetstream_la_OBJECTS = $(am_libgnunetstream_la_OBJECTS) -AM_V_lt = $(am__v_lt_$(V)) -am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent libgnunetstream_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libgnunetstream_la_LDFLAGS) \ $(LDFLAGS) -o $@ +@HAVE_BENCHMARKS_TRUE@am__EXEEXT_1 = perf_stream_api$(EXEEXT) +am_perf_stream_api_OBJECTS = perf_stream_api.$(OBJEXT) +perf_stream_api_OBJECTS = $(am_perf_stream_api_OBJECTS) +perf_stream_api_DEPENDENCIES = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/testbed/libgnunettestbed.la am_test_stream_2peers_OBJECTS = test_stream_2peers.$(OBJEXT) test_stream_2peers_OBJECTS = $(am_test_stream_2peers_OBJECTS) test_stream_2peers_DEPENDENCIES = \ $(top_builddir)/src/stream/libgnunetstream.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la + $(top_builddir)/src/testbed/libgnunettestbed.la am_test_stream_2peers_halfclose_OBJECTS = \ test_stream_2peers_halfclose.$(OBJEXT) test_stream_2peers_halfclose_OBJECTS = \ @@ -109,6 +150,12 @@ test_stream_2peers_halfclose_OBJECTS = \ test_stream_2peers_halfclose_DEPENDENCIES = \ $(top_builddir)/src/stream/libgnunetstream.la \ $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testbed/libgnunettestbed.la +am_test_stream_big_OBJECTS = test_stream_big.$(OBJEXT) +test_stream_big_OBJECTS = $(am_test_stream_big_OBJECTS) +test_stream_big_DEPENDENCIES = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la am_test_stream_local_OBJECTS = test_stream_local.$(OBJEXT) test_stream_local_OBJECTS = $(am_test_stream_local_OBJECTS) @@ -116,6 +163,14 @@ test_stream_local_DEPENDENCIES = \ $(top_builddir)/src/stream/libgnunetstream.la \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la +am_test_stream_sequence_wraparound_OBJECTS = \ + test_stream_sequence_wraparound.$(OBJEXT) +test_stream_sequence_wraparound_OBJECTS = \ + $(am_test_stream_sequence_wraparound_OBJECTS) +test_stream_sequence_wraparound_DEPENDENCIES = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -126,29 +181,37 @@ LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_$(V)) -am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; -AM_V_at = $(am__v_at_$(V)) -am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_$(V)) -am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; -SOURCES = $(libgnunetstream_la_SOURCES) $(test_stream_2peers_SOURCES) \ +SOURCES = $(libgnunetstream_la_SOURCES) $(perf_stream_api_SOURCES) \ + $(test_stream_2peers_SOURCES) \ $(test_stream_2peers_halfclose_SOURCES) \ - $(test_stream_local_SOURCES) + $(test_stream_big_SOURCES) $(test_stream_local_SOURCES) \ + $(test_stream_sequence_wraparound_SOURCES) DIST_SOURCES = $(libgnunetstream_la_SOURCES) \ - $(test_stream_2peers_SOURCES) \ + $(perf_stream_api_SOURCES) $(test_stream_2peers_SOURCES) \ $(test_stream_2peers_halfclose_SOURCES) \ - $(test_stream_local_SOURCES) + $(test_stream_big_SOURCES) $(test_stream_local_SOURCES) \ + $(test_stream_sequence_wraparound_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac ETAGS = etags CTAGS = ctags am__tty_colors = \ @@ -189,6 +252,10 @@ EXEEXT = @EXEEXT@ EXT_LIBS = @EXT_LIBS@ EXT_LIB_PATH = @EXT_LIB_PATH@ FGREP = @FGREP@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GLIB_LIBS = @GLIB_LIBS@ +GLIB_MKENUMS = @GLIB_MKENUMS@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GNUNETDNS_GROUP = @GNUNETDNS_GROUP@ @@ -199,6 +266,7 @@ GN_LIBINTL = @GN_LIBINTL@ GN_LIB_LDFLAGS = @GN_LIB_LDFLAGS@ GN_PLUGIN_LDFLAGS = @GN_PLUGIN_LDFLAGS@ GN_USER_HOME_DIR = @GN_USER_HOME_DIR@ +GOBJECT_QUERY = @GOBJECT_QUERY@ GREP = @GREP@ HAVE_LIBUNISTRING = @HAVE_LIBUNISTRING@ INCLTDL = @INCLTDL@ @@ -221,6 +289,8 @@ LIBCURL_CPPFLAGS = @LIBCURL_CPPFLAGS@ LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBGTOP_CFLAGS = @LIBGTOP_CFLAGS@ +LIBGTOP_LIBS = @LIBGTOP_LIBS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBLTDL = @LIBLTDL@ @@ -242,6 +312,7 @@ LT_CONFIG_H = @LT_CONFIG_H@ LT_DLLOADERS = @LT_DLLOADERS@ LT_DLPREOPEN = @LT_DLPREOPEN@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MONKEYPREFIX = @MONKEYPREFIX@ MSGFMT = @MSGFMT@ @@ -251,6 +322,7 @@ MYSQL_CPPFLAGS = @MYSQL_CPPFLAGS@ MYSQL_LDFLAGS = @MYSQL_LDFLAGS@ NM = @NM@ NMEDIT = @NMEDIT@ +NSS_DIR = @NSS_DIR@ OBJC = @OBJC@ OBJCDEPMODE = @OBJCDEPMODE@ OBJCFLAGS = @OBJCFLAGS@ @@ -266,6 +338,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ POSTGRES_CPPFLAGS = @POSTGRES_CPPFLAGS@ POSTGRES_LDFLAGS = @POSTGRES_LDFLAGS@ POSUB = @POSUB@ @@ -297,6 +370,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ @@ -319,6 +393,7 @@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ +gitcommand = @gitcommand@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ @@ -332,7 +407,6 @@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ -lt_ECHO = @lt_ECHO@ ltdl_LIBOBJS = @ltdl_LIBOBJS@ ltdl_LTLIBOBJS = @ltdl_LTLIBOBJS@ mandir = @mandir@ @@ -350,6 +424,7 @@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ subdirs = @subdirs@ +svnversioncommand = @svnversioncommand@ sys_symbol_underscore = @sys_symbol_underscore@ sysconfdir = @sysconfdir@ target = @target@ @@ -366,24 +441,29 @@ INCLUDES = -I$(top_srcdir)/src/include @USE_COVERAGE_TRUE@XLIB = -lgcov lib_LTLIBRARIES = libgnunetstream.la libgnunetstream_la_SOURCES = \ - stream_api.c stream_protocol.h + stream_api.c stream.h libgnunetstream_la_LIBADD = \ $(top_builddir)/src/mesh/libgnunetmesh.la \ + $(top_builddir)/src/lockmanager/libgnunetlockmanager.la \ + $(top_builddir)/src/statistics/libgnunetstatistics.la \ $(top_builddir)/src/util/libgnunetutil.la $(XLIB) libgnunetstream_la_LDFLAGS = \ - $(GN_LIB_LDFLAGS) + $(GN_LIB_LDFLAGS) \ + -version-info 1:0:0 + +@HAVE_BENCHMARKS_TRUE@STREAM_BENCHMARKS = \ +@HAVE_BENCHMARKS_TRUE@ perf_stream_api EXTRA_DIST = test_stream_local.conf -@ENABLE_TEST_RUN_TRUE@TESTS = $(check_PROGRAMS) test_stream_2peers_SOURCES = \ test_stream_2peers.c test_stream_2peers_LDADD = \ $(top_builddir)/src/stream/libgnunetstream.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la + $(top_builddir)/src/testbed/libgnunettestbed.la test_stream_2peers_halfclose_SOURCES = \ test_stream_2peers_halfclose.c @@ -391,7 +471,7 @@ test_stream_2peers_halfclose_SOURCES = \ test_stream_2peers_halfclose_LDADD = \ $(top_builddir)/src/stream/libgnunetstream.la \ $(top_builddir)/src/util/libgnunetutil.la \ - $(top_builddir)/src/testing/libgnunettesting.la + $(top_builddir)/src/testbed/libgnunettestbed.la test_stream_local_SOURCES = \ test_stream_local.c @@ -401,6 +481,31 @@ test_stream_local_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(top_builddir)/src/testing/libgnunettesting.la +test_stream_big_SOURCES = \ + test_stream_big.c + +test_stream_big_LDADD = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la + +test_stream_sequence_wraparound_SOURCES = \ + test_stream_sequence_wraparound.c + +test_stream_sequence_wraparound_LDADD = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la + +perf_stream_api_SOURCES = \ + perf_stream_api.c + +perf_stream_api_LDADD = \ + $(top_builddir)/src/stream/libgnunetstream.la \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(top_builddir)/src/testing/libgnunettesting.la \ + $(top_builddir)/src/testbed/libgnunettestbed.la + all: all-am .SUFFIXES: @@ -437,7 +542,6 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) - test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ @@ -445,6 +549,8 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) else :; fi; \ done; \ test -z "$$list2" || { \ + echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } @@ -466,7 +572,7 @@ clean-libLTLIBRARIES: echo "rm -f \"$${dir}/so_locations\""; \ rm -f "$${dir}/so_locations"; \ done -libgnunetstream.la: $(libgnunetstream_la_OBJECTS) $(libgnunetstream_la_DEPENDENCIES) +libgnunetstream.la: $(libgnunetstream_la_OBJECTS) $(libgnunetstream_la_DEPENDENCIES) $(EXTRA_libgnunetstream_la_DEPENDENCIES) $(AM_V_CCLD)$(libgnunetstream_la_LINK) -rpath $(libdir) $(libgnunetstream_la_OBJECTS) $(libgnunetstream_la_LIBADD) $(LIBS) clean-checkPROGRAMS: @@ -477,15 +583,24 @@ clean-checkPROGRAMS: list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list -test-stream-2peers$(EXEEXT): $(test_stream_2peers_OBJECTS) $(test_stream_2peers_DEPENDENCIES) - @rm -f test-stream-2peers$(EXEEXT) +perf_stream_api$(EXEEXT): $(perf_stream_api_OBJECTS) $(perf_stream_api_DEPENDENCIES) $(EXTRA_perf_stream_api_DEPENDENCIES) + @rm -f perf_stream_api$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(perf_stream_api_OBJECTS) $(perf_stream_api_LDADD) $(LIBS) +test_stream_2peers$(EXEEXT): $(test_stream_2peers_OBJECTS) $(test_stream_2peers_DEPENDENCIES) $(EXTRA_test_stream_2peers_DEPENDENCIES) + @rm -f test_stream_2peers$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stream_2peers_OBJECTS) $(test_stream_2peers_LDADD) $(LIBS) -test-stream-2peers_halfclose$(EXEEXT): $(test_stream_2peers_halfclose_OBJECTS) $(test_stream_2peers_halfclose_DEPENDENCIES) - @rm -f test-stream-2peers_halfclose$(EXEEXT) +test_stream_2peers_halfclose$(EXEEXT): $(test_stream_2peers_halfclose_OBJECTS) $(test_stream_2peers_halfclose_DEPENDENCIES) $(EXTRA_test_stream_2peers_halfclose_DEPENDENCIES) + @rm -f test_stream_2peers_halfclose$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stream_2peers_halfclose_OBJECTS) $(test_stream_2peers_halfclose_LDADD) $(LIBS) -test-stream-local$(EXEEXT): $(test_stream_local_OBJECTS) $(test_stream_local_DEPENDENCIES) - @rm -f test-stream-local$(EXEEXT) +test_stream_big$(EXEEXT): $(test_stream_big_OBJECTS) $(test_stream_big_DEPENDENCIES) $(EXTRA_test_stream_big_DEPENDENCIES) + @rm -f test_stream_big$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_stream_big_OBJECTS) $(test_stream_big_LDADD) $(LIBS) +test_stream_local$(EXEEXT): $(test_stream_local_OBJECTS) $(test_stream_local_DEPENDENCIES) $(EXTRA_test_stream_local_DEPENDENCIES) + @rm -f test_stream_local$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_stream_local_OBJECTS) $(test_stream_local_LDADD) $(LIBS) +test_stream_sequence_wraparound$(EXEEXT): $(test_stream_sequence_wraparound_OBJECTS) $(test_stream_sequence_wraparound_DEPENDENCIES) $(EXTRA_test_stream_sequence_wraparound_DEPENDENCIES) + @rm -f test_stream_sequence_wraparound$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_stream_sequence_wraparound_OBJECTS) $(test_stream_sequence_wraparound_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -493,34 +608,34 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perf_stream_api.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stream_api.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stream_2peers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stream_2peers_halfclose.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stream_big.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stream_local.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_stream_sequence_wraparound.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo @@ -661,14 +776,15 @@ check-TESTS: $(TESTS) fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ if test "$$failed" -eq 0; then \ - echo "$$grn$$dashes"; \ + col="$$grn"; \ else \ - echo "$$red$$dashes"; \ + col="$$red"; \ fi; \ - echo "$$banner"; \ - test -z "$$skipped" || echo "$$skipped"; \ - test -z "$$report" || echo "$$report"; \ - echo "$$dashes$$std"; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ test "$$failed" -eq 0; \ else :; fi @@ -721,10 +837,15 @@ install-am: all-am installcheck: installcheck-am install-strip: - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - `test -z '$(STRIP)' || \ - echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi mostlyclean-generic: clean-generic: diff --git a/src/stream/perf_stream_api.c b/src/stream/perf_stream_api.c new file mode 100644 index 0000000..aa534ce --- /dev/null +++ b/src/stream/perf_stream_api.c @@ -0,0 +1,1047 @@ + /* + This file is part of GNUnet. + (C) 2011, 2012 Christian Grothoff (and other contributing authors) + + GNUnet is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 3, or (at your + option) any later version. + + GNUnet 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with GNUnet; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +/** + * @file stream/perf_stream_api.c + * @brief performance benchmarks for stream api + * @author Sree Harsha Totakura + */ + +#define LOG(kind, ...) \ + GNUNET_log (kind, __VA_ARGS__); + +/****************************************************************************************/ +/* Test is setup into the following major steps: */ +/* 1. Measurements over loopback (1 hop). i.e. we use only one peer and open */ +/* stream connections over loopback. Messages will go through */ +/* STREAM_API->MESH_API->MESH_SERVICE->MESH_API->STREAM_API. */ +/* 2. Measurements over 2 peers (2 hops). We use testbed to create 2 peers, */ +/* connect them and then create stream connections. Messages will go through */ +/* STREAM_API->MESH_API->MESH_SERVICE->CORE1.....CORE2->MESH_API->STREAM_API */ +/* 3. Measurements over 3 peers (3 hops). We use testbed to create 3 peers, */ +/* connect them in a line topology: peer1->peer2->peer3. Messages will go */ +/* through */ +/* STREAM_API->MESH_API->MESH_SERVICE->CORE1..CORE2..CORE3->MESH_API->STREAM_API. */ +/****************************************************************************************/ + +#include "platform.h" +#include "gnunet_common.h" +#include "gnunet_util_lib.h" +#include "gnunet_testbed_service.h" +#include "gnunet_stream_lib.h" + +/** + * Simple struct to keep track of progress, and print a + * nice little percentage meter for long running tasks. + */ +struct ProgressMeter +{ + unsigned int total; + + unsigned int modnum; + + unsigned int dotnum; + + unsigned int completed; + + int print; + + char *startup_string; +}; + + +/** + * Steps in testing + */ +enum TestStep +{ + /** + * Single hop loopback testing + */ + TEST_STEP_1_HOP, + + /** + * Testing with 2 peers + */ + TEST_STEP_2_HOP, + + /** + * Testing with 3 peers + */ + TEST_STEP_3_HOP +}; + + +/** + * Structure for holding peer's sockets and IO Handles + */ +struct PeerData +{ + /** + * Peer's stream socket + */ + struct GNUNET_STREAM_Socket *socket; + + /** + * Peer's io write handle + */ + struct GNUNET_STREAM_WriteHandle *io_write_handle; + + /** + * Peer's io read handle + */ + struct GNUNET_STREAM_ReadHandle *io_read_handle; + + /** + * The peer handle when we use the testbed servie + */ + struct GNUNET_TESTBED_Peer *peer; + + /** + * Handle to peer specific opearations while using testbed service + */ + struct GNUNET_TESTBED_Operation *op; + + /** + * The identity of this peer + */ + struct GNUNET_PeerIdentity id; + + /** + * Peer's shutdown handle + */ + struct GNUNET_STREAM_ShutdownHandle *shutdown_handle; + + /** + * Bytes the peer has written + */ + size_t bytes_wrote; + + /** + * Byte the peer has read + */ + size_t bytes_read; + + /** + * number of packets sent + */ + unsigned int packets_wrote; + + /** + * number of packets read + */ + unsigned int packets_read; +}; + + +/** + * Enumeration of stages in this testing + */ +enum TestStage +{ + /** + * The initial stage + */ + INIT, + + /** + * Uplink testing stage + */ + UPLINK_OK, + + /** + * Downlink testing stage + */ + DOWNLINK_OK +}; + + +/** + * Maximum size of the data which we will transfer during tests + */ +#define DATA_SIZE 5000000 /* 5mB */ + +/** + * Fixed number of packets we send in each direction during each subtest + */ +#define MAX_PACKETS 1000 + +/** + * Listen socket of peer2 + */ +struct GNUNET_STREAM_ListenSocket *peer2_listen_socket; + +/** + * Handle to configuration during TEST_STEP_1_HOP + */ +const struct GNUNET_CONFIGURATION_Handle *config; + +/** + * Handle for the progress meter + */ +static struct ProgressMeter *meter; + +/** + * Placeholder for peer data + */ +static struct PeerData peer_data[3]; + +/** + * Handle to common operations while using testbed + */ +static struct GNUNET_TESTBED_Operation *common_op; + +/** + * Task ID for abort task + */ +static GNUNET_SCHEDULER_TaskIdentifier abort_task; + +/** + * Task ID for write task + */ +static GNUNET_SCHEDULER_TaskIdentifier write_task; + +/** + * Task ID for read task + */ +static GNUNET_SCHEDULER_TaskIdentifier read_task; + +/** + * Absolute time when profiling starts + */ +static struct GNUNET_TIME_Absolute prof_start_time; + +/** + * Test time taken for sending the data + */ +static struct GNUNET_TIME_Relative prof_time; + +/** + * Random data block. Should generate data first + */ +static uint32_t data[DATA_SIZE / 4]; + +/** + * Payload sizes to test each major test with + */ +static uint16_t payload_size[] = +{ 20, 500, 2000, 7000, 13000, 25000, 30000};//, 50000, 60000, 63000, 64000 }; + +/** + * Current step of testing + */ +static enum TestStep test_step; + +/** + * Index for choosing payload size + */ +static unsigned int payload_size_index; + +/** + * Number of peers we want to create while using the testbed service + */ +static int num_peers; + +/** + * Flag to indicate that the other peer should reset its data read source index + */ +static int reset_read; + +/** + * Testing result of a major test + */ +static enum TestStage result; + +/** + * Create a meter to keep track of the progress of some task. + * + * @param total the total number of items to complete + * @param start_string a string to prefix the meter with (if printing) + * @param print GNUNET_YES to print the meter, GNUNET_NO to count + * internally only + * + * @return the progress meter + */ +static struct ProgressMeter * +create_meter (unsigned int total, char *start_string, int print) +{ + struct ProgressMeter *ret; + + ret = GNUNET_malloc (sizeof (struct ProgressMeter)); + ret->print = print; + ret->total = total; + ret->modnum = total / 4; + if (ret->modnum == 0) /* Divide by zero check */ + ret->modnum = 1; + ret->dotnum = (total / 50) + 1; + if (start_string != NULL) + ret->startup_string = GNUNET_strdup (start_string); + else + ret->startup_string = GNUNET_strdup (""); + + return ret; +} + + +/** + * Update progress meter (increment by one). + * + * @param meter the meter to update and print info for + * + * @return GNUNET_YES if called the total requested, + * GNUNET_NO if more items expected + */ +static int +update_meter (struct ProgressMeter *meter) +{ + if (meter->print == GNUNET_YES) + { + if (meter->completed % meter->modnum == 0) + { + if (meter->completed == 0) + { + FPRINTF (stdout, "%sProgress: [0%%", meter->startup_string); + } + else + FPRINTF (stdout, "%d%%", + (int) (((float) meter->completed / meter->total) * 100)); + } + else if (meter->completed % meter->dotnum == 0) + FPRINTF (stdout, "%s", "."); + + if (meter->completed + 1 == meter->total) + FPRINTF (stdout, "%d%%]\n", 100); + fflush (stdout); + } + meter->completed++; + + if (meter->completed == meter->total) + return GNUNET_YES; + if (meter->completed > meter->total) + GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "Progress meter overflow!!\n"); + return GNUNET_NO; +} + + +/** + * Reset progress meter. + * + * @param meter the meter to reset + * + * @return GNUNET_YES if meter reset, + * GNUNET_SYSERR on error + */ +static int +reset_meter (struct ProgressMeter *meter) +{ + if (meter == NULL) + return GNUNET_SYSERR; + + meter->completed = 0; + return GNUNET_YES; +} + + +/** + * Release resources for meter + * + * @param meter the meter to free + */ +static void +free_meter (struct ProgressMeter *meter) +{ + GNUNET_free_non_null (meter->startup_string); + GNUNET_free (meter); +} + + +/** + * Shutdown nicely + */ +static void +do_close (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) +{ + switch (test_step) + { + case TEST_STEP_1_HOP: + if (NULL != peer_data[0].socket) + GNUNET_STREAM_close (peer_data[0].socket); + if (NULL != peer_data[1].socket) + GNUNET_STREAM_close (peer_data[1].socket); + if (NULL != peer2_listen_socket) + GNUNET_STREAM_listen_close (peer2_listen_socket); /* Close listen socket */ + break; + case TEST_STEP_2_HOP: + if (NULL != peer_data[1].socket) + GNUNET_STREAM_close (peer_data[1].socket); + if (NULL != peer_data[0].op) + GNUNET_TESTBED_operation_done (peer_data[0].op); + if (NULL != peer_data[1].op) + |