port of netperf server to native Genode

This commit is contained in:
Alexander Boettcher 2013-04-19 09:56:58 +02:00 committed by Norman Feske
parent 2beb851c5a
commit 86e428cd64
5 changed files with 652 additions and 0 deletions

32
ports/ports/netperf.mk Normal file
View File

@ -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)

163
ports/run/netperf.run Normal file
View File

@ -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 {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="RAM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="CAP"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
<service name="SIGNAL"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="netperf">
<resource name="RAM" quantum="3M"/>
<config>
<arg value="netserver"/>
<arg value="-D"/>
<arg value="-4"/>
<arg value="-f"/>
</config>
</start> }
append_if $use_usb_driver config {
<start name="usb_drv">
<resource name="RAM" quantum="12M"/>
<provides>
<service name="Nic"/>
</provides>
<config>
<nic mac="2e:60:90:0c:4e:01" />
</config>
</start>}
append_if $use_nic_driver config {
<start name="nic_drv">
<resource name="RAM" quantum="4M"/>
<provides><service name="Nic"/></provides>
</start>}
append_if [have_spec acpi] config {
<start name="acpi">
<resource name="RAM" quantum="6M"/>
<binary name="acpi_drv"/>
<provides>
<service name="PCI"/>
<service name="IRQ" />
</provides>
<route>
<service name="PCI"> <any-child /> </service>
<any-service> <parent/> <any-child /> </any-service>
</route>
</start>}
append_if [expr ![have_spec acpi] && [have_spec pci]] config {
<start name="pci_drv">
<resource name="RAM" quantum="3M"/>
<provides> <service name="PCI"/> </provides>
</start> }
append config {
</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 :

View File

@ -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 <arpa/inet.h> 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 <endian.h> header file. */
#undef HAVE_ENDIAN_H
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define to 1 if you have the <fcntl.h> 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 <ifaddrs.h> 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 <inttypes.h> 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 <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define to 1 if you have the <linux/tcp.h> header file. */
#undef HAVE_LINUX_TCP_H
/* Define to 1 if you have the <malloc.h> 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 <memory.h> 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 <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define to 1 if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define to 1 if you have the <netinet/in_systm.h> header file. */
#undef HAVE_NETINET_IN_SYSTM_H
/* Define to 1 if you have the <netinet/ip.h> header file. */
#undef HAVE_NETINET_IP_H
/* Define to 1 if you have the <netinet/sctp.h> 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 <signal.h> header file. */
#undef HAVE_SIGNAL_H
/* Define to 1 if you have the <smbios/SystemInfo.h> 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 <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define to 1 if you have the <stdlib.h> 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 <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> 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 <netinet/in.h> defines `struct sockaddr_storage' */
#define HAVE_STRUCT_SOCKADDR_STORAGE 1
/* Define to 1 if you have the <syscall.h> header file. */
#undef HAVE_SYSCALL_H
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define to 1 if you have the <sys/ipc.h> header file. */
#undef HAVE_SYS_IPC_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#undef HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/sbmios.h> header file. */
#undef HAVE_SYS_SBMIOS_H
/* Define to 1 if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/smbios.h> header file. */
#undef HAVE_SYS_SMBIOS_H
/* Define to 1 if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define to 1 if you have the <sys/sockio.h> header file. */
#undef HAVE_SYS_SOCKIO_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysinfo.h> header file. */
#undef HAVE_SYS_SYSINFO_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/wait.h> 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 <unistd.h> 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 <vfork.h> 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 <netdb.h> */
#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 <sys/time.h> and <time.h>. */
#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 <sys/types.h> does not define. */
#undef off_t
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned int' if <sys/types.h> 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

View File

@ -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

View File

@ -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);