diff --git a/ports/ports/netperf.mk b/ports/ports/netperf.mk new file mode 100644 index 000000000..3c2c67c57 --- /dev/null +++ b/ports/ports/netperf.mk @@ -0,0 +1,32 @@ +NETPERF_VERSION := 2.6.0 +NETPERF := netperf + +# +# Interface to top-level prepare Makefile +# +PORTS += $(NETPERF)-$(NETPERF_VERSION) + +# +# Check for tools +# +$(call check_tool,svn) + +# +# Subdirectories to check out +# +NETPERF_SVN_BASE = http://www.netperf.org/svn + +$(CONTRIB_DIR)/$(NETPERF): + $(ECHO) "checking out 'netperf' to '$@'" + $(VERBOSE)svn export $(NETPERF_SVN_BASE)/netperf2/tags/$(NETPERF)-$(NETPERF_VERSION) $@ + +checkout-netperf: $(CONTRIB_DIR)/$(NETPERF) + +apply_patches-netperf: checkout-netperf + $(VERBOSE)patch -d contrib/netperf -N -p0 < $(CURDIR)/src/app/netperf/timer.patch + $(VERBOSE)echo '#define NETPERF_VERSION "$(NETPERF_VERSION)"' >$(CONTRIB_DIR)/$(NETPERF)/src/netperf_version.h + +prepare:: apply_patches-netperf + +clean-netperf: + $(VERBOSE)rm -rf $(CONTRIB_DIR)/$(NETPERF) diff --git a/ports/run/netperf.run b/ports/run/netperf.run new file mode 100644 index 000000000..56b144c5e --- /dev/null +++ b/ports/run/netperf.run @@ -0,0 +1,163 @@ +# +# \brief Test for using netperf +# \author Alexander Boettcher +# \date 2013-04-18 +# + + +# +# Build +# + +set build_components { + core init + drivers/pci drivers/timer drivers/nic + app/netperf +} + +set use_usb_driver [expr [have_spec omap4] || [have_spec exynos5]] +set use_nic_driver [expr !$use_usb_driver] + +lappend_if $use_usb_driver build_components drivers/usb +lappend_if [have_spec acpi] build_components drivers/acpi +lappend_if [have_spec pci] build_components drivers/pci/device_pd + +build $build_components + +create_boot_directory + +# +# Generate config +# + +set config { + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + } + +append_if $use_usb_driver config { + + + + + + + + + } + +append_if $use_nic_driver config { + + + + } + +append_if [have_spec acpi] config { + + + + + + + + + + + + } + +append_if [expr ![have_spec acpi] && [have_spec pci]] config { + + + + } + +append config { + +} + +install_config $config + +# +# Boot modules +# + +# generic modules +set boot_modules { + core init timer + ld.lib.so libc.lib.so libm.lib.so + lwip.lib.so libc_log.lib.so + netperf +} + +# platform-specific modules +lappend_if [have_spec acpi] boot_modules acpi_drv +lappend_if [have_spec pci] boot_modules pci_drv +lappend_if $use_usb_driver boot_modules usb_drv +lappend_if $use_nic_driver boot_modules nic_drv +lappend_if [have_spec nova] boot_modules pci_device_pd + +build_boot_image $boot_modules + +# +# Execute test case +# + +# qemu config +append qemu_args " -m 128 " + +append_if [have_spec x86] qemu_args " -net nic,model=e1000 " +append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 " + +append qemu_args " -net user -redir tcp:12865::12865 " + +run_genode_until {.*and family AF_INET.*} 30 + + +if [is_qemu_available] { + set ip_addr "localhost" +} else { + set match_string "got IP address (\[0-9\]+\.\[0-9\]+\.\[0-9\]+\.\[0-9\]+)" + regexp $match_string $output all ip_addr + puts "" +} + +spawn netperf -H $ip_addr -P 1 -v 2 -t TCP_STREAM +set netperf_id $spawn_id + +run_genode_until "Segment" 60 $netperf_id + +# format output understandable for post proccessing scripts +set throughput [regexp -all -inline {[0-9]+[ ]+[0-9]+[ ]+[0-9]+[ ]+[0-9]+\.[0-9]+[ ]+[0-9]+\.[0-9]+} $output] +set throughput [regexp -all -inline {[0-9]+\.[0-9]+} $throughput] +puts "! PERF: tcp_stream [lindex $throughput 1] MBit/s ok" + +puts "Test succeeded" +# vi: set ft=tcl : diff --git a/ports/src/app/netperf/config.h b/ports/src/app/netperf/config.h new file mode 100644 index 000000000..d1b975aea --- /dev/null +++ b/ports/src/app/netperf/config.h @@ -0,0 +1,427 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one to enable dirty buffer support. May affect results. */ +#undef DIRTY + +/* Define to 1 if you have the `alarm' function. */ +#undef HAVE_ALARM + +/* Define to 1 if you have the header file. */ +#define HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `bindprocessor' function. */ +#undef HAVE_BINDPROCESSOR + +/* Define to 1 if you have the `bind_to_cpu_id' function. */ +#undef HAVE_BIND_TO_CPU_ID + +/* Define to 1 if you have the `bzero' function. */ +#undef HAVE_BZERO + +/* Define to 1 if you have the `daemon' function. */ +#undef HAVE_DAEMON + +/* Define to 1 if you have the header file. */ +#undef HAVE_ENDIAN_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +#define HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `gethrtime' function. */ +#undef HAVE_GETHRTIME + +/* Define to 1 if you have the `getifaddrs' function. */ +#undef HAVE_GETIFADDRS + +/* Define to 1 if you have the `getnameinfo' function. */ +#undef HAVE_GETNAMEINFO + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the `gettimeofday' function. */ +#undef HAVE_GETTIMEOFDAY + +/* Define to one to include ICSC-EXS tests. */ +#undef HAVE_ICSC_EXS + +/* Define to 1 if you have the header file. */ +#define HAVE_IFADDRS_H 1 + +/* Define to 1 if you have the `inet_ntoa' function. */ +#define HAVE_INET_NTOA 1 + +/* Define to 1 if you have the `inet_ntop' function. */ +#define HAVE_INET_NTOP 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `devinfo' library (-ldevinfo). */ +#undef HAVE_LIBDEVINFO + +/* Define to 1 if you have the `dl' library (-ldl). */ +#undef HAVE_LIBDL + +/* Define to 1 if you have the `exs' library (-lexs). */ +#undef HAVE_LIBEXS + +/* Define to 1 if you have the `IO' library (-lIO). */ +#undef HAVE_LIBIO + +/* Define to 1 if you have the `kstat' library (-lkstat). */ +#undef HAVE_LIBKSTAT + +/* Define to 1 if you have the `m' library (-lm). */ +#undef HAVE_LIBM + +/* Define to 1 if you have the `mach' library (-lmach). */ +#undef HAVE_LIBMACH + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define to 1 if you have the `olrad' library (-lolrad). */ +#undef HAVE_LIBOLRAD + +/* Define to 1 if you have the `perfstat' library (-lperfstat). */ +#undef HAVE_LIBPERFSTAT + +/* Define to 1 if you have the `sctp' library (-lsctp). */ +#undef HAVE_LIBSCTP + +/* Define to 1 if you have the `sdp' library (-lsdp). */ +#undef HAVE_LIBSDP + +/* Define to 1 if you have the `sendfile' library (-lsendfile). */ +#undef HAVE_LIBSENDFILE + +/* Define to 1 if you have the `smbios' library (-lsmbios). */ +#undef HAVE_LIBSMBIOS + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_TCP_H + +/* Define to 1 if you have the header file. */ +#define HAVE_MALLOC_H 1 + +/* Define to 1 if you have the `memcpy' function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP + +/* Define to 1 if you have the `mpctl' function. */ +#undef HAVE_MPCTL + +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_SCTP_H + +/* Define to 1 if you have the `processor_bind' function. */ +#undef HAVE_PROCESSOR_BIND + +/* Define to 1 if you have the `sched_setaffinity' function. */ +#undef HAVE_SCHED_SETAFFINITY + +/* Define to 1 if `struct sctp_event_subscribe' has a + `sctp_adaptation_layer_event' member */ +#undef HAVE_SCTP_ADAPTATION_LAYER_EVENT + +/* Define to 1 if you have the `select' function. */ +#define HAVE_SELECT 1 + +/* Define to 1 if you have the `sendfile' function. */ +#undef HAVE_SENDFILE + +/* Define to 1 if you have the `setsid' function. */ +#undef HAVE_SETSID + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SMBIOS_SYSTEMINFO_H + +/* Define if struct sockaddr has the sa_len member */ +#define HAVE_SOCKADDR_SA_LEN 1 + +/* Define to 1 if you have the `socket' function. */ +#define HAVE_SOCKET 1 + +/* Define to 1 if you have the `sqrt' function. */ +#undef HAVE_SQRT + +/* Define to 1 if stdbool.h conforms to C99. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strstr' function. */ +#define HAVE_STRSTR 1 + +/* Define to 1 if you have the `strtoul' function. */ +#define HAVE_STRTOUL 1 + +/* Define to 1 if defines `struct sockaddr_storage' */ +#define HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSCALL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IPC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SBMIOS_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SMBIOS_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SYSINFO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the `toupper' function. */ +#undef HAVE_TOUPPER + +/* Define to 1 if you have the `uname' function. */ +#undef HAVE_UNAME + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to 1 if `h_errno' is declared by */ +#undef H_ERRNO_DECLARED + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define to the type of arg 1 for `select'. */ +#undef SELECT_TYPE_ARG1 + +/* Define to the type of args 2, 3 and 4 for `select'. */ +#undef SELECT_TYPE_ARG234 + +/* Define to the type of arg 5 for `select'. */ +#undef SELECT_TYPE_ARG5 + +/* Define to 1 if the `setpgrp' function takes no argument. */ +#undef SETPGRP_VOID + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Use Solaris's kstat interface to measure CPU util. */ +#undef USE_KSTAT + +/* Use looper/soaker processes to measure CPU util. */ +#undef USE_LOOPER + +/* Use MacOS X's host_info interface to measure CPU util. */ +#undef USE_OSX + +/* Use AIX's perfstat interface to measure CPU util. */ +#undef USE_PERFSTAT + +/* Use Linux's procstat interface to measure CPU util. */ +#undef USE_PROC_STAT + +/* Use HP-UX's pstat interface to measure CPU util. */ +#undef USE_PSTAT + +/* Use MumbleBSD's sysctl interface to measure CPU util. */ +#undef USE_SYSCTL + +/* Version number of package */ +#undef VERSION + +/* Define to one to include DCCP tests. */ +#undef WANT_DCCP + +/* Define to one to enable demo support. May affect results. */ +#undef WANT_DEMO + +/* Define to one to include DLPI tests. */ +#undef WANT_DLPI + +/* Define to one to enable initial _RR burst support. May affect results. */ +#define WANT_FIRST_BURST 1 + +/* Define to one to enable histogram support. May affect results. */ +#undef WANT_HISTOGRAM + +/* Define to one to enable paced operation support. May affect results. */ +#undef WANT_INTERVALS + +/* Define to one to migrate classic to OMNI tests. */ +#undef WANT_MIGRATION + +/* Define to one to include OMNI tests. */ +#undef WANT_OMNI + +/* Define to one to include SCTP tests. */ +#undef WANT_SCTP + +/* Define to one to include SDP tests. */ +#undef WANT_SDP + +/* Define to one to spin waiting on paced operation. WILL AFFEFCT CPU + UTILIZATION */ +#undef WANT_SPIN + +/* Define to one to include Unix Domain socket tests. */ +#undef WANT_UNIX + +/* Define to one to include XTI tests. */ +#undef WANT_XTI + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* type to use in place of socklen_t if not defined */ +#undef netperf_socklen_t + +/* Define to `long int' if does not define. */ +#undef off_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork + + +#define socklen_t netperf_socklen_t +#define GETADDRINFO_H 1 diff --git a/ports/src/app/netperf/target.mk b/ports/src/app/netperf/target.mk new file mode 100644 index 000000000..97f59d019 --- /dev/null +++ b/ports/src/app/netperf/target.mk @@ -0,0 +1,16 @@ +TARGET = netperf + +CONTRIB_DIR = $(REP_DIR)/contrib/netperf + +LIBS += base libc libm libc-resolv libc-net libc-nameser libc-isc +# plugins to libc +LIBS += libc_log libc_lwip_nic_dhcp config_args + +SRC_C = netserver.c netlib.c netsh.c nettest_bsd.c netcpu_none.c dscp.c + +INC_DIR += $(PRG_DIR) +CC_OPT += -DHAVE_CONFIG_H -DGENODE_BUILD + +CC_WARN = -Wall -Wno-unused + +vpath %.c $(CONTRIB_DIR)/src diff --git a/ports/src/app/netperf/timer.patch b/ports/src/app/netperf/timer.patch new file mode 100644 index 000000000..655ece599 --- /dev/null +++ b/ports/src/app/netperf/timer.patch @@ -0,0 +1,14 @@ +--- ../netperf-orig/src/netlib.h 2013-04-19 09:47:05.618940425 +0200 ++++ src/netlib.h 2013-04-19 09:50:36.042936062 +0200 +@@ -536,7 +536,11 @@ + extern void dump_request(); + extern void dump_addrinfo(FILE *dumploc, struct addrinfo *info, + char *host, char *port, int family); ++#ifdef GENODE_BUILD ++static inline void start_timer(int time) { printf("%s: not supported\n", __FUNCTION__);} ++#else + extern void start_timer(int time); ++#endif + extern void stop_timer(); + extern void cpu_start(int measure_cpu); + extern void cpu_stop(int measure_cpu, float *elapsed);