[netperf-dev] netperf4 commit notice r168 - in
branches/glib_migration/suites: . disk vst
raj at netperf.org
raj at netperf.org
Tue Apr 18 17:23:59 PDT 2006
Author: raj
Date: 2006-04-18 17:23:57 -0700 (Tue, 18 Apr 2006)
New Revision: 168
Added:
branches/glib_migration/suites/disk/
branches/glib_migration/suites/disk/Makefile.am
branches/glib_migration/suites/disk/Makefile.in
branches/glib_migration/suites/disk/disktest.c
branches/glib_migration/suites/disk/disktest.h
branches/glib_migration/suites/vst/
branches/glib_migration/suites/vst/Makefile.am
branches/glib_migration/suites/vst/Makefile.in
branches/glib_migration/suites/vst/nettest_vst.c
branches/glib_migration/suites/vst/nettest_vst.h
Log:
Add the disk and vst tests as optional suites
Added: branches/glib_migration/suites/disk/Makefile.am
===================================================================
--- branches/glib_migration/suites/disk/Makefile.am 2006-04-19 00:11:52 UTC (rev 167)
+++ branches/glib_migration/suites/disk/Makefile.am 2006-04-19 00:23:57 UTC (rev 168)
@@ -0,0 +1,7 @@
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
+# in theory, the stuff below should deal with creating the requisite libs
+lib_LTLIBRARIES = nettest_disk.la
+
+nettest_disk_la_SOURCES = disktest.c disktest.h
+nettest_disk_la_LDFLAGS = -module
Added: branches/glib_migration/suites/disk/Makefile.in
===================================================================
--- branches/glib_migration/suites/disk/Makefile.in 2006-04-19 00:11:52 UTC (rev 167)
+++ branches/glib_migration/suites/disk/Makefile.in 2006-04-19 00:23:57 UTC (rev 168)
@@ -0,0 +1,449 @@
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBOJBS = @LIBOJBS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NETSYS_SOURCE = @NETSYS_SOURCE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WANT_DISK_FALSE = @WANT_DISK_FALSE@
+WANT_DISK_TRUE = @WANT_DISK_TRUE@
+WANT_DNS_FALSE = @WANT_DNS_FALSE@
+WANT_DNS_TRUE = @WANT_DNS_TRUE@
+WANT_VST_FALSE = @WANT_VST_FALSE@
+WANT_VST_TRUE = @WANT_VST_TRUE@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
+# in theory, the stuff below should deal with creating the requisite libs
+lib_LTLIBRARIES = nettest_disk.la
+
+nettest_disk_la_SOURCES = disktest.c disktest.h
+nettest_disk_la_LDFLAGS = -module
+subdir = suites/disk
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(lib_LTLIBRARIES)
+
+nettest_disk_la_LIBADD =
+am_nettest_disk_la_OBJECTS = disktest.lo
+nettest_disk_la_OBJECTS = $(am_nettest_disk_la_OBJECTS)
+
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+ at AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/disktest.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+ $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(nettest_disk_la_SOURCES)
+DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
+SOURCES = $(nettest_disk_la_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu suites/disk/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+libLTLIBRARIES_INSTALL = $(INSTALL)
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" = "$$p" && dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+nettest_disk.la: $(nettest_disk_la_OBJECTS) $(nettest_disk_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(nettest_disk_la_LDFLAGS) $(nettest_disk_la_OBJECTS) $(nettest_disk_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/disktest.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ at am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+ at am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ at am__fastdepCC_TRUE@ fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ at am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+ at am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ at am__fastdepCC_TRUE@ fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ at am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
+ at am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ at am__fastdepCC_TRUE@ fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Added: branches/glib_migration/suites/disk/disktest.c
===================================================================
--- branches/glib_migration/suites/disk/disktest.c 2006-04-19 00:11:52 UTC (rev 167)
+++ branches/glib_migration/suites/disk/disktest.c 2006-04-19 00:23:57 UTC (rev 168)
@@ -0,0 +1,1934 @@
+/*
+
+This file is part of netperf4.
+
+Netperf4 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 2 of the License, or (at your
+option) any later version.
+
+Netperf4 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 this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+USA.
+
+In addition, as a special exception, the copyright holders give
+permission to link the code of netperf4 with the OpenSSL project's
+"OpenSSL" library (or with modified versions of it that use the same
+license as the "OpenSSL" library), and distribute the linked
+executables. You must obey the GNU General Public License in all
+respects for all of the code used other than "OpenSSL". If you modify
+this file, you may extend this exception to your version of the file,
+but you are not obligated to do so. If you do not wish to do so,
+delete this exception statement from your version.
+
+*/
+
+#ifndef lint
+char disk_test_id[]="\
+@(#)disktest.c (c) Copyright 2005 Hewlett-Packard Co. $Id: disktest.c 166 2006-04-19 00:09:40Z raj $";
+#endif /* lint */
+
+
+/****************************************************************/
+/* */
+/* disk.c */
+/* */
+/* the actual test routines... */
+/* */
+/* */
+/****************************************************************/
+
+
+
+/* requires 64 bit file offsets */
+#define _FILE_OFFSET_BITS 64
+
+/* turn on histogram capability */
+#define WANT_HISTOGRAM
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#ifdef OFF
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#ifdef TIME_WITH_SYS_TIM
+#include <time.h>
+#endif
+#endif
+#endif
+
+#include <fcntl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/diskio.h>
+#include <sys/scsi.h>
+
+#include "netperf.h"
+
+#include "disktest.h"
+
+
+static void
+report_test_failure(test, function, err_code, err_string)
+ test_t *test;
+ char *function;
+ int err_code;
+ char *err_string;
+{
+ int loc_debug = 1;
+ if (test->debug || loc_debug) {
+ fprintf(test->where,"%s: called report_test_failure:",function);
+ fprintf(test->where,"reporting %s errno = %d\n",err_string,GET_ERRNO);
+ fflush(test->where);
+ }
+ test->err_rc = err_code;
+ test->err_fn = function;
+ test->err_str = err_string;
+ test->new_state = TEST_ERROR;
+ test->err_no = GET_ERRNO;
+}
+
+static void
+set_test_state(test_t *test, uint32_t new_state)
+{
+ int curr_state;
+ int state;
+ int valid = 0;
+ char *state_name;
+ char error_msg[1024];
+
+ curr_state = GET_TEST_STATE;
+
+ if (curr_state != TEST_ERROR) {
+ if (curr_state != new_state) {
+ switch (curr_state) {
+ case TEST_PREINIT:
+ state = TEST_INIT;
+ valid = 1;
+ break;
+ case TEST_INIT:
+ state_name = "TEST_INIT";
+ if (new_state == TEST_IDLE) {
+ state = TEST_IDLE;
+ valid = 1;
+ }
+ break;
+ case TEST_IDLE:
+ state_name = "TEST_IDLE";
+ if (new_state == TEST_LOADED) {
+ state = TEST_LOADED;
+ valid = 1;
+ }
+ if (new_state == TEST_DEAD) {
+ state = TEST_DEAD;
+ valid = 1;
+ }
+ break;
+ case TEST_LOADED:
+ state_name = "TEST_LOADED";
+ if (new_state == TEST_MEASURE) {
+ state = TEST_MEASURE;
+ valid = 1;
+ }
+ if (new_state == TEST_IDLE) {
+ state = TEST_IDLE;
+ valid = 1;
+ }
+ break;
+ case TEST_MEASURE:
+ state_name = "TEST_MEASURE";
+ if (new_state == TEST_LOADED) {
+ state = TEST_LOADED;
+ valid = 1;
+ }
+ break;
+ case TEST_ERROR:
+ /* an error occured while processing in the current state
+ return and we should drop into wait_to_die so that
+ netperf4 can retrieve the error information before killing
+ the test */
+ state_name = "TEST_ERROR";
+ break;
+ default:
+ state_name = "ILLEGAL";
+ }
+ if (valid) {
+ SET_TEST_STATE(state);
+ }
+ else {
+ sprintf(error_msg,"bad state transition from %s state",state_name);
+ report_test_failure( test,
+ (char *)__func__,
+ DISK_REQUESTED_STATE_INVALID,
+ strdup(error_msg));
+ }
+ }
+ }
+}
+
+
+void
+wait_to_die(test_t *test, void(*free_routine)(test_t *))
+{
+ while (GET_TEST_STATE != TEST_DEAD) {
+ if (CHECK_REQ_STATE == TEST_DEAD) {
+ /* add extra ioctl to restore original scsi queue depth in the future */
+ /* add extra ioctl to restore original scsi immreport in the future */
+ free_routine(test);
+ free(GET_TEST_DATA(test));
+ SET_TEST_DATA(test,NULL);
+ SET_TEST_STATE(TEST_DEAD);
+ }
+ }
+}
+
+static ssize_t
+io_read(int fd, void *buf_addr, size_t size, test_t *test, char *func)
+{
+ ssize_t bytes;
+
+
+ if ((bytes = read(fd, buf_addr, size)) != size) {
+ if (bytes == 0L) {
+ report_test_failure(test, func,
+ DISK_TEST_EOF_ERROR,
+ "attempted to read past end of file");
+ }
+ else if (bytes == -1L) {
+ report_test_failure(test, func,
+ DISK_TEST_ERROR_READING_FILE,
+ "error reading file");
+ }
+ else {
+ report_test_failure(test, func,
+ DISK_TEST_ERROR_PARTIAL_READ,
+ "partial read from file");
+ }
+ }
+ return(bytes);
+}
+
+
+static ssize_t
+io_write(int fd, void *buf_addr, size_t size, test_t *test, char *func)
+{
+ ssize_t bytes;
+
+
+ if ((bytes = write(fd, buf_addr, size)) != size) {
+ if (bytes < 0L) {
+ report_test_failure(test, func,
+ DISK_TEST_CANT_WRITE_FILE,
+ "can not write to file");
+ }
+ else {
+ report_test_failure(test, func,
+ DISK_TEST_ERROR_WRITING_FILE,
+ "error while writing to file");
+ }
+ }
+ return(bytes);
+}
+
+
+
+static void
+free_disk_test_data(test_t *test)
+{
+ disk_data_t *my_data;
+
+ my_data = GET_TEST_DATA(test);
+
+ free(my_data->orig_buffer);
+ close(my_data->fd);
+
+ my_data->orig_buffer = NULL;
+ my_data->buffer_start = NULL;
+}
+
+
+static void
+disk_test_init(test_t *test)
+{
+ disk_data_t *new_data;
+ xmlNodePtr args;
+ xmlChar *string;
+ int loc_debug = 0;
+
+
+ new_data = (disk_data_t *)malloc(sizeof(disk_data_t));
+ args = test->node->xmlChildrenNode;
+ while (args != NULL) {
+ if (xmlStrcmp(args->name,(const xmlChar *)"disk_args")) {
+ args = args->next;
+ continue;
+ }
+ break;
+ }
+
+ if ((args != NULL) &&
+ (NULL != new_data)) {
+ memset(new_data,0,sizeof(disk_data_t));
+
+ string = xmlGetProp(args,(const xmlChar *)"file_name");
+ new_data->file_name = (char *)string;
+ string = xmlGetProp(args,(const xmlChar *)"read");
+ if (string) {
+ new_data->read = atof((char *)string);
+ } else {
+ new_data->read = 1.0;
+ }
+
+ string = xmlGetProp(args,(const xmlChar *)"disk_io_size");
+ if (test->debug || loc_debug) {
+ fprintf(test->where,
+ "%s:%s disk_io_size = '%s'\n", test->id, __func__, string);
+ fflush(test->where);
+ }
+ if (string) {
+ new_data->chunk = strtoul((char *)string,NULL,10);
+ } else {
+ new_data->chunk = 8;
+ }
+ string = xmlGetProp(args,(const xmlChar *)"disk_io_units");
+ if (test->debug || loc_debug) {
+ fprintf(test->where,
+ "%s:%s disk_io_units = '%s'\n", test->id, __func__, string);
+ fflush(test->where);
+ }
+ if (string) {
+ if (strstr((char *)string,"KB")) {
+ new_data->chunk *= 1024;
+ }
+ if (strstr((char *)string,"MB")) {
+ new_data->chunk *= (1024 * 1024);
+ }
+ if (strstr((char *)string,"GB")) {
+ new_data->chunk *= (1024 * 1024 * 1024);
+ }
+ }
+ else {
+ new_data->chunk *= 1024;
+ }
+
+ string = xmlGetProp(args,(const xmlChar *)"disk_test_size");
+ if (test->debug || loc_debug) {
+ fprintf(test->where,
+ "%s:%s disk_test_size = '%s'\n", test->id, __func__, string);
+ fflush(test->where);
+ }
+ if (string) {
+ new_data->testSize = strtoull((char *)string,NULL,10);
+ } else {
+ new_data->testSize = 0;
+ }
+ string = xmlGetProp(args,(const xmlChar *)"disk_test_units");
+ if (test->debug || loc_debug) {
+ fprintf(test->where,
+ "%s:%s disk_test_units = '%s'\n", test->id, __func__, string);
+ fflush(test->where);
+ }
+ if (string) {
+ if (strstr((char *)string,"KB")) {
+ new_data->testSize *= 1024;
+ }
+ if (strstr((char *)string,"MB")) {
+ new_data->testSize *= (1024 * 1024);
+ }
+ if (strstr((char *)string,"GB")) {
+ new_data->testSize *= (1024 * 1024 * 1024);
+ }
+ }
+ else {
+ new_data->testSize *= 1024;
+ }
+
+ string = xmlGetProp(args,(const xmlChar *)"start_position");
+ if (string) {
+ new_data->start_pos = strtoull((char *)string,NULL,10);
+ new_data->start_pos *= 1024;
+ } else {
+ new_data->start_pos = 0;
+ }
+ string = xmlGetProp(args,(const xmlChar *)"end_position");
+ if (string) {
+ new_data->end_pos = strtoull((char *)string,NULL,10);
+ new_data->end_pos *= 1024;
+ } else {
+ new_data->end_pos = 0;
+ }
+ string = xmlGetProp(args,(const xmlChar *)"scsi_immreport");
+ if (string) {
+ new_data->scsi_immreport = atoi((char *)string);
+ } else {
+ new_data->scsi_immreport = -1;
+ }
+ string = xmlGetProp(args,(const xmlChar *)"scsi_queue_depth");
+ if (string) {
+ new_data->scsi_queue_depth = atoi((char *)string);
+ } else {
+ new_data->scsi_queue_depth = -1;
+ }
+ }
+ if (args == NULL) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_NO_DISK_ARGS,
+ "no disk_arg element was found");
+ }
+ if (new_data == NULL) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_MALLOC_FAILED,
+ "malloc failed in disk_test_init");
+ }
+ if (test->debug || loc_debug) {
+ fprintf(test->where,
+ "%s:%s file_name = '%s'\n", test->id, __func__,
+ new_data->file_name);
+ fprintf(test->where,
+ "%s:%s read = %f\n", test->id, __func__,
+ new_data->read);
+ fprintf(test->where,
+ "%s:%s chunk = %ld\n", test->id, __func__,
+ new_data->chunk);
+ fprintf(test->where,
+ "%s:%s testSize = %lld\n", test->id, __func__,
+ new_data->testSize);
+ fprintf(test->where,
+ "%s:%s scsi_immreport = %d\n", test->id, __func__,
+ new_data->scsi_immreport);
+ fprintf(test->where,
+ "%s:%s scsi_queue_depth = %d\n", test->id, __func__,
+ new_data->scsi_queue_depth);
+ fprintf(test->where, "\n");
+ fflush(test->where);
+ }
+
+ new_data->read_hist = HIST_new();
+ new_data->write_hist = HIST_new();
+
+ SET_TEST_DATA(test, new_data);
+}
+
+
+static void
+update_elapsed_time(disk_data_t *my_data)
+{
+ my_data->elapsed_time.tv_usec += my_data->curr_time.tv_usec;
+ my_data->elapsed_time.tv_usec -= my_data->prev_time.tv_usec;
+
+ my_data->elapsed_time.tv_sec += my_data->curr_time.tv_sec;
+ my_data->elapsed_time.tv_sec -= my_data->prev_time.tv_sec;
+
+ if (my_data->curr_time.tv_usec < my_data->prev_time.tv_usec) {
+ my_data->elapsed_time.tv_usec += 1000000;
+ my_data->elapsed_time.tv_sec--;
+ }
+
+ if (my_data->elapsed_time.tv_usec >= 1000000) {
+ my_data->elapsed_time.tv_usec -= 1000000;
+ my_data->elapsed_time.tv_sec++;
+ }
+}
+
+
+static int
+disk_test_clear_stats(disk_data_t *my_data)
+{
+ int i;
+ for (i = 0; i < DISK_MAX_COUNTERS; i++) {
+ my_data->stats.counter[i] = 0;
+ }
+ HIST_CLEAR(my_data->read_hist);
+ HIST_CLEAR(my_data->write_hist);
+ my_data->elapsed_time.tv_usec = 0;
+ my_data->elapsed_time.tv_sec = 0;
+ gettimeofday(&(my_data->prev_time),NULL);
+ my_data->curr_time = my_data->prev_time;
+ return(NPE_SUCCESS);
+}
+
+
+static void
+disk_test_decode_stats(xmlNodePtr stats,test_t *test)
+{
+ if (test->debug) {
+ fprintf(test->where,"%s: entered for %s test %s\n",
+ __func__, test->id, test->test_name);
+ fflush(test->where);
+ }
+}
+
+
+static xmlNodePtr
+disk_test_get_stats(test_t *test)
+{
+ xmlNodePtr stats = NULL;
+ xmlNodePtr hist = NULL;
+ xmlAttrPtr ap = NULL;
+ int i,j;
+ char value[64];
+ char name[64];
+ uint64_t loc_cnt[DISK_MAX_COUNTERS];
+
+ disk_data_t *my_data = GET_TEST_DATA(test);
+
+ if (test->debug) {
+ fprintf(test->where,"%s: entered for %s test %s\n",
+ __func__, test->id, test->test_name);
+ fflush(test->where);
+ }
+ if ((stats = xmlNewNode(NULL,(xmlChar *)"test_stats")) != NULL) {
+ /* set the properites of the test_stats message -
+ the tid and time stamps/values and counter values sgb 2006-03-15 */
+
+ ap = xmlSetProp(stats,(xmlChar *)"tid",test->id);
+ for (i = 0; i < DISK_MAX_COUNTERS; i++) {
+ loc_cnt[i] = my_data->stats.counter[i];
+ if (test->debug) {
+ fprintf(test->where,"DISK_COUNTER%X = %#llx\n",i,loc_cnt[i]);
+ }
+ }
+ if (GET_TEST_STATE == TEST_MEASURE) {
+ gettimeofday(&(my_data->curr_time), NULL);
+ if (ap != NULL) {
+ sprintf(value,"%ld",my_data->curr_time.tv_sec);
+ ap = xmlSetProp(stats,(xmlChar *)"time_sec",(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"time_sec=%s\n",value);
+ fflush(test->where);
+ }
+ }
+ if (ap != NULL) {
+ sprintf(value,"%ld",my_data->curr_time.tv_usec);
+ ap = xmlSetProp(stats,(xmlChar *)"time_usec",(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"time_usec=%s\n",value);
+ fflush(test->where);
+ }
+ }
+ }
+ else {
+ if (ap != NULL) {
+ sprintf(value,"%ld",my_data->elapsed_time.tv_sec);
+ ap = xmlSetProp(stats,(xmlChar *)"elapsed_sec",(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"elapsed_sec=%s\n",value);
+ fflush(test->where);
+ }
+ }
+ if (ap != NULL) {
+ sprintf(value,"%ld",my_data->elapsed_time.tv_usec);
+ ap = xmlSetProp(stats,(xmlChar *)"elapsed_usec",(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"elapsed_usec=%s\n",value);
+ fflush(test->where);
+ }
+ }
+ }
+ for (i = 0; i < DISK_MAX_COUNTERS; i++) {
+ if (ap == NULL) {
+ break;
+ }
+ if (loc_cnt[i]) {
+ sprintf(value,"%#llx",my_data->stats.counter[i]);
+ sprintf(name,"cntr%1X_value",i);
+ ap = xmlSetProp(stats,(xmlChar *)name,(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"%s=%s\n",name,value);
+ fflush(test->where);
+ }
+ }
+ }
+ /* add hist_stats entries to the status report */
+ if (my_data->stats.named.read_calls > 0) {
+ snprintf(name,32,"DISK_READ test %s",test->id);
+ hist = HIST_stats_node(my_data->read_hist, name);
+ if (hist != NULL) {
+ xmlAddChild(stats,hist);
+ }
+ }
+ if (my_data->stats.named.write_calls > 0) {
+ snprintf(name,63,"DISK_WRITE test %s",test->id);
+ hist = HIST_stats_node(my_data->write_hist, name);
+ if (hist != NULL) {
+ xmlAddChild(stats,hist);
+ }
+ }
+ if (ap == NULL) {
+ xmlFreeNode(stats);
+ stats = NULL;
+ }
+ }
+ if (test->debug) {
+ fprintf(test->where,"%s: exiting for %s test %s\n",
+ __func__, test->id, test->test_name);
+ fflush(test->where);
+ }
+ return(stats);
+} /* end of disk_test_get_stats */
+
+
+
+static void
+fix_up_parms(test_t *test)
+{
+ disk_data_t *my_data;
+ off_t max_chunk;
+ off_t value;
+ char *buf;
+ int loc_debug = 0;
+
+
+ my_data = GET_TEST_DATA(test);
+
+ /* default testSize */
+ if (my_data->testSize == 0) {
+ if (my_data->start_pos < (my_data->devSize - (my_data->chunk * 2))) {
+ my_data->testSize = my_data->devSize - my_data->start_pos;
+ }
+ else {
+ my_data->testSize = my_data->devSize;
+ }
+ value = my_data->chunk * 512;
+ if (my_data->testSize > value) {
+ my_data->testSize = value;
+ }
+ }
+
+ /* default chunk if 8K is to large */
+ max_chunk = my_data->testSize / 2;
+ if (my_data->chunk > max_chunk) {
+ my_data->chunk = max_chunk;
+ }
+
+ /* default end_position */
+ if (my_data->end_pos == 0) {
+ if (my_data->start_pos < (my_data->devSize - (my_data->chunk * 2))) {
+ my_data->end_pos = my_data->start_pos + my_data->testSize;
+ }
+ else {
+ my_data->end_pos = my_data->testSize;
+ }
+ }
+
+ if (my_data->testSize > my_data->devSize) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_SIZE_TO_LARGE,
+ "disk test size is larger than device capacity");
+ }
+ else if (my_data->start_pos > (my_data->devSize - my_data->testSize)) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_START_POS_TO_LARGE,
+ "start_position value is to large");
+ }
+ else if (my_data->end_pos > my_data->devSize) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_END_POS_TO_LARGE,
+ "end_postion value is past end of device");
+ }
+ else if (my_data->end_pos > (my_data->start_pos + my_data->testSize)) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_END_POS_TO_LARGE,
+ "end_postion value is past end of testSize");
+ }
+ else if (my_data->chunk > (my_data->testSize/2)) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_IO_SIZE_TO_LARGE,
+ "disk io size is too large");
+ }
+ my_data->where = my_data->start_pos;
+
+ value = sysconf(_SC_PAGE_SIZE);
+ buf = malloc(my_data->chunk + value - 1);
+ my_data->orig_buffer = buf;
+ buf = (char *)(((long)buf + (long)value - 1) & ~((long)value -1));
+ my_data->buffer_start = buf;
+
+ if (test->debug || loc_debug) {
+ fprintf(test->where,
+ "%s:%s testSize = %lld\n", test->id, __func__,
+ my_data->testSize);
+ fprintf(test->where,
+ "%s:%s chunk = %ld\n", test->id, __func__,
+ my_data->chunk);
+ fprintf(test->where,
+ "%s:%s start_position = %lld\n", test->id, __func__,
+ my_data->start_pos);
+ fprintf(test->where,
+ "%s:%s end_position = %lld\n", test->id, __func__,
+ my_data->end_pos);
+ fprintf(test->where,
+ "%s:%s devSize = %lld\n", test->id, __func__,
+ my_data->devSize);
+ fprintf(test->where,
+ "%s:%s diskSize = %lld\n", test->id, __func__,
+ my_data->diskSize);
+ fprintf(test->where,
+ "%s:%s sectSize = %lld\n", test->id, __func__,
+ my_data->sectSize);
+ fprintf(test->where,
+ "%s:%s where = %lld\n", test->id, __func__,
+ my_data->where);
+ fprintf(test->where,
+ "%s:%s buffer_start = %p\n", test->id, __func__,
+ my_data->buffer_start);
+ fflush(test->where);
+ }
+}
+
+
+
+static void
+raw_disk_init(test_t *test)
+{
+ int fd = -1;
+ disk_describe_type *describe;
+ union inquiry_data *scsi_inq;
+ struct sioc_lun_limits *lun_limits;
+ disk_data_t *my_data;
+ struct stat stat_buf;
+ struct capacity scsi_capacity;
+ capacity_type capacity;
+ int ir_flag;
+ int loc_debug = 0;
+
+
+ my_data = GET_TEST_DATA(test);
+ describe = &(my_data->dev_info);
+ scsi_inq = &(my_data->scsi_inq);
+ lun_limits = &(my_data->lun_limits);
+
+ if (stat(my_data->file_name, &stat_buf) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_STAT_FAILED,
+ "stat of file_name failed");
+ }
+ else if ((stat_buf.st_mode & S_IFMT) != S_IFCHR) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_NOT_CHARACTER_FILE,
+ "Test needs a character device");
+ }
+ else if ((fd = open(my_data->file_name, O_RDONLY)) < 0) {
+ fprintf(test->where,
+ "%s: open of file %s failed\n", __func__, my_data->file_name);
+ fflush(test->where);
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_OPEN_FAILED,
+ "open of file_name failed");
+ }
+ /* get disk information */
+ else if (ioctl(fd, DIOC_DESCRIBE, describe) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_DESCRIBE_FAILED,
+ "ioctl to get disk description failed");
+ }
+ else if ((describe->dev_type == UNKNOWN_DEV_TYPE) &&
+ (describe->intf_type == UNKNOWN_INTF)) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_NOT_IO_DEVICE,
+ "Test needs an I/O Device");
+ }
+ else {
+ my_data->sectSize = describe->lgblksz;
+ my_data->diskSize = (off_t)(describe->maxsva + 1) * my_data->sectSize;
+
+ switch(describe->intf_type) {
+ /* SCSI drives */
+ case SCSI_INTF:
+ if (ioctl(fd, SIOC_INQUIRY, &scsi_inq) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_SIOC_INQUIRY_FAILED,
+ "ioctl to get scsi disk information failed");
+ }
+ if (ioctl(fd, SIOC_CAPACITY, &scsi_capacity) < 0) {
+ if (ioctl(fd, DIOC_CAPACITY, &capacity) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_DIOC_CAPACITY_FAILED,
+ "ioctl to get scsi disk capacity failed");
+ }
+ else {
+ my_data->devSize = (off_t)capacity.lba * (off_t)DEV_BSIZE;
+ }
+ }
+ else {
+ my_data->devSize = (off_t)scsi_capacity.lba *
+ (off_t)scsi_capacity.blksz;
+ }
+ if (describe->dev_type == CDROM_DEV_TYPE) {
+ ir_flag = 101;
+ }
+ else {
+ if (my_data->scsi_immreport != -1) {
+ if (ioctl(fd, SIOC_GET_IR, &ir_flag) == EIO) {
+ if (test->debug) {
+ fprintf(test->where, "%s: ioctl(SIOC_GET_IR) failed\n", __func__);
+ fflush(test->where);
+ }
+ }
+ if (!(ir_flag == 0 || ir_flag == 1)) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_SIOC_GET_IR_FAILED,
+ "ioctl SIOC_GET_IR returned illegal value");
+ }
+ else if (my_data->scsi_immreport != -1) {
+ my_data->OrigImmReportValue = ir_flag;
+ if (ioctl(fd, SIOC_SET_IR, my_data->scsi_immreport) < 0) {
+ fprintf(test->where,
+ "Could not modify immediate report for device %s\n",
+ my_data->file_name);
+ fflush(test->where);
+ my_data->immReportValue = -1;
+ }
+ }
+ }
+ if (my_data->scsi_queue_depth != -1) {
+ if (ioctl(fd, SIOC_GET_LUN_LIMITS, lun_limits) < 0) {
+ fprintf(test->where,
+ "Could not get queue depth for device %s\n",
+ my_data->file_name);
+ fflush(test->where);
+ my_data->OrigQueueDepthValue = 0;
+ }
+ else {
+ my_data->OrigQueueDepthValue = lun_limits->max_q_depth;
+ (void) memset(lun_limits->reserved,0,sizeof(lun_limits->reserved));
+ lun_limits->max_q_depth = my_data->scsi_queue_depth;
+ lun_limits->flags = SCTL_ENABLE_TAGS;
+ if (ioctl(fd, SIOC_SET_LUN_LIMITS, lun_limits) < 0) {
+ fprintf(test->where,
+ "Could not set queue depth for device %s\n",
+ my_data->file_name);
+ fflush(test->where);
+ my_data->queueDepthValue = 0;
+ }
+ else {
+ my_data->queueDepthValue = lun_limits->max_q_depth;
+ }
+ }
+ }
+ }
+ break;
+ case UNKNOWN_INTF:
+ default:
+ /* We have a known device type, but an unknown interface,
+ so let's assume it is an lvm volume */
+ if (ioctl(fd, DIOC_CAPACITY, &capacity) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_DIOC_CAPACITY_FAILED,
+ "ioctl DIOC_CAPACITY failed");
+ }
+ my_data->diskSize = (off_t)capacity.lba * my_data->sectSize;
+ my_data->devSize = (off_t)capacity.lba * my_data->sectSize;
+ break;
+ }
+ }
+ my_data->fd = fd;
+}
+
+
+
+static void
+do_disk_warmup(test_t *test)
+{
+ disk_data_t *my_data;
+
+ void *buf_addr;
+ int fd;
+ off_t i;
+ size_t size;
+ off_t where;
+ off_t xfer_size;
+
+ /* get parameters from the test specific data area */
+ my_data = GET_TEST_DATA(test);
+ buf_addr = my_data->buffer_start;
+ size = my_data->chunk;
+ where = my_data->where;
+ fd = my_data->fd;
+ xfer_size = my_data->testSize;
+
+ /* Perform a warmup I/O by reading 8K bytes from the disk.
+ * This is needed to get the drive to perform any thermal
+ * recalibrations that it might need to do before the tests
+ * begin. Thermal recalibrations are bad because they can
+ * cause an I/O to delay up to two seconds, causing significant
+ * variation during testing. This code insures that at least
+ * 8K bytes of data have been read from the disk before entering
+ * the load state. sgb 3/9/2006 */
+
+ if (size > 8192) {
+ size = 8192;
+ }
+ if (xfer_size > 8192) {
+ xfer_size = 8192;
+ }
+ if (lseek(fd, where, SEEK_SET) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_SEEK_ERROR,
+ "lseek error");
+ }
+ for (i = 0; i < xfer_size; i += size) {
+ io_read(fd, buf_addr, size, test, (char *)__func__);
+ }
+}
+
+
+static uint32_t
+do_raw_seq_disk_io(test_t *test)
+{
+ uint32_t new_state;
+ uint32_t state;
+ disk_data_t *my_data;
+
+ void *buf_addr;
+ int fd;
+ int readIO;
+ size_t size;
+ off_t where;
+ off_t xfer_size;
+
+ off_t i;
+ ssize_t bytes;
+
+
+
+ my_data = GET_TEST_DATA(test);
+ state = GET_TEST_STATE;
+
+ /* get parameters from the test specific data area */
+ buf_addr = my_data->buffer_start;
+ fd = my_data->fd;
+ size = my_data->chunk;
+ where = my_data->where;
+ xfer_size = my_data->testSize;
+
+ if (test->debug) {
+ fprintf(test->where, "%s: testSize = %lld\n", __func__, xfer_size);
+ fprintf(test->where, "%s: size = %ld\n", __func__, size);
+ fprintf(test->where, "%s: where = %lld\n", __func__, where);
+ fflush(test->where);
+ }
+ if (my_data->read != 0.0) {
+ readIO = 1;
+ }
+ else {
+ close(fd);
+ readIO = 0;
+ if ((fd = open(my_data->file_name, O_RDWR)) < 0) {
+ fprintf(test->where,
+ "%s: read/write open of file %s failed\n",
+ __func__, my_data->file_name);
+ fflush(test->where);
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_RDWR_OPEN_FAILED,
+ "read/write open of file_name failed");
+ }
+ }
+
+ /* seek to the starting location on the disk */
+ if (NO_STATE_CHANGE(test)) {
+ if (lseek(fd, where, SEEK_SET) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_SEEK_ERROR,
+ "lseek error");
+ }
+ }
+
+ i = 0;
+ while (NO_STATE_CHANGE(test)) {
+ HISTOGRAM_VARS;
+ if (state == TEST_MEASURE) {
+ HIST_TIMESTAMP(&time_one);
+ }
+ if (readIO) {
+ bytes = io_read(fd, buf_addr, size, test, (char *)__func__);
+ if (state == TEST_MEASURE) {
+ if (my_data->read_hist) {
+ HIST_TIMESTAMP(&time_two);
+ HIST_ADD(my_data->read_hist, &time_one, &time_two);
+ }
+ my_data->stats.named.read_calls++;
+ my_data->stats.named.bytes_read += bytes;
+ }
+ }
+ else {
+ bytes = io_write(fd, buf_addr, size, test, (char *)__func__);
+ if (state == TEST_MEASURE) {
+ if (my_data->write_hist) {
+ HIST_TIMESTAMP(&time_two);
+ HIST_ADD(my_data->write_hist, &time_one, &time_two);
+ }
+ my_data->stats.named.write_calls++;
+ my_data->stats.named.bytes_written += bytes;
+ }
+ }
+ i += bytes;
+ if ( i >= xfer_size ) {
+ /* seek to the starting location on the disk */
+ if (lseek(fd, where, SEEK_SET) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ DISK_TEST_SEEK_ERROR,
+ "lseek error");
+ }
+ if (state == TEST_MEASURE) {
+ my_data->stats.named.lseek_calls++;
+ }
+ i = 0;
+ }
+ }
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_LOADED) {
+ /* transitioning to loaded state from measure state
+ set current timestamp and update elapsed time */
+ gettimeofday(&(my_data->curr_time), NULL);
+ update_elapsed_time(my_data);
+ }
+ if (new_state == TEST_MEASURE) {
+ /* transitioning to measure state from loaded state
+ set previous timestamp */
+ gettimeofday(&(my_data->prev_time), NULL);
+ }
+ return(new_state);
+}
+
+
+
+int
+raw_seq_disk_io_clear_stats(test_t *test)
+{
+ return(disk_test_clear_stats(GET_TEST_DATA(test)));
+}
+
+
+xmlNodePtr
+raw_seq_disk_io_get_stats(test_t *test)
+{
+ return( disk_test_get_stats(test));
+}
+
+void
+raw_seq_disk_io_decode_stats(xmlNodePtr stats,test_t *test)
+{
+ disk_test_decode_stats(stats,test);
+}
+
+
+void
+raw_seq_disk_io(test_t *test)
+{
+ uint32_t state, new_state;
+
+ NETPERF_DEBUG_ENTRY(test->debug, test->where);
+
+ disk_test_init(test);
+ state = GET_TEST_STATE;
+ while ((state != TEST_ERROR) &&
+ (state != TEST_DEAD )) {
+ switch(state) {
+ case TEST_PREINIT:
+ new_state = TEST_INIT;
+ break;
+ case TEST_INIT:
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_IDLE) {
+ raw_disk_init(test);
+ fix_up_parms(test);
+ }
+ break;
+ case TEST_IDLE:
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_IDLE) {
+ sleep(1);
+ }
+ if (new_state == TEST_LOADED) {
+ do_disk_warmup(test);
+ }
+ break;
+ case TEST_MEASURE:
+ case TEST_LOADED:
+ new_state = do_raw_seq_disk_io(test);
+ break;
+ default:
+ break;
+ } /* end of switch */
+ set_test_state(test, new_state);
+ state = GET_TEST_STATE;
+ } /* end of while */
+ wait_to_die(test,free_disk_test_data);
+
+ NETPERF_DEBUG_EXIT(test->debug, test->where);
+
+} /* end of seq_disk_io */
+
+
+
+static void
+disk_test_results_init(tset_t *test_set,char *report_flags,char *output)
+{
+ disk_results_t *rd;
+ FILE *outfd;
+ int max_count;
+ size_t malloc_size;
+
+ rd = test_set->report_data;
+ max_count = test_set->confidence.max_count;
+
+ if (output) {
+ if (test_set->debug) {
+ fprintf(test_set->where,
+ "%s: report going to file %s\n",
+ __func__, output);
+ fflush(test_set->where);
+ }
+ outfd = fopen(output,"a");
+ }
+ else {
+ if (test_set->debug) {
+ fprintf(test_set->where,
+ "%s: report going to file stdout\n",
+ __func__);
+ fflush(test_set->where);
+ }
+ outfd = stdout;
+ }
+ /* allocate and initialize report data */
+ malloc_size = sizeof(disk_results_t) + 7 * max_count * sizeof(double);
+ rd = malloc(malloc_size);
+ if (rd) {
+
+ /* original code took sizeof a math equation so memset only zeroed the */
+ /* first sizeof(size_t) bytes. This should work better sgb 20060203 */
+
+ memset(rd, 0, malloc_size);
+ rd->max_count = max_count;
+ rd->iops = &(rd->results_start);
+ rd->read_iops = &(rd->iops[max_count]);
+ rd->write_iops = &(rd->read_iops[max_count]);
+ rd->read_results = &(rd->write_iops[max_count]);
+ rd->write_results = &(rd->read_results[max_count]);
+ rd->utilization = &(rd->write_results[max_count]);
+ rd->servdemand = &(rd->utilization[max_count]);
+ rd->run_time = &(rd->servdemand[max_count]);
+ rd->iops_minimum = DBL_MAX;
+ rd->iops_maximum = DBL_MIN;
+ rd->outfd = outfd;
+ rd->sd_denominator = 0.0;
+ /* not all strcmp's play well with NULL pointers. bummer */
+ if (NULL != report_flags) {
+ if (!strcmp(report_flags,"PRINT_RUN")) {
+ rd->print_run = 1;
+ }
+ if (!strcmp(report_flags,"PRINT_TESTS")) {
+ rd->print_test = 1;
+ }
+ if (!strcmp(report_flags,"PRINT_ALL")) {
+ rd->print_hist = 1;
+ rd->print_run = 1;
+ rd->print_test = 1;
+ rd->print_per_cpu = 1;
+ }
+ }
+ if (test_set->debug) {
+ rd->print_hist = 1;
+ rd->print_run = 1;
+ rd->print_test = 1;
+ rd->print_per_cpu = 1;
+ }
+ test_set->report_data = rd;
+ }
+ else {
+ /* could not allocate memory can't generate report */
+ fprintf(outfd,
+ "%s: malloc failed can't generate report\n",
+ __func__);
+ fflush(outfd);
+ exit(-11);
+ }
+}
+
+static void
+process_test_stats(tset_t *test_set, xmlNodePtr stats, xmlChar *tid)
+{
+ int i;
+ int count;
+ int index;
+ FILE *outfd;
+ disk_results_t *rd;
+
+ double elapsed_seconds;
+ double iops;
+ double read_rate;
+ double write_rate;
+ double read_call_rate;
+ double write_call_rate;
+ double seek_call_rate;
+
+#define TST_E_SEC 0
+#define TST_E_USEC 1
+#define TST_R_CALLS 4
+#define TST_R_BYTES 5
+#define TST_W_CALLS 6
+#define TST_W_BYTES 7
+#define TST_S_CALLS 8
+
+#define MAX_TEST_CNTRS 9
+ double test_cntr[MAX_TEST_CNTRS];
+ const char *cntr_name[] = {
+ "elapsed_sec",
+ "elapsed_usec",
+ "time_sec",
+ "time_usec",
+ "cntr0_value",
+ "cntr1_value",
+ "cntr2_value",
+ "cntr3_value",
+ "cntr4_value",
+ };
+
+ rd = test_set->report_data;
+ count = test_set->confidence.count;
+ outfd = rd->outfd;
+ index = count - 1;
+
+ /* process test statistics */
+ NETPERF_DEBUG_ENTRY(test_set->debug, test_set->where);
+
+ for (i=0; i<MAX_TEST_CNTRS; i++) {
+ char *value_str =
+ (char *)xmlGetProp(stats, (const xmlChar *)cntr_name[i]);
+ if (value_str) {
+ test_cntr[i] = strtod(value_str,NULL);
+ if (test_cntr[i] == 0.0) {
+ uint64_t x;
+ sscanf(value_str,"%llx",&x);
+ test_cntr[i] = (double)x;
+ }
+ }
+ else {
+ test_cntr[i] = 0.0;
+ }
+ if (test_set->debug) {
+ fprintf(test_set->where,"\t%12s test_cntr[%2d] = %10g\t'%s'\n",
+ cntr_name[i], i, test_cntr[i],
+ xmlGetProp(stats, (const xmlChar *)cntr_name[i]));
+ }
+ }
+ elapsed_seconds = test_cntr[TST_E_SEC] + test_cntr[TST_E_USEC]/1000000.0;
+ read_rate = test_cntr[TST_R_BYTES] / (elapsed_seconds*1024.0*1024.0);
+ write_rate = test_cntr[TST_W_BYTES] / (elapsed_seconds*1024.0*1024.0);
+ read_call_rate = test_cntr[TST_R_CALLS] / elapsed_seconds;
+ write_call_rate = test_cntr[TST_W_CALLS] / elapsed_seconds;
+ seek_call_rate = test_cntr[TST_S_CALLS] / elapsed_seconds;
+ iops = read_call_rate + write_call_rate;
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tread_rate = %7g\t%7g\n",
+ read_rate, test_cntr[TST_R_BYTES]);
+ fprintf(test_set->where,"\twrite_rate = %7g\t%7g\n",
+ write_rate, test_cntr[TST_W_BYTES]);
+ fprintf(test_set->where,"\tread_call_rate = %7g\t%7g\n",
+ read_call_rate, test_cntr[TST_R_CALLS]);
+ fprintf(test_set->where,"\twrite_call_rate = %7g\t%7g\n",
+ write_call_rate, test_cntr[TST_W_CALLS]);
+ fprintf(test_set->where,"\tseek_call_rate = %7g\t%7g\n",
+ seek_call_rate, test_cntr[TST_S_CALLS]);
+ fflush(test_set->where);
+ }
+ if (rd->sd_denominator == 0.0) {
+ rd->sd_denominator = 1024.0*1024.0/1024.0;
+ }
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tsd_denominator = %f\n",rd->sd_denominator);
+ fflush(test_set->where);
+ }
+ /* accumulate results for the run */
+ rd->run_time[index] += elapsed_seconds;
+ rd->read_results[index] += read_rate;
+ rd->write_results[index] += write_rate;
+ rd->read_iops[index] += read_call_rate;
+ rd->write_iops[index] += write_call_rate;
+ rd->iops[index] += iops;
+
+ if (rd->print_hist) {
+ xmlNodePtr hist;
+ hist = stats->xmlChildrenNode;
+ if (hist == NULL) {
+ fprintf(outfd,"%s:No Histogram Node Found\n\n",__func__);
+ fflush(outfd);
+ }
+ while (hist != NULL) {
+ if (!xmlStrcmp(hist->name,(const xmlChar *)"hist_stats")) {
+ HIST_REPORT(outfd, hist);
+ }
+ hist = hist->next;
+ }
+ }
+
+ if (rd->print_test) {
+ /* Display per test results */
+ fprintf(outfd,"%3d ", count); /* 0,5 */
+ fprintf(outfd,"%-6s ", tid); /* 5,7 */
+ fprintf(outfd,"%-6.2f ",elapsed_seconds); /* 12,7 */
+ fprintf(outfd,"%7.2f ",iops); /* 19,8 */
+ fprintf(outfd,"%7.2f ",read_call_rate); /* 27.8 */
+ fprintf(outfd,"%7.2f ",write_call_rate); /* 35,8 */
+ fprintf(outfd,"%7.2f ",read_rate); /* 43,8 */
+ fprintf(outfd,"%7.2f ",write_rate); /* 51,8 */
+ fprintf(outfd,"%7.4f ",seek_call_rate); /* 59,8 */
+ fprintf(outfd,"%7.2f ",iops/seek_call_rate); /* 67,8 */
+ fprintf(outfd,"\n");
+ fflush(outfd);
+ }
+ /* end of printing disk per test instance results */
+}
+
+static double
+process_sys_stats(tset_t *test_set, xmlNodePtr stats, xmlChar *tid)
+{
+ int i;
+ int count;
+ int index;
+ FILE *outfd;
+ disk_results_t *rd;
+ double elapsed_seconds;
+ double sys_util;
+ double calibration;
+ double local_idle;
+ double local_busy;
+ double local_cpus;
+
+#define MAX_SYS_CNTRS 10
+#define E_SEC 0
+#define E_USEC 1
+#define NUM_CPU 4
+#define CALIBRATE 5
+#define IDLE 6
+
+ double sys_cntr[MAX_SYS_CNTRS];
+ const char *sys_cntr_name[] = {
+ "elapsed_sec",
+ "elapsed_usec",
+ "time_sec",
+ "time_usec",
+ "number_cpus",
+ "calibration",
+ "idle_count",
+ "",
+ "",
+ ""
+ };
+
+ rd = test_set->report_data;
+ count = test_set->confidence.count;
+ outfd = rd->outfd;
+ index = count - 1;
+
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tprocessing sys_stats\n");
+ fflush(test_set->where);
+ }
+ for (i=0; i<MAX_SYS_CNTRS; i++) {
+ char *value_str =
+ (char *)xmlGetProp(stats, (const xmlChar *)sys_cntr_name[i]);
+ if (value_str) {
+ sys_cntr[i] = strtod(value_str,NULL);
+ if (sys_cntr[i] == 0.0) {
+ uint64_t x;
+ sscanf(value_str,"%llx",&x);
+ sys_cntr[i] = (double)x;
+ }
+ }
+ else {
+ sys_cntr[i] = 0.0;
+ }
+ if (test_set->debug) {
+ fprintf(test_set->where,"\t%12s sys_stats[%d] = %10g '%s'\n",
+ sys_cntr_name[i], i, sys_cntr[i],
+ xmlGetProp(stats, (const xmlChar *)sys_cntr_name[i]));
+ }
+ }
+ local_cpus = sys_cntr[NUM_CPU];
+ elapsed_seconds = sys_cntr[E_SEC] + sys_cntr[E_USEC]/1000000;
+ calibration = sys_cntr[CALIBRATE];
+ local_idle = sys_cntr[IDLE] / calibration;
+ local_busy = (calibration-sys_cntr[IDLE])/calibration;
+
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tnum_cpus = %f\n",local_cpus);
+ fprintf(test_set->where,"\telapsed_seconds = %7.2f\n",elapsed_seconds);
+ fprintf(test_set->where,"\tidle_cntr = %e\n",sys_cntr[IDLE]);
+ fprintf(test_set->where,"\tcalibrate_cntr = %e\n",sys_cntr[CALIBRATE]);
+ fprintf(test_set->where,"\tlocal_idle = %e\n",local_idle);
+ fprintf(test_set->where,"\tlocal_busy = %e\n",local_busy);
+ fflush(test_set->where);
+ }
+ rd->utilization[index] += local_busy;
+
+ if (rd->print_per_cpu) {
+ xmlNodePtr cpu;
+ char *value_str;
+
+ cpu = stats->xmlChildrenNode;
+ while (cpu != NULL) {
+ if (!xmlStrcmp(cpu->name,(const xmlChar *)"per_cpu_stats")) {
+ value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"cpu_id");
+ fprintf(outfd," cpu%2s ", value_str);
+ value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"calibration");
+ fprintf(outfd,"%s ", value_str);
+ value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"idle_count");
+ fprintf(outfd,"%s ", value_str);
+ value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"user_count");
+ fprintf(outfd,"%s ", value_str);
+ value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"sys_count");
+ fprintf(outfd,"%s ", value_str);
+ value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"int_count");
+ fprintf(outfd,"%s ", value_str);
+ value_str = (char *)xmlGetProp(cpu, (const xmlChar *)"other_count");
+ fprintf(outfd,"%s\n", value_str);
+ fflush(outfd);
+ }
+ cpu = cpu->next;
+ }
+ }
+
+ if (rd->print_test) {
+ /* Display per test results */
+ fprintf(outfd,"%3d ", count); /* 0,5 */
+ fprintf(outfd,"%-6s ", tid); /* 5,7 */
+ fprintf(outfd,"%-6.2f ",elapsed_seconds); /* 12,7 */
+ fprintf(outfd,"%24s",""); /* 19,24*/
+ fprintf(outfd,"%7.1e ",calibration); /* 43,8 */
+ fprintf(outfd,"%6.3f ",local_idle*100.0); /* 51,7 */
+ fprintf(outfd,"%6.3f ",local_busy*100.0); /* 58,7 */
+ fprintf(outfd,"\n"); /* 79,1 */
+ fflush(outfd);
+ }
+ /* end of printing sys stats instance results */
+ return(local_cpus);
+}
+
+static void
+process_stats_for_run(tset_t *test_set)
+{
+ disk_results_t *rd;
+ test_t *test;
+ tset_elt_t *set_elt;
+ xmlNodePtr stats;
+ xmlNodePtr prev_stats;
+ int count;
+ int index;
+ int num_of_tests;
+ double num_of_cpus;
+ double run_results;
+
+
+ rd = test_set->report_data;
+ set_elt = test_set->tests;
+ count = test_set->confidence.count;
+ index = count - 1;
+
+ if (test_set->debug) {
+ fprintf(test_set->where,
+ "test_set %s has %d tests looking for statistics\n",
+ test_set->id,test_set->num_tests);
+ fflush(test_set->where);
+ }
+
+ if (test_set->debug) {
+ fprintf(test_set->where, "%s count = %d\n", __func__, count);
+ fflush(test_set->where);
+ }
+
+ rd->iops[index] = 0.0;
+ rd->read_results[index] = 0.0;
+ rd->write_results[index] = 0.0;
+ rd->utilization[index] = 0.0;
+ rd->servdemand[index] = 0.0;
+ rd->run_time[index] = 0.0;
+
+ num_of_tests = 0;
+ num_of_cpus = 0.0;
+ while (set_elt != NULL) {
+ int stats_for_test;
+ test = set_elt->test;
+ stats = test->received_stats->xmlChildrenNode;
+ if (test_set->debug) {
+ if (stats) {
+ fprintf(test_set->where,
+ "\ttest %s has '%s' statistics\n",
+ test->id,stats->name);
+ }
+ else {
+ fprintf(test_set->where,
+ "\ttest %s has no statistics available!\n",
+ test->id);
+ }
+ fflush(test_set->where);
+ }
+ stats_for_test = 0;
+ while (stats != NULL) {
+ /* process all the statistics records for this test */
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tfound some statistics");
+ fflush(test_set->where);
+ }
+ if(!xmlStrcmp(stats->name,(const xmlChar *)"sys_stats")) {
+ /* process system statistics */
+ num_of_cpus = process_sys_stats(test_set, stats, test->id);
+ stats_for_test++;
+ }
+ if(!xmlStrcmp(stats->name,(const xmlChar *)"test_stats")) {
+ /* process test statistics */
+ process_test_stats(test_set, stats, test->id);
+ stats_for_test++;
+ num_of_tests++;
+ }
+ /* other types of nodes just get skipped by this report routine */
+ /* delete statistics entry from test */
+ prev_stats = stats;
+ stats = stats->next;
+ xmlUnlinkNode(prev_stats);
+ xmlFreeNode(prev_stats);
+ }
+ /* should only have one stats record for each test otherwise error */
+ if (stats_for_test > 1) {
+ /* someone is playing games don't generate report*/
+ fprintf(test_set->where,
+ "More than one statistics measurement for test %d\n",
+ stats_for_test);
+ fprintf(test_set->where,
+ "%s was not designed to deal with this.\n",
+ __func__);
+ fprintf(test_set->where,
+ "exiting netperf now!!\n");
+ fflush(test_set->where);
+ exit(-13);
+ }
+ set_elt = set_elt->next;
+ }
+
+ if (rd->iops_minimum > rd->iops[index]) {
+ rd->iops_minimum = rd->iops[index];
+ }
+ if (rd->iops_maximum < rd->iops[index]) {
+ rd->iops_maximum = rd->iops[index];
+ }
+ rd->run_time[index] = rd->run_time[index] / (double)num_of_tests;
+
+ /* now calculate service demand for this test run. Remember the cpu */
+ /* utilization is in the range 0.0 to 1.0 so we need to multiply by */
+ /* the number of cpus and 1,000,000.0 to get to microseconds of cpu */
+ /* time per unit of work. Service demand is calculated on the sum */
+ /* of read and write results which are in 2^20 bytes per second. */
+ /* the sd_denominator is factored in to convert service demand into */
+ /* usec/Kbytes. */
+
+ run_results = rd->read_results[index] + rd->write_results[index];
+ if ((run_results != 0.0) && (num_of_cpus != 0.0)) {
+ rd->servdemand[index] = rd->utilization[index] * num_of_cpus * 1000000.0 /
+ (run_results * rd->sd_denominator);
+ }
+ NETPERF_DEBUG_EXIT(test_set->debug,test_set->where);
+}
+
+
+static void
+update_results_and_confidence(tset_t *test_set)
+{
+ disk_results_t *rd;
+ double confidence;
+ double temp;
+ int loc_debug = 0;
+
+ rd = test_set->report_data;
+
+ NETPERF_DEBUG_ENTRY(test_set->debug,test_set->where);
+
+ /* calculate confidence and summary result values */
+ rd->read_confidence = get_confidence(rd->read_results,
+ &(test_set->confidence),
+ &(rd->read_measured_mean),
+ &(rd->read_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\tread_results conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * rd->read_confidence,
+ rd->read_measured_mean,
+ rd->read_interval);
+ fflush(test_set->where);
+ }
+ rd->write_confidence = get_confidence(rd->write_results,
+ &(test_set->confidence),
+ &(rd->write_measured_mean),
+ &(rd->write_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\twrite_results conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * rd->write_confidence,
+ rd->write_measured_mean,
+ rd->write_interval);
+ fflush(test_set->where);
+ }
+ confidence = get_confidence(rd->run_time,
+ &(test_set->confidence),
+ &(rd->ave_time),
+ &(temp));
+ rd->iops_confidence = get_confidence(rd->iops,
+ &(test_set->confidence),
+ &(rd->iops_measured_mean),
+ &(rd->iops_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\tiops conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * rd->iops_confidence,
+ rd->iops_measured_mean,
+ rd->iops_interval);
+ fflush(test_set->where);
+ }
+ rd->cpu_util_confidence = get_confidence(rd->utilization,
+ &(test_set->confidence),
+ &(rd->cpu_util_measured_mean),
+ &(rd->cpu_util_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\tcpu_util conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * rd->cpu_util_confidence,
+ rd->cpu_util_measured_mean,
+ rd->cpu_util_interval);
+ fflush(test_set->where);
+ }
+ rd->service_demand_confidence = get_confidence(rd->servdemand,
+ &(test_set->confidence),
+ &(rd->service_demand_measured_mean),
+ &(rd->service_demand_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\tserv_demand conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * rd->service_demand_confidence,
+ rd->service_demand_measured_mean,
+ rd->service_demand_interval);
+ fflush(test_set->where);
+ }
+
+ if (rd->iops_confidence > rd->cpu_util_confidence) {
+ confidence = rd->iops_confidence;
+ }
+ else {
+ confidence = rd->cpu_util_confidence;
+ }
+ if (rd->service_demand_confidence > confidence) {
+ confidence = rd->service_demand_confidence;
+ }
+ if (rd->write_measured_mean > 0.0) {
+ if (rd->write_confidence > confidence) {
+ confidence = rd->write_confidence;
+ }
+ }
+ if (rd->read_measured_mean > 0.0) {
+ if (rd->read_confidence > confidence) {
+ confidence = rd->read_confidence;
+ }
+ }
+
+ if (test_set->confidence.min_count > 1) {
+ test_set->confidence.value = test_set->confidence.interval - confidence;
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\t%3d run confidence = %.2f%%\tcheck value = %f\n",
+ test_set->confidence.count,
+ 100.0 * confidence, test_set->confidence.value);
+ fflush(test_set->where);
+ }
+ }
+ NETPERF_DEBUG_EXIT(test_set->debug,test_set->where);
+}
+
+
+static void
+print_run_results(tset_t *test_set)
+{
+ disk_results_t *rd;
+ FILE *outfd;
+ int i;
+ int count;
+ int index;
+
+#define HDR_LINES 3
+ char *field1[HDR_LINES] = { "INT", "NUM", " " }; /* 3 */
+ char *field2[HDR_LINES] = { "SET", "Name", " " }; /* 4 */
+ char *field3[HDR_LINES] = { "RUN", "Time", "sec" }; /* 6 */
+ char *field4[HDR_LINES] = { "I/0", "RATE", "io/s" }; /* 7 */
+ char *field5[HDR_LINES] = { "READ", "Rate", "MB/s" }; /* 6 */
+ char *field6[HDR_LINES] = { "WRT", "Rate", "MB/s" }; /* 6 */
+ char *field7[HDR_LINES] = { "CPU", "Util", "%/100" }; /* 6 */
+ char *field8[HDR_LINES] = { "SD", "usec", "/KB" }; /* 6 */
+ char *field9[HDR_LINES] = { "conf", "+/-", "io/s" }; /* 5 */
+ char *field10[HDR_LINES] = { "conf", "+/-", "MB/s" }; /* 5 */
+ char *field11[HDR_LINES] = { "conf", "+/-", "MB/s" }; /* 5 */
+ char *field12[HDR_LINES] = { "+/-", "Util", "%/100" }; /* 6 */
+ char *field13[HDR_LINES] = { "+/-", "usec", "/KB" }; /* 6 */
+
+ rd = test_set->report_data;
+ count = test_set->confidence.count;
+ outfd = rd->outfd;
+ index = count - 1;
+
+
+ /* Display per run header */
+ fprintf(outfd,"\n");
+ for (i=0;i < HDR_LINES; i++) {
+ fprintf(outfd,"%-3s ",field1[i]); /* 0,4 */
+ fprintf(outfd,"%-4s ",field2[i]); /* 4,5 */
+ fprintf(outfd,"%-6s ",field3[i]); /* 9,7 */
+ fprintf(outfd,"%9s ",field4[i]); /* 16,10 */
+ if (rd->read_results[index] > 0.0) {
+ fprintf(outfd,"%7s ",field5[i]); /* 26,8 */
+ }
+ if (rd->write_results[index] > 0.0) {
+ fprintf(outfd,"%7s ",field6[i]); /* 34,8 */
+ }
+ fprintf(outfd,"%7s ",field7[i]); /* 42,8 */
+ fprintf(outfd,"%7s ",field8[i]); /* 45,8 */
+ if (index > 0) {
+ fprintf(outfd,"%6s ",field9[i]); /* 52,7 */
+ if (rd->read_results[index] > 0.0) {
+ fprintf(outfd,"%6s ",field10[i]); /* 58,7 */
+ }
+ if (rd->write_results[index] > 0.0) {
+ fprintf(outfd,"%6s ",field11[i]); /* 64,7 */
+ }
+ fprintf(outfd,"%7s ",field12[i]); /* 70,8 */
+ fprintf(outfd,"%7s", field13[i]); /* 87,8 */
+ }
+ fprintf(outfd,"\n");
+ }
+
+ /* Display per run results */
+ fprintf(outfd,"%-3d ", count); /* 0,4 */
+ fprintf(outfd,"%-4s ",test_set->id); /* 4,5 */
+ fprintf(outfd,"%-6.2f ",rd->run_time[index]); /* 9,7 */
+ fprintf(outfd,"%9.2f ",rd->iops[index]); /* 16,10 */
+ if (rd->read_results[index] > 0.0) {
+ fprintf(outfd,"%7.2f ",rd->read_results[index]); /* 26,8 */
+ }
+ if (rd->write_results[index] > 0.0) {
+ fprintf(outfd,"%7.2f ",rd->write_results[index]); /* 34,8 */
+ }
+ fprintf(outfd,"%7.5f ",rd->utilization[index]); /* 42,8 */
+ fprintf(outfd,"%7.3f ",rd->servdemand[index]); /* 50,8 */
+ if (index > 0) {
+ fprintf(outfd,"%6.2f ",rd->iops_interval); /* 58,7 */
+ if (rd->read_results[index] > 0.0) {
+ fprintf(outfd,"%6.3f ",rd->read_interval); /* 65,7 */
+ }
+ if (rd->write_results[index] > 0.0) {
+ fprintf(outfd,"%6.3f ",rd->write_interval); /* 72,7 */
+ }
+ fprintf(outfd,"%7.5f ",rd->cpu_util_interval); /* 79,8 */
+ fprintf(outfd,"%7.4f", rd->service_demand_interval); /* 87,8 */
+ }
+ fprintf(outfd,"\n");
+ fflush(outfd);
+}
+
+
+static void
+print_did_not_meet_confidence(tset_t *test_set)
+{
+ disk_results_t *rd;
+ FILE *outfd;
+
+ rd = test_set->report_data;
+ outfd = rd->outfd;
+
+
+ /* print the confidence failed line */
+ fprintf(outfd,"\n");
+ fprintf(outfd,"!!! WARNING\n");
+ fprintf(outfd,"!!! Desired confidence was not achieved within ");
+ fprintf(outfd,"the specified iterations. (%d)\n",
+ test_set->confidence.max_count);
+ fprintf(outfd,
+ "!!! This implies that there was variability in ");
+ fprintf(outfd,
+ "the test environment that\n");
+ fprintf(outfd,
+ "!!! must be investigated before going further.\n");
+ fprintf(outfd,
+ "!!! Confidence intervals: IOP_RATE : %6.2f%%\n",
+ 100.0 * rd->iops_confidence);
+ if (rd->read_measured_mean > 0.0) {
+ fprintf(outfd,
+ "!!! Confidence intervals: READ_RATE : %6.2f%%\n",
+ 100.0 * rd->read_confidence);
+ }
+ if (rd->write_measured_mean > 0.0) {
+ fprintf(outfd,
+ "!!! Confidence intervals: WRITE_RATE : %6.2f%%\n",
+ 100.0 * rd->write_confidence);
+ }
+ fprintf(outfd,
+ "!!! CPU util : %6.2f%%\n",
+ 100.0 * rd->cpu_util_confidence);
+ fprintf(outfd,
+ "!!! ServDemand : %6.2f%%\n",
+ 100.0 * rd->service_demand_confidence);
+ fflush(outfd);
+}
+
+
+static void
+print_results_summary(tset_t *test_set)
+{
+ disk_results_t *rd;
+ FILE *outfd;
+ int i;
+
+#define HDR_LINES 3
+ /* field
+ width*/
+ char *field1[HDR_LINES] = { "AVE", " / ", "Num" }; /* 3 */
+ char *field2[HDR_LINES] = { "SET", "Name", " " }; /* 4 */
+ char *field3[HDR_LINES] = { "TEST", "Time", "sec" }; /* 6 */
+ char *field4[HDR_LINES] = { "I/O", "RATE", "io/s" }; /* 7 */
+ char *field5[HDR_LINES] = { "conf", "+/-", "io/s" }; /* 5 */
+ char *field6[HDR_LINES] = { "READ", "Rate", "MB/s" }; /* 6 */
+ char *field7[HDR_LINES] = { "conf", "+/-", "MB/s" }; /* 5 */
+ char *field8[HDR_LINES] = { "WRT", "Rate", "MB/s" }; /* 6 */
+ char *field9[HDR_LINES] = { "conf", "+/-", "MB/s" }; /* 5 */
+ char *field10[HDR_LINES] = { "CPU", "Util", "%/100" }; /* 6 */
+ char *field11[HDR_LINES] = { "+/-", "Util", "%/100" }; /* 6 */
+ char *field12[HDR_LINES] = { "SD", "usec", "/KB" }; /* 6 */
+ char *field13[HDR_LINES] = { "+/-", "usec", "/KB" }; /* 6 */
+
+ rd = test_set->report_data;
+ outfd = rd->outfd;
+
+ /* Print the summary header */
+ fprintf(outfd,"\n");
+ for (i = 0; i < HDR_LINES; i++) {
+ fprintf(outfd,"%-3s ",field1[i]); /* 0,4 */
+ fprintf(outfd,"%-4s ",field2[i]); /* 4,5 */
+ fprintf(outfd,"%-6s ",field3[i]); /* 9,7 */
+ fprintf(outfd,"%9s ",field4[i]); /* 16,10 */
+ fprintf(outfd,"%6s ",field5[i]); /* 26,7 */
+ if (rd->read_measured_mean > 0.0) {
+ fprintf(outfd,"%7s ",field6[i]); /* 33,8 */
+ fprintf(outfd,"%6s ",field7[i]); /* 41,7 */
+ }
+ if (rd->write_measured_mean > 0.0) {
+ fprintf(outfd,"%7s ",field8[i]); /* 48,8 */
+ fprintf(outfd,"%6s ",field9[i]); /* 56,7 */
+ }
+ fprintf(outfd,"%7s ",field10[i]); /* 65,8 */
+ fprintf(outfd,"%7s ",field11[i]); /* 73,8 */
+ fprintf(outfd,"%7s ",field12[i]); /* 81,8 */
+ fprintf(outfd,"%7s", field13[i]); /* 89,8 */
+ fprintf(outfd,"\n");
+ }
+
+ /* print the summary results line */
+ fprintf(outfd,"A%-2d ",test_set->confidence.count); /* 0,4 */
+ fprintf(outfd,"%-4s ",test_set->id); /* 4,5 */
+ fprintf(outfd,"%-6.2f ",rd->ave_time); /* 9,7 */
+ fprintf(outfd,"%9.2f ",rd->iops_measured_mean); /* 16,10 */
+ fprintf(outfd,"%6.2f ",rd->iops_interval); /* 26,7 */
+ if (rd->read_measured_mean > 0.0) {
+ fprintf(outfd,"%7.2f ",rd->read_measured_mean); /* 33,8 */
+ fprintf(outfd,"%6.3f ",rd->read_interval); /* 41,7 */
+ }
+ if (rd->write_measured_mean > 0.0) {
+ fprintf(outfd,"%7.2f ",rd->write_measured_mean); /* 48,8 */
+ fprintf(outfd,"%6.3f ",rd->write_interval); /* 56,7 */
+ }
+ fprintf(outfd,"%7.5f ",rd->cpu_util_measured_mean); /* 65,8 */
+ fprintf(outfd,"%7.5f ",rd->cpu_util_interval); /* 73,8 */
+ fprintf(outfd,"%7.3f ",rd->service_demand_measured_mean); /* 81,8 */
+ fprintf(outfd,"%7.4f", rd->service_demand_interval); /* 89,8 */
+ fprintf(outfd,"\n");
+ fflush(outfd);
+}
+
+
+void
+report_disk_test_results(tset_t *test_set, char *report_flags, char *output)
+{
+ disk_results_t *rd;
+ int count;
+ int max_count;
+ int min_count;
+
+ rd = test_set->report_data;
+
+ if (rd == NULL) {
+ disk_test_results_init(test_set,report_flags,output);
+ rd = test_set->report_data;
+ }
+
+ /* process statistics for this run */
+ process_stats_for_run(test_set);
+
+ /* calculate confidence and summary result values */
+ update_results_and_confidence(test_set);
+
+ if (rd->print_run) {
+ print_run_results(test_set);
+ }
+
+ count = test_set->confidence.count;
+ max_count = test_set->confidence.max_count;
+ min_count = test_set->confidence.min_count;
+
+ /* always print summary results at end of last call through loop */
+ if ((count >= max_count) ||
+ ((test_set->confidence.value >= 0) && (count >= min_count))) {
+ print_results_summary(test_set);
+ if ((test_set->confidence.value < 0) && (min_count > 1)) {
+ print_did_not_meet_confidence(test_set);
+ }
+ }
+} /* end of report_disk_test_results */
Added: branches/glib_migration/suites/disk/disktest.h
===================================================================
--- branches/glib_migration/suites/disk/disktest.h 2006-04-19 00:11:52 UTC (rev 167)
+++ branches/glib_migration/suites/disk/disktest.h 2006-04-19 00:23:57 UTC (rev 168)
@@ -0,0 +1,136 @@
+
+
+
+/* This file is Hewlett_Packard Company Confidental */
+
+ /* This file contains the test-specific definitions for netperf4's */
+ /* Hewlett-Packard Company disk tests */
+
+enum {
+ READ_CALLS = 0,
+ BYTES_READ,
+ WRITE_CALLS,
+ BYTES_WRITTEN,
+ LSEEK_CALLS,
+ DISK_MAX_COUNTERS
+};
+
+typedef struct disk_test_data {
+ /* parameters */
+ int fd;
+ size_t chunk;
+ float read;
+ char *file_name;
+ char *rpath;
+ char *bpath;
+ char *mount_point;
+ off_t where;
+ off_t testSize;
+ off_t start_pos;
+ off_t end_pos;
+ int scsi_immreport;
+ int scsi_queue_depth;
+
+ void *orig_buffer;
+ void *buffer_start;
+
+ /* information about the disk */
+ off_t devSize;
+ off_t diskSize;
+ off_t sectSize;
+ int immReportValue;
+ int OrigImmReportValue;
+ uint32_t queueDepthValue;
+ uint32_t OrigQueueDepthValue;
+ disk_describe_type dev_info;
+ union inquiry_data scsi_inq;
+ struct sioc_lun_limits lun_limits;
+
+ /* Statistics Counters */
+ union {
+ uint64_t counter[DISK_MAX_COUNTERS];
+ struct {
+ uint64_t read_calls;
+ uint64_t bytes_read;
+ uint64_t write_calls;
+ uint64_t bytes_written;
+ uint64_t lseek_calls;
+ } named;
+ } stats;
+ struct timeval elapsed_time;
+ struct timeval prev_time;
+ struct timeval curr_time;
+
+ /* Place for HISTOGRAM fields */
+ HIST read_hist;
+ HIST write_hist;
+} disk_data_t;
+
+typedef struct disk_results_data {
+ int max_count;
+ int print_hist;
+ int print_per_cpu;
+ int print_test;
+ int print_run;
+ FILE *outfd;
+ double *iops;
+ double *read_iops;
+ double *write_iops;
+ double *read_results;
+ double *write_results;
+ double *utilization;
+ double *servdemand;
+ double *run_time;
+ double ave_time;
+ double iops_measured_mean;
+ double iops_interval;
+ double iops_confidence;
+ double iops_minimum;
+ double iops_maximum;
+ double read_measured_mean;
+ double read_interval;
+ double read_confidence;
+ double write_measured_mean;
+ double write_interval;
+ double write_confidence;
+ double cpu_util_measured_mean;
+ double cpu_util_interval;
+ double cpu_util_confidence;
+ double service_demand_measured_mean;
+ double service_demand_interval;
+ double service_demand_confidence;
+ double confidence;
+ double sd_denominator;
+ double results_start; /* must be the last field in structure */
+} disk_results_t;
+
+/* Error codes to be used within disktest */
+enum {
+ DISK_MAX_ERROR = -32,
+ DISK_XMLSETPROP_ERROR,
+ DISK_XMLNEWNODE_ERROR,
+ DISK_IO_SIZE_TO_LARGE,
+ DISK_TEST_SIZE_TO_LARGE,
+ DISK_START_POS_TO_LARGE,
+ DISK_END_POS_TO_LARGE,
+ DISK_TEST_STAT_FAILED,
+ DISK_TEST_OPEN_FAILED,
+ DISK_TEST_RDWR_OPEN_FAILED,
+ DISK_TEST_DESCRIBE_FAILED,
+ DISK_TEST_DIOC_CAPACITY_FAILED,
+ DISK_TEST_SIOC_INQUIRY_FAILED,
+ DISK_TEST_SIOC_GET_IR_FAILED,
+ DISK_TEST_NOT_IO_DEVICE,
+ DISK_TEST_NOT_CHARACTER_FILE,
+ DISK_TEST_ERROR_WRITING_FILE,
+ DISK_TEST_CANT_WRITE_FILE,
+ DISK_TEST_ERROR_PARTIAL_READ,
+ DISK_TEST_ERROR_READING_FILE,
+ DISK_TEST_SEEK_ERROR,
+ DISK_TEST_EOF_ERROR,
+ DISK_NO_DISK_ARGS,
+ DISK_MALLOC_FAILED,
+ DISK_TEST_STATE_CORRUPTED,
+ DISK_REQUESTED_STATE_INVALID,
+ DISK_SUCCESS = 0
+};
Added: branches/glib_migration/suites/vst/Makefile.am
===================================================================
--- branches/glib_migration/suites/vst/Makefile.am 2006-04-19 00:11:52 UTC (rev 167)
+++ branches/glib_migration/suites/vst/Makefile.am 2006-04-19 00:23:57 UTC (rev 168)
@@ -0,0 +1,7 @@
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
+# in theory, the stuff below should deal with creating the requisite libs
+lib_LTLIBRARIES = nettest_vst.la
+
+nettest_vst_la_SOURCES = nettest_vst.c nettest_vst.h
+nettest_vst_la_LDFLAGS = -module
Added: branches/glib_migration/suites/vst/Makefile.in
===================================================================
--- branches/glib_migration/suites/vst/Makefile.in 2006-04-19 00:11:52 UTC (rev 167)
+++ branches/glib_migration/suites/vst/Makefile.in 2006-04-19 00:23:57 UTC (rev 168)
@@ -0,0 +1,449 @@
+# Makefile.in generated by automake 1.7.9 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ACLOCAL = @ACLOCAL@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+F77 = @F77@
+FFLAGS = @FFLAGS@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBOJBS = @LIBOJBS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+NETSYS_SOURCE = @NETSYS_SOURCE@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+WANT_DISK_FALSE = @WANT_DISK_FALSE@
+WANT_DISK_TRUE = @WANT_DISK_TRUE@
+WANT_DNS_FALSE = @WANT_DNS_FALSE@
+WANT_DNS_TRUE = @WANT_DNS_TRUE@
+WANT_VST_FALSE = @WANT_VST_FALSE@
+WANT_VST_TRUE = @WANT_VST_TRUE@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_F77 = @ac_ct_F77@
+ac_ct_RANLIB = @ac_ct_RANLIB@
+ac_ct_STRIP = @ac_ct_STRIP@
+ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
+am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+AM_CPPFLAGS = -I$(top_srcdir)/include
+
+# in theory, the stuff below should deal with creating the requisite libs
+lib_LTLIBRARIES = nettest_vst.la
+
+nettest_vst_la_SOURCES = nettest_vst.c nettest_vst.h
+nettest_vst_la_LDFLAGS = -module
+subdir = suites/vst
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(lib_LTLIBRARIES)
+
+nettest_vst_la_LIBADD =
+am_nettest_vst_la_OBJECTS = nettest_vst.lo
+nettest_vst_la_OBJECTS = $(am_nettest_vst_la_OBJECTS)
+
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+ at AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/nettest_vst.Plo
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
+ $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(nettest_vst_la_SOURCES)
+DIST_COMMON = $(srcdir)/Makefile.in Makefile.am
+SOURCES = $(nettest_vst_la_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu suites/vst/Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+libLTLIBRARIES_INSTALL = $(INSTALL)
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
+ $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" = "$$p" && dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+nettest_vst.la: $(nettest_vst_la_OBJECTS) $(nettest_vst_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(nettest_vst_la_LDFLAGS) $(nettest_vst_la_OBJECTS) $(nettest_vst_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nettest_vst.Plo at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ at am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+ at am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ at am__fastdepCC_TRUE@ fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ at am__fastdepCC_TRUE@ -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+ at am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ at am__fastdepCC_TRUE@ fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'; fi`
+
+.c.lo:
+ at am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ at am__fastdepCC_TRUE@ -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+ at am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; \
+ at am__fastdepCC_TRUE@ else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ at am__fastdepCC_TRUE@ fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+
+installdirs:
+ $(mkinstalldirs) $(DESTDIR)$(libdir)
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-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
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-libLTLIBRARIES
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-libLTLIBRARIES
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libLTLIBRARIES clean-libtool ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am \
+ install-libLTLIBRARIES install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-info-am \
+ uninstall-libLTLIBRARIES
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
Added: branches/glib_migration/suites/vst/nettest_vst.c
===================================================================
--- branches/glib_migration/suites/vst/nettest_vst.c 2006-04-19 00:11:52 UTC (rev 167)
+++ branches/glib_migration/suites/vst/nettest_vst.c 2006-04-19 00:23:57 UTC (rev 168)
@@ -0,0 +1,3039 @@
+/* Copyright (C) 2005 Hewlett-Packard Company */
+
+ /* This file contains the test-specific definitions for netperf4's */
+ /* Hewlett-Packard Company special variable sized data tests */
+
+#ifndef lint
+char nettest_id[]="\
+@(#)nettest_vst.c (c) Copyright 2005 Hewlett-Packard Co. $Id: nettest_vst.c 161 2006-04-18 00:00:49Z raj $";
+#else
+#define DIRTY
+#define WANT_HISTOGRAM
+#define INTERVALS
+#endif /* lint */
+
+#ifdef DIRTY
+#define MAKE_DIRTY(mydata,ring) /* DIRTY is not currently supported */
+#else
+#define MAKE_DIRTY(mydata,ring) /* DIRTY is not currently supported */
+#endif
+
+
+
+/****************************************************************/
+/* */
+/* nettest_vst.c */
+/* */
+/* scan_vst_args() */
+/* */
+/* the actual test routines... */
+/* */
+/* send_vst_rr() perform a tcp req/rsp test */
+/* with variable sized req/rsp */
+/* recv_vst_rr() catch a tcp req/rsp test */
+/* with variable sized req/rsp */
+/* */
+/****************************************************************/
+
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+
+#ifdef HAVE_VALUES_H
+#include <values.h>
+#endif
+
+#ifdef HAVE_FLOAT_H
+#include <float.h>
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#ifdef TIME_WITH_SYS_TIM
+#include <time.h>
+#endif
+#endif
+
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#endif
+
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+
+#include "netperf.h"
+
+#include "nettest_vst.h"
+
+
+static void
+report_test_failure(test, function, err_code, err_string)
+ test_t *test;
+ char *function;
+ int err_code;
+ char *err_string;
+{
+ int loc_debug = 1;
+
+ if (test->debug || loc_debug) {
+ fprintf(test->where,"%s: called report_test_failure:",function);
+ fprintf(test->where,"reporting %s errno = %d\n",err_string,GET_ERRNO);
+ fflush(test->where);
+ }
+ test->err_rc = err_code;
+ test->err_fn = function;
+ test->err_str = err_string;
+ test->new_state = TEST_ERROR;
+ test->err_no = GET_ERRNO;
+}
+
+static void
+set_test_state(test_t *test, uint32_t new_state)
+{
+ int curr_state;
+ int state;
+ int valid = 0;
+ char *state_name;
+ char error_msg[1024];
+
+ curr_state = GET_TEST_STATE;
+
+ if (curr_state != TEST_ERROR) {
+ if (curr_state != new_state) {
+ switch (curr_state) {
+ case TEST_PREINIT:
+ state = TEST_INIT;
+ valid = 1;
+ break;
+ case TEST_INIT:
+ state_name = "TEST_INIT";
+ if (new_state == TEST_IDLE) {
+ state = TEST_IDLE;
+ valid = 1;
+ }
+ break;
+ case TEST_IDLE:
+ state_name = "TEST_IDLE";
+ if (new_state == TEST_LOADED) {
+ state = TEST_LOADED;
+ valid = 1;
+ }
+ if (new_state == TEST_DEAD) {
+ state = TEST_DEAD;
+ valid = 1;
+ }
+ break;
+ case TEST_LOADED:
+ state_name = "TEST_LOADED";
+ if (new_state == TEST_MEASURE) {
+ state = TEST_MEASURE;
+ valid = 1;
+ }
+ if (new_state == TEST_IDLE) {
+ state = TEST_IDLE;
+ valid = 1;
+ }
+ break;
+ case TEST_MEASURE:
+ state_name = "TEST_MEASURE";
+ if (new_state == TEST_LOADED) {
+ state = TEST_LOADED;
+ valid = 1;
+ }
+ break;
+ case TEST_ERROR:
+ /* an error occured while processing in the current state
+ return and we should drop into wait_to_die so that
+ netperf4 can retrieve the error information before killing
+ the test */
+ state_name = "TEST_ERROR";
+ break;
+ default:
+ state_name = "ILLEGAL";
+ }
+ if (valid) {
+ test->new_state = state;
+ }
+ else {
+ sprintf(error_msg,"bad state transition from %s state",state_name);
+ report_test_failure( test,
+ (char *)__func__,
+ VSTE_REQUESTED_STATE_INVALID,
+ strdup(error_msg));
+ }
+ }
+ }
+}
+
+void
+wait_to_die(test_t *test, void(*free_routine)(test_t *))
+{
+ while (GET_TEST_STATE != TEST_DEAD) {
+ if (CHECK_REQ_STATE == TEST_DEAD) {
+ free_routine(test);
+ free(GET_TEST_DATA(test));
+ SET_TEST_DATA(test, NULL);
+ test->new_state = TEST_DEAD;
+ }
+ }
+}
+
+#ifdef OFF
+/* the following lines are a template for any test
+ just copy the lines for generic_test change
+ the procedure name and write you own TEST_SPECIFC_XXX
+ functions. Have Fun sgb 2005-10-26 */
+
+void
+generic_test(test_t *test)
+{
+ uint32_t state, new_state;
+ TEST_SPECIFIC_INITIALIZE(test);
+ state = GET_TEST_STATE;
+ while ((state != TEST_ERROR) &&
+ (state != TEST_DEAD )) {
+ switch(state) {
+ case TEST_PREINIT:
+ TEST_SPECIFIC_PREINIT(test);
+ new_state = TEST_INIT;
+ break;
+ case TEST_INIT:
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_IDLE) {
+ new_state = TEST_SPECIFIC_INIT(test);
+ }
+ break;
+ case TEST_IDLE:
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_IDLE) {
+ sleep(1);
+ }
+ break;
+ case TEST_MEASURE:
+ new_state = TEST_SPECIFIC_MEASURE(test);
+ break;
+ case TEST_LOADED:
+ new_state = TEST_SPECIFIC_LOAD(test);
+ break;
+ default:
+ break;
+ } /* end of switch */
+ set_test_state(test, new_state);
+ state = GET_TEST_STATE;
+ } /* end of while */
+ wait_to_die(test,TEST_SPECIFIC_FREE);
+}
+
+#endif /* OFF end of generic_test example code sgb 2005-10-26 */
+
+
+static void
+dump_addrinfo(FILE *dumploc, struct addrinfo *info,
+ xmlChar *host, xmlChar *port, int family)
+{
+ struct sockaddr *ai_addr;
+ struct addrinfo *temp;
+ temp=info;
+
+ fprintf(dumploc, "getaddrinfo returned the following for host '%s' ", host);
+ fprintf(dumploc, "port '%s' ", port);
+ fprintf(dumploc, "family %d\n", family);
+ while (temp) {
+ fprintf(dumploc,
+ "\tcannonical name: '%s'\n",temp->ai_canonname);
+ fprintf(dumploc,
+ "\tflags: %d family: %d: socktype: %d protocol %d addrlen %d\n",
+ temp->ai_flags,
+ temp->ai_family,
+ temp->ai_socktype,
+ temp->ai_protocol,
+ temp->ai_addrlen);
+ ai_addr = temp->ai_addr;
+ if (ai_addr != NULL) {
+ fprintf(dumploc,
+ "\tsa_family: %d sadata: %d %d %d %d %d %d\n",
+ ai_addr->sa_family,
+ (u_char)ai_addr->sa_data[0],
+ (u_char)ai_addr->sa_data[1],
+ (u_char)ai_addr->sa_data[2],
+ (u_char)ai_addr->sa_data[3],
+ (u_char)ai_addr->sa_data[4],
+ (u_char)ai_addr->sa_data[5]);
+ }
+ temp = temp->ai_next;
+ }
+ fflush(dumploc);
+}
+
+
+static int
+strtofam(xmlChar *familystr)
+{
+ if (!xmlStrcmp(familystr,(const xmlChar *)"AF_INET")) {
+ return(AF_INET);
+ } else if (!xmlStrcmp(familystr,(const xmlChar *)"AF_UNSPEC")) {
+ return(AF_UNSPEC);
+#ifdef AF_INET6
+ } else if (!xmlStrcmp(familystr,(const xmlChar *)"AF_INET6")) {
+ return(AF_INET6);
+#endif /* AF_INET6 */
+ }
+ else {
+ /* we should never get here if the validator is doing its thing */
+ return(-1);
+ }
+}
+
+static void
+get_dependency_data(test_t *test, int type, int protocol)
+{
+ vst_data_t *my_data = GET_TEST_DATA(test);
+
+ xmlChar *string;
+ xmlChar *remotehost;
+ xmlChar *remoteport;
+ int remotefam;
+
+ int count;
+ int error;
+
+ struct addrinfo hints;
+ struct addrinfo *remote_ai;
+
+ /* still need to finish */
+ /* now get and initialize the remote addressing info */
+ string = xmlGetProp(test->dependency_data,(const xmlChar *)"family");
+ remotefam = strtofam(string);
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = remotefam;
+ hints.ai_socktype = type;
+ hints.ai_protocol = protocol;
+ hints.ai_flags = 0;
+
+ remoteport = xmlGetProp(test->dependency_data,(const xmlChar *)"remote_port");
+ remotehost = xmlGetProp(test->dependency_data,(const xmlChar *)"remote_host");
+ count = 0;
+ error = EAI_AGAIN;
+ do {
+ error = getaddrinfo( (char *)remotehost, (char *)remoteport,
+ &hints, &remote_ai);
+ count += 1;
+ if (error == EAI_AGAIN) {
+ if (test->debug) {
+ fprintf(test->where,"Sleeping on getaddrinfo EAI_AGAIN\n");
+ fflush(test->where);
+ }
+ sleep(1);
+ }
+ } while ((error == EAI_AGAIN) && (count <= 5));
+
+ if (test->debug) {
+ dump_addrinfo(test->where, remote_ai, remotehost, remoteport, remotefam);
+ }
+
+ if (!error) {
+ my_data->remaddr = remote_ai;
+ }
+ else {
+ if (test->debug) {
+ fprintf(test->where,"%s: getaddrinfo returned %d %s\n",
+ __func__, error, gai_strerror(error));
+ fflush(test->where);
+ }
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_GETADDRINFO_ERROR,
+ gai_strerror(error));
+ }
+}
+
+
+static void
+set_dependent_data(test)
+ test_t *test;
+{
+
+ vst_data_t *my_data = GET_TEST_DATA(test);
+ xmlChar *family;
+ char port[8];
+ char host[32];
+
+ xmlNodePtr dep_data;
+
+ switch (my_data->locaddr->ai_addr->sa_family) {
+#ifdef AF_INET6
+ case AF_INET6:
+ family = (xmlChar *)"AF_INET6";
+ break;
+#endif
+ case AF_INET:
+ family = (xmlChar *)"AF_INET";
+ break;
+ default:
+ family = (xmlChar *)"AF_UNSPEC";
+ break;
+ }
+
+ getnameinfo(my_data->locaddr->ai_addr, my_data->locaddr->ai_addrlen,
+ host, sizeof(host), port, sizeof(port),
+ NI_NUMERICHOST | NI_NUMERICSERV);
+
+ if ((dep_data = xmlNewNode(NULL,(xmlChar *)"dependency_data")) != NULL) {
+ /* set the properties of the dependency data sbg 2004-06-08 */
+ if ((xmlSetProp(dep_data,(const xmlChar *)"family",family) != NULL) &&
+ (xmlSetProp(dep_data,(const xmlChar *)"remote_port",
+ (xmlChar *)port) != NULL) &&
+ (xmlSetProp(dep_data,(const xmlChar *)"remote_host",
+ (xmlChar *)host) != NULL)) {
+ test->dependent_data = dep_data;
+ }
+ else {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_XMLSETPROP_ERROR,
+ "error setting properties for dependency data");
+ }
+ }
+ else {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_XMLNEWNODE_ERROR,
+ "error getting new node for dependency data");
+ }
+}
+
+
+unsigned int
+convert(string,units)
+ unsigned char *string;
+ unsigned char *units;
+{
+ unsigned int base;
+ base = atoi((char *)string);
+ if (strstr((char *)units,"B")) {
+ base *= 1;
+ }
+ if (strstr((char *)units,"KB")) {
+ base *= 1024;
+ }
+ if (strstr((char *)units,"MB")) {
+ base *= (1024 * 1024);
+ }
+ if (strstr((char *)units,"GB")) {
+ base *= (1024 * 1024 * 1024);
+ }
+ if (strstr((char *)units,"kB")) {
+ base *= (1000);
+ }
+ if (strstr((char *)units,"mB")) {
+ base *= (1000 * 1000);
+ }
+ if (strstr((char *)units,"gB")) {
+ base *= (1000 * 1000 * 1000);
+ }
+ return(base);
+}
+
+
+ /* this routine will allocates a circular list of fixed buffers for */
+ /* send and receive operations. each of these buffers will be offset */
+ /* as per the users request and then align will be adjusted to be a */
+ /* sizeof(int) or a multiple of size of int before buffer alignment. */
+ /* the circumference of this ring will be controlled by the setting */
+ /* of send_width. the buffers will be filled with data from the file */
+ /* specified in fill_file. if fill_file is an empty string, then */
+ /* buffers will not be filled with any particular data. */
+
+static void
+allocate_fixed_buffers(test_t *test)
+{
+ vst_data_t *my_data;
+ vst_ring_ptr temp_link;
+ vst_ring_ptr prev_link;
+ int width;
+ int send_malloc_size;
+ int send_size;
+ int send_align;
+ int send_offset;
+ int recv_malloc_size;
+ int recv_size;
+ int recv_align;
+ int recv_offset;
+ int *send_buf;
+ int i;
+ int send = 0;
+
+ my_data = GET_TEST_DATA(test);
+
+ if (!xmlStrcmp(test->test_name,(const xmlChar *)"send_vst_rr")) {
+ send = 1;
+ }
+
+ if (send) {
+ width = my_data->send_width;
+ send_size = my_data->req_size;
+ send_align = my_data->send_align;
+ send_offset = my_data->send_offset;
+ recv_size = my_data->rsp_size;
+ recv_align = my_data->recv_align;
+ recv_offset = my_data->recv_offset;
+ if (send_size < (sizeof(int)*4)) {
+ send_size = sizeof(int) * 4;
+ }
+ }
+ else {
+ width = my_data->recv_width;
+ send_size = my_data->rsp_size;
+ send_align = my_data->send_align;
+ send_offset = my_data->send_offset;
+ recv_size = my_data->req_size;
+ recv_align = my_data->recv_align;
+ recv_offset = my_data->recv_offset;
+ if (recv_size < (sizeof(int)*4)) {
+ recv_size = sizeof(int) * 4;
+ }
+ }
+
+ if (send_align < sizeof(int)) {
+ send_align = sizeof(int);
+ }
+ else {
+ send_align = (send_align + sizeof(int) - 1) & ~(sizeof(int) - 1);
+ }
+
+ if (recv_align < sizeof(int)) {
+ recv_align = sizeof(int);
+ }
+ else {
+ recv_align = (recv_align + sizeof(int) - 1) & ~(sizeof(int) - 1);
+ }
+
+ send_malloc_size = send_size + send_align + send_offset;
+ recv_malloc_size = recv_size + recv_align + recv_offset;
+
+ prev_link = NULL;
+ for (i = 0; i < width; i++) {
+ temp_link = (vst_ring_ptr)malloc(sizeof(vst_ring_elt_t));
+
+ temp_link->send_buff_base = (char *)malloc(send_malloc_size);
+ if (temp_link->send_buff_base == NULL) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_MALLOC_FAILED,
+ "error allocating vst send buffer");
+ }
+ temp_link->send_buff_ptr = temp_link->send_buff_base + send_offset;
+ temp_link->send_buff_ptr = (char *)(
+ ( (long)(temp_link->send_buff_ptr)
+ + (long)send_align - 1)
+ & ~((long)send_align - 1));
+ temp_link->send_buff_size = send_malloc_size;
+ temp_link->send_size = send_size;
+
+ temp_link->recv_buff_base = (char *)malloc(recv_malloc_size);
+ if (temp_link->send_buff_base == NULL) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_MALLOC_FAILED,
+ "error allocating vst recv buffer");
+ }
+ temp_link->recv_buff_ptr = temp_link->recv_buff_base + recv_offset;
+ temp_link->recv_buff_ptr = (char *)(
+ ( (long)(temp_link->recv_buff_ptr)
+ + (long)recv_align - 1)
+ & ~((long)recv_align - 1));
+ temp_link->recv_buff_size = recv_malloc_size;
+ temp_link->recv_size = recv_size;
+
+ if (send) {
+ memset(temp_link->send_buff_base, -1, send_malloc_size);
+ send_buf = (int *)temp_link->send_buff_ptr;
+ send_buf[0] = send_size;
+ send_buf[1] = recv_size;
+ }
+
+ temp_link->distribution = NULL;
+
+ if (i==0) {
+ my_data->vst_ring = temp_link;
+ }
+ temp_link->next = prev_link;
+ prev_link = temp_link;
+ }
+ my_data->vst_ring->next = temp_link;
+}
+
+
+static void
+allocate_pattern_buffer(test_t *test)
+{
+ vst_data_t *my_data;
+ xmlNodePtr wld;
+ xmlNodePtr pattern;
+ xmlNodePtr entry;
+ vst_ring_ptr pattern_start[MAX_PATTERNS];
+ dist_t *dist[MAX_PATTERNS];
+ vst_ring_ptr temp_link;
+ vst_ring_ptr prev_link;
+ char *string;
+ int malloc_size;
+ int send_size;
+ int send_align;
+ int send_offset;
+ int recv_size;
+ int recv_align;
+ int recv_offset;
+ int seed;
+ int i;
+ int p;
+ int np;
+ int num;
+ int *send_buf;
+
+
+ my_data = GET_TEST_DATA(test);
+ wld = my_data->wld;
+
+ seed = 0;
+ send_align = my_data->send_align;
+ send_offset = my_data->send_offset;
+ recv_align = my_data->recv_align;
+ recv_offset = my_data->recv_offset;
+
+ if (send_align < sizeof(int)) {
+ send_align = sizeof(int);
+ }
+ else {
+ send_align = (send_align + sizeof(int) - 1) & ~(sizeof(int) - 1);
+ }
+
+ if (recv_align < sizeof(int)) {
+ recv_align = sizeof(int);
+ }
+ else {
+ recv_align = (recv_align + sizeof(int) - 1) & ~(sizeof(int) - 1);
+ }
+
+ pattern = wld->xmlChildrenNode;
+
+ for (p=0;p < MAX_PATTERNS; p++) {
+ pattern_start[p] = NULL;
+ dist[p] = NULL;
+ }
+
+ prev_link = NULL;
+ while (pattern != NULL) {
+ if (!xmlStrcmp(pattern->name,(const xmlChar *)"pattern")) {
+ /* build entries for this pattern */
+ string = (char *)xmlGetProp(pattern,(const xmlChar *)"index");
+ p = atoi(string);
+ i = 0;
+ entry = pattern->xmlChildrenNode;
+ while (entry != NULL) {
+ if (!xmlStrcmp(entry->name,(const xmlChar *)"pattern_entry")) {
+ temp_link = (vst_ring_ptr)malloc(sizeof(vst_ring_elt_t));
+ string = (char *)xmlGetProp(entry,(const xmlChar *)"req_size");
+ send_size = atoi(string);
+ string = (char *)xmlGetProp(entry,(const xmlChar *)"rsp_size");
+ recv_size = atoi(string);
+
+ if (send_size < (sizeof(int)*4)) {
+ send_size = sizeof(int) * 4;
+ }
+ malloc_size = send_size + send_align + send_offset;
+
+ temp_link->send_buff_base = (char *)malloc(malloc_size);
+ if (temp_link->send_buff_base == NULL) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_MALLOC_FAILED,
+ "error allocating vst send buffer");
+ }
+ temp_link->send_buff_ptr = temp_link->send_buff_base + send_offset;
+ temp_link->send_buff_ptr = (char *)(
+ ( (long)(temp_link->send_buff_ptr)
+ + (long)send_align - 1)
+ & ~((long)send_align - 1));
+ temp_link->send_buff_size = malloc_size;
+ temp_link->send_size = send_size;
+
+ memset(temp_link->send_buff_base, -1, malloc_size);
+
+ malloc_size = recv_size + recv_align + recv_offset;
+
+ temp_link->recv_buff_base = (char *)malloc(malloc_size);
+ if (temp_link->send_buff_base == NULL) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_MALLOC_FAILED,
+ "error allocating vst recv buffer");
+ }
+ temp_link->recv_buff_ptr = temp_link->recv_buff_base + recv_offset;
+ temp_link->recv_buff_ptr = (char *)(
+ ( (long)(temp_link->recv_buff_ptr)
+ + (long)recv_align - 1)
+ & ~((long)recv_align - 1));
+ temp_link->recv_buff_size = malloc_size;
+ temp_link->recv_size = recv_size;
+
+ send_buf = (int *)temp_link->send_buff_ptr;
+
+ send_buf[0] = send_size;
+ send_buf[1] = recv_size;
+ send_buf[2] = send_size;
+ send_buf[3] = recv_size;
+
+ temp_link->distribution = NULL;
+
+ if (test->debug) {
+ fprintf(test->where,
+ "%s: pattern[%2d,%3d] send_size =%6d recv_size =%6d\n",
+ __func__, p, i, send_size, recv_size);
+ fflush(test->where);
+ }
+ if (i==0) {
+ pattern_start[p] = temp_link;
+ }
+ if (prev_link != NULL) {
+ prev_link->next = temp_link;
+ }
+ prev_link = temp_link;
+ i++;
+ }
+ entry = entry->next;
+ }
+ }
+ if (!xmlStrcmp(pattern->name,(const xmlChar *)"distribution")) {
+ /* build entry for the distribution after this pattern */
+ dist[p] = (dist_t *)malloc(sizeof(dist_t));
+ for (np=0; np<MAX_PATTERNS; np++) {
+ dist[p]->pattern[np] = NULL;
+ dist[p]->dist_count[np] = -1;
+ }
+ string = (char *)xmlGetProp(pattern,(const xmlChar *)"dist_key");
+ dist[p]->dist_key = atoi(string);
+ initstate(seed,dist[p]->random_state,VST_RAND_STATE_SIZE);
+ entry = pattern->xmlChildrenNode;
+ while (entry != NULL) {
+ if (!xmlStrcmp(entry->name,(const xmlChar *)"distribution_entry")) {
+ string = (char *)xmlGetProp(entry,(const xmlChar *)"next_pattern");
+ np = atoi(string);
+ string = (char *)xmlGetProp(entry,(const xmlChar *)"number");
+ num = atoi(string);
+ dist[p]->dist_count[np] = num;
+ if (test->debug) {
+ fprintf(test->where,
+ "%s: dist[%2d,%3d] dist_number =%6d\n",
+ __func__, p, np, num);
+ fflush(test->where);
+ }
+ }
+ entry = entry->next;
+ }
+ temp_link->distribution = dist[p];
+ }
+ pattern = pattern->next;
+ }
+ for (np=0; np < p; np++) {
+ dist[np]->num_patterns = p;
+ for (i=0; i < p; i++) {
+ dist[np]->pattern[i] = pattern_start[i];
+ }
+ }
+ temp_link->next = pattern_start[0];
+ my_data->vst_ring = pattern_start[0];
+}
+
+
+static void
+parse_wld_file(test_t *test, char *fname)
+{
+ xmlDocPtr doc;
+ xmlNodePtr root;
+ xmlNsPtr ns;
+ vst_data_t *my_data;
+ int send;
+
+ my_data = GET_TEST_DATA(test);
+
+ if (!xmlStrcmp(test->test_name,(const xmlChar *)"send_vst_rr")) {
+ send = 1;
+ }
+ else {
+ send = 0;
+ }
+
+ if (fname == NULL) {
+ if (send) {
+ fprintf(test->where,
+ "WARNING %s: called %s without a work load description file\n",
+ test->test_name, __func__);
+ fprintf(test->where,
+ "WARNING %s: test will be setup and run with fixed buffers\n",
+ test->test_name);
+ fflush(test->where);
+ }
+ }
+ else if ((doc = xmlParseFile(fname)) != NULL) {
+ if ((root = xmlDocGetRootElement(doc)) != NULL) {
+ /* now make sure that the netperf namespace is present */
+ ns = xmlSearchNsByHref(doc, root,
+ (const xmlChar *)"http://www.netperf.org/ns/netperf");
+ if (ns != NULL) {
+ if (!xmlStrcmp(root->name,(const xmlChar *)"work_load_description")) {
+ /* happy day valid document */
+ my_data->wld = root;
+ }
+ else {
+ /* not a correct document type*/
+ fprintf(test->where,
+ "file %s is of type \"%s\" not \"%s\"\n",
+ fname,root->name,"work_load_description");
+ fflush(test->where);
+ xmlFreeDoc(doc);
+ doc = NULL;
+ }
+ }
+ else {
+ /* no namespace match */
+ fprintf(test->where,
+ "file %s does not reference a netperf namespace\n",fname);
+ fflush(test->where);
+ xmlFreeDoc(doc);
+ doc = NULL;
+ }
+ }
+ else {
+ /* empty document */
+ fprintf(test->where,
+ "file %s contains no root element\n",fname);
+ xmlFreeDoc(doc);
+ fflush(test->where);
+ doc = NULL;
+ }
+ if (doc == NULL) {
+ fprintf(test->where,
+ "WARNING %s: fill file '%s' work load description invalid\n",
+ test->test_name, fname);
+ fprintf(test->where,
+ "WARNING %s: test will be setup and run with fixed buffers\n",
+ test->test_name);
+ fflush(test->where);
+ }
+ }
+}
+
+
+ /* This routine reads and parses the work_load_description and sets up
+ the buffer ring with two sets of buffers one for send and one for
+ receive. */
+static void
+allocate_vst_buffers(test_t *test, char *fname)
+{
+ xmlNodePtr wld;
+ vst_data_t *my_data;
+
+ my_data = GET_TEST_DATA(test);
+
+ parse_wld_file(test, fname);
+
+ wld = my_data->wld;
+ if (wld == NULL) {
+ allocate_fixed_buffers(test);
+ }
+ else {
+ allocate_pattern_buffer(test);
+ }
+}
+
+
+static void
+get_next_vst_transaction(test_t *test)
+{
+ vst_data_t *my_data;
+ dist_t *dist;
+ long key;
+ int value;
+ int i;
+ int loc_debug = 0;
+
+ my_data = GET_TEST_DATA(test);
+ dist = my_data->vst_ring->distribution;
+
+ if (dist == NULL) {
+ my_data->vst_ring = my_data->vst_ring->next;
+ }
+ else {
+ /* we have reached the end of a pattern it is time to determine which
+ pattern should be next in the sequence sgb 2005/11/21 */
+ setstate(dist->random_state);
+ key = random();
+ value = key % dist->dist_key;
+ if (test->debug && loc_debug) {
+ fprintf(test->where, "**** end of pattern reached ******\n");
+ fprintf(test->where,
+ "%s: value = %d key = %ld\n",
+ (char *)__func__, value, key);
+ fflush(test->where);
+ }
+ for (i=0; i< dist->num_patterns; i++) {
+ value = value - dist->dist_count[i];
+ if (test->debug && loc_debug) {
+ fprintf(test->where,
+ "\tdist_count = %d new_value = %d pattern = %ld\n",
+ dist->dist_count[i], value, dist->pattern[i]);
+ fflush(test->where);
+ }
+ if (value < 0) {
+ my_data->vst_ring = dist->pattern[i];
+ break;
+ }
+ }
+ if (test->debug && loc_debug) {
+ fprintf(test->where,
+ "%s: new ring value %p\n",
+ __func__, my_data->vst_ring);
+ fflush(test->where);
+ }
+ }
+}
+
+
+ /* This routine will create a data (listen) socket with the apropriate */
+ /* options set and return it to the caller. this replaces all the */
+ /* duplicate code in each of the test routines and should help make */
+ /* things a little easier to understand. since this routine can be */
+ /* called by either the netperf or netserver programs, all output */
+ /* should be directed towards "where." family is generally AF_INET, */
+ /* and type will be either SOCK_STREAM or SOCK_DGRAM */
+static int
+create_data_socket(test_t *test)
+{
+ vst_data_t *my_data = GET_TEST_DATA(test);
+
+ int family = my_data->locaddr->ai_family;
+ int type = my_data->locaddr->ai_socktype;
+ int lss_size = my_data->send_buf_size;
+ int lsr_size = my_data->recv_buf_size;
+ int loc_sndavoid = my_data->send_avoid;
+ int loc_rcvavoid = my_data->recv_avoid;
+
+ int temp_socket;
+ int one;
+ netperf_socklen_t sock_opt_len;
+
+ if (test->debug) {
+ fprintf(test->where,
+ "%s: calling socket family = %d type = %d\n",
+ __func__, family, type);
+ fflush(test->where);
+ }
+ /*set up the data socket */
+ temp_socket = socket(family,
+ type,
+ 0);
+
+ if (CHECK_FOR_INVALID_SOCKET) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_SOCKET_ERROR,
+ "error creating socket");
+ return(temp_socket);
+ }
+
+ if (test->debug) {
+ fprintf(test->where,
+ "%s: socket %d obtained...\n",
+ __func__, temp_socket);
+ fflush(test->where);
+ }
+
+ /* Modify the local socket size. The reason we alter the send buffer */
+ /* size here rather than when the connection is made is to take care */
+ /* of decreases in buffer size. Decreasing the window size after */
+ /* connection establishment is a TCP no-no. Also, by setting the */
+ /* buffer (window) size before the connection is established, we can */
+ /* control the TCP MSS (segment size). The MSS is never more that 1/2 */
+ /* the minimum receive buffer size at each half of the connection. */
+ /* This is why we are altering the receive buffer size on the sending */
+ /* size of a unidirectional transfer. If the user has not requested */
+ /* that the socket buffers be altered, we will try to find-out what */
+ /* their values are. If we cannot touch the socket buffer in any way, */
+ /* we will set the values to -1 to indicate that. */
+
+#ifdef SO_SNDBUF
+ if (lss_size > 0) {
+ if(setsockopt(temp_socket, SOL_SOCKET, SO_SNDBUF,
+ &lss_size, sizeof(int)) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_SETSOCKOPT_ERROR,
+ "error setting local send socket buffer size");
+ return(temp_socket);
+ }
+ if (test->debug > 1) {
+ fprintf(test->where,
+ "%s: %s: SO_SNDBUF of %d requested.\n",
+ __FILE__, __func__, lss_size);
+ fflush(test->where);
+ }
+ }
+
+ if (lsr_size > 0) {
+ if(setsockopt(temp_socket, SOL_SOCKET, SO_RCVBUF,
+ &lsr_size, sizeof(int)) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_SETSOCKOPT_ERROR,
+ "error setting local recv socket buffer size");
+ return(temp_socket);
+ }
+ if (test->debug > 1) {
+ fprintf(test->where,
+ "%s: %s: SO_RCVBUF of %d requested.\n",
+ __FILE__, __func__, lsr_size);
+ fflush(test->where);
+ }
+ }
+
+ /* Now, we will find-out what the size actually became, and report */
+ /* that back to the test. If the call fails, we will just report a -1 */
+ /* back to the initiator for the recv buffer size. */
+
+ sock_opt_len = sizeof(int);
+ if (getsockopt(temp_socket,
+ SOL_SOCKET,
+ SO_SNDBUF,
+ (char *)&lss_size,
+ &sock_opt_len) < 0) {
+ fprintf(test->where,
+ "%s: %s: getsockopt SO_SNDBUF: errno %d\n",
+ __FILE__, __func__, errno);
+ fflush(test->where);
+ lss_size = -1;
+ }
+ if (getsockopt(temp_socket,
+ SOL_SOCKET,
+ SO_RCVBUF,
+ (char *)&lsr_size,
+ &sock_opt_len) < 0) {
+ fprintf(test->where,
+ "%s: %s: getsockopt SO_RCVBUF: errno %d\n",
+ __FILE__, __func__, errno);
+ fflush(test->where);
+ lsr_size = -1;
+ }
+ if (test->debug) {
+ fprintf(test->where,
+ "%s: %s: socket sizes determined...\n",
+ __FILE__, __func__);
+ fprintf(test->where,
+ " send: %d recv: %d\n",
+ lss_size,lsr_size);
+ fflush(test->where);
+ }
+
+#else /* SO_SNDBUF */
+
+ lss_size = -1;
+ lsr_size = -1;
+
+#endif /* SO_SNDBUF */
+
+ my_data->sbuf_size_ret = lss_size;
+ my_data->rbuf_size_ret = lsr_size;
+ /* now, we may wish to enable the copy avoidance features on the */
+ /* local system. of course, this may not be possible... */
+
+#ifdef SO_RCV_COPYAVOID
+ if (loc_rcvavoid) {
+ if (setsockopt(temp_socket,
+ SOL_SOCKET,
+ SO_RCV_COPYAVOID,
+ &loc_rcvavoid,
+ sizeof(int)) < 0) {
+ fprintf(test->where,
+ "%s: %s: Could not enable receive copy avoidance",
+ __FILE__, __func__);
+ fflush(test->where);
+ loc_rcvavoid = 0;
+ }
+ }
+#else
+ /* it wasn't compiled in... */
+ loc_rcvavoid = 0;
+#endif /* SO_RCV_COPYAVOID */
+
+#ifdef SO_SND_COPYAVOID
+ if (loc_sndavoid) {
+ if (setsockopt(temp_socket,
+ SOL_SOCKET,
+ SO_SND_COPYAVOID,
+ &loc_sndavoid,
+ sizeof(int)) < 0) {
+ fprintf(test->where,
+ "%s: %s: Could not enable send copy avoidance\n",
+ __FILE__, __func__);
+ fflush(test->where);
+ loc_sndavoid = 0;
+ }
+ }
+#else
+ /* it was not compiled in... */
+ loc_sndavoid = 0;
+#endif
+
+ /* Now, we will see about setting the TCP_NO_DELAY flag on the local */
+ /* socket. We will only do this for those systems that actually */
+ /* support the option. If it fails, note the fact, but keep going. */
+ /* If the user tries to enable TCP_NODELAY on a UDP socket, this */
+ /* will cause an error to be displayed */
+
+#ifdef TCP_NODELAY
+ if (my_data->no_delay) {
+ one = 1;
+ if(setsockopt(temp_socket,
+ getprotobyname("tcp")->p_proto,
+ TCP_NODELAY,
+ (char *)&one,
+ sizeof(one)) < 0) {
+ fprintf(test->where,
+ "%s: %s: nodelay: errno %d\n",
+ __FILE__, __func__, errno);
+ fflush(test->where);
+ }
+
+ if (test->debug > 1) {
+ fprintf(test->where,
+ "%s: %s: TCP_NODELAY requested...\n",
+ __FILE__, __func__);
+ fflush(test->where);
+ }
+ }
+#else /* TCP_NODELAY */
+
+ my_data->no_delay = 0;
+
+#endif /* TCP_NODELAY */
+
+ return(temp_socket);
+
+}
+
+
+/* free all the data structures allocated by the tests other than
+ the vst_data_t allocated by vst_test_init that will be done by
+ wait_to_die. sgb 2005/11/21 */
+
+static void
+free_vst_test_data(test_t *test)
+{
+ vst_data_t *my_data;
+ vst_ring_ptr prev;
+ vst_ring_ptr curr;
+
+ my_data = GET_TEST_DATA(test);
+
+ xmlFreeNode(my_data->wld);
+ prev = my_data->vst_ring;
+ curr = prev->next;
+ prev->next = NULL;
+ while (curr) {
+ /* free memory allocate for vst ring */
+ free(curr->send_buff_base);
+ free(curr->recv_buff_base);
+ free(curr->distribution);
+ prev = curr;
+ curr = curr->next;
+ free(prev);
+ }
+ free(my_data->locaddr);
+ free(my_data->remaddr);
+ fclose(my_data->fill_source);
+ my_data->vst_ring = NULL;
+ my_data->locaddr = NULL;
+ my_data->remaddr = NULL;
+ my_data->fill_source = NULL;
+}
+
+
+/* Initialize the data structures for the variable sized data tests.
+ The tests default to the same behavior as a tcp_rr test unless
+ the file_file is specified and contains a valid xml document
+ which specifies a valid work_load_description.
+ 2005-11-18 sgb */
+
+static vst_data_t *
+vst_test_init(test_t *test, int type, int protocol)
+{
+ vst_data_t *new_data;
+ xmlNodePtr args;
+ xmlChar *string;
+ char *fname;
+ xmlChar *units;
+ xmlChar *localhost;
+ xmlChar *localport;
+ int localfam;
+
+ int count;
+ int error;
+ struct addrinfo hints;
+ struct addrinfo *local_ai;
+
+ NETPERF_DEBUG_ENTRY(test->debug, test->where);
+
+ /* allocate memory to store the information about this test */
+ new_data = (vst_data_t *)malloc(sizeof(vst_data_t));
+
+ args = test->node->xmlChildrenNode;
+ while (args != NULL) {
+ if (!xmlStrcmp(args->name,(const xmlChar *)"dependency_data")) {
+ test->dependency_data = args;
+ }
+ if (xmlStrcmp(args->name,(const xmlChar *)"socket_args")) {
+ args = args->next;
+ continue;
+ }
+ break;
+ }
+
+ /* probably a good idea to make sure that new_data is real */
+ if ((args != NULL) &&
+ (NULL != new_data)) {
+ /* zero the vst test specific data structure */
+ memset(new_data,0,sizeof(vst_data_t));
+
+ fname = (char *)xmlGetProp(args,(const xmlChar *)"fill_file");
+ /* fopen the fill file it will be used when allocating buffer rings */
+ if (fname) {
+ new_data->fill_source = fopen(fname,"r");
+ }
+
+ /* we are relying on the good graces of the validating and
+ attribute filling of libxml when we parsed the message that got
+ us here... */
+ string = xmlGetProp(args,(const xmlChar *)"send_buffer_size");
+ units = xmlGetProp(args,(const xmlChar *)"send_buffer_units");
+ new_data->send_buf_size = convert(string,units);
+
+ string = xmlGetProp(args,(const xmlChar *)"send_size");
+ units = xmlGetProp(args,(const xmlChar *)"send_size_units");
+ new_data->send_size = convert(string,units);
+
+ string = xmlGetProp(args,(const xmlChar *)"recv_buffer_size");
+ units = xmlGetProp(args,(const xmlChar *)"recv_buffer_units");
+ new_data->recv_buf_size = convert(string,units);
+
+ string = xmlGetProp(args,(const xmlChar *)"recv_size");
+ units = xmlGetProp(args,(const xmlChar *)"recv_size_units");
+ new_data->recv_size = convert(string,units);
+
+ string = xmlGetProp(args,(const xmlChar *)"req_size");
+ new_data->req_size = atoi((char *)string);
+
+ string = xmlGetProp(args,(const xmlChar *)"rsp_size");
+ new_data->rsp_size = atoi((char *)string);
+
+ /* relying on the DTD to give us defaults isn't always the most
+ robust way to go about doing things. */
+ string = xmlGetProp(args,(const xmlChar *)"port_min");
+ if (string) {
+ new_data->port_min = atoi((char *)string);
+ }
+ else {
+ new_data->port_min = -1;
+ }
+
+ string = xmlGetProp(args,(const xmlChar *)"port_max");
+ if (string) {
+ new_data->port_max = atoi((char *)string);
+ }
+ else {
+ new_data->port_min = -1;
+ }
+
+ string = xmlGetProp(args,(const xmlChar *)"send_width");
+ new_data->send_width = atoi((char *)string);
+ if (new_data->send_width == 0) {
+ new_data->send_width = new_data->send_buf_size/new_data->send_size + 1;
+ if (new_data->send_width == 1) new_data->send_width = 2;
+ }
+
+ string = xmlGetProp(args,(const xmlChar *)"recv_width");
+ new_data->recv_width = atoi((char *)string);
+ if (new_data->recv_width == 0) {
+ new_data->recv_width = new_data->recv_buf_size/new_data->recv_size + 1;
+ if (new_data->recv_width == 1) new_data->recv_width = 2;
+ }
+
+ string = xmlGetProp(args,(const xmlChar *)"send_align");
+ new_data->send_align = atoi((char *)string);
+
+ string = xmlGetProp(args,(const xmlChar *)"recv_align");
+ new_data->recv_align = atoi((char *)string);
+
+ string = xmlGetProp(args,(const xmlChar *)"send_offset");
+ new_data->send_offset = atoi((char *)string);
+
+ string = xmlGetProp(args,(const xmlChar *)"recv_offset");
+ new_data->recv_offset = atoi((char *)string);
+
+ /* now get and initialize the local addressing info */
+ string = xmlGetProp(args,(const xmlChar *)"family");
+ localfam = strtofam(string);
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = localfam;
+ hints.ai_socktype = type;
+ hints.ai_protocol = protocol;
+ hints.ai_flags = 0;
+
+ localhost = xmlGetProp(args,(const xmlChar *)"local_host"),
+ localport = xmlGetProp(args,(const xmlChar *)"local_service"),
+ count = 0;
+ do {
+ error = getaddrinfo( (char *)localhost, (char *)localport,
+ &hints, &local_ai);
+ count += 1;
+ if (error == EAI_AGAIN) {
+ if (test->debug) {
+ fprintf(test->where,"Sleeping on getaddrinfo EAI_AGAIN\n");
+ fflush(test->where);
+ }
+ sleep(1);
+ }
+ } while ((error == EAI_AGAIN) && (count <= 5));
+
+ if (test->debug) {
+ dump_addrinfo(test->where, local_ai, localhost, localport, localfam);
+ }
+
+ if (!error) {
+ new_data->locaddr = local_ai;
+ }
+ else {
+ if (test->debug) {
+ fprintf(test->where,"%s: getaddrinfo returned %d %s\n",
+ __func__, error, gai_strerror(error));
+ fflush(test->where);
+ }
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_GETADDRINFO_ERROR,
+ gai_strerror(error));
+ }
+ }
+ else {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_NO_SOCKET_ARGS,
+ "no socket_arg element was found");
+ }
+
+ SET_TEST_DATA(test, new_data);
+
+ allocate_vst_buffers(test, fname);
+
+ NETPERF_DEBUG_EXIT(test->debug, test->where);
+
+ return(new_data);
+}
+
+static void
+update_elapsed_time(vst_data_t *my_data)
+{
+ my_data->elapsed_time.tv_usec += my_data->curr_time.tv_usec;
+ my_data->elapsed_time.tv_usec -= my_data->prev_time.tv_usec;
+
+ my_data->elapsed_time.tv_sec += my_data->curr_time.tv_sec;
+ my_data->elapsed_time.tv_sec -= my_data->prev_time.tv_sec;
+
+ if (my_data->curr_time.tv_usec < my_data->prev_time.tv_usec) {
+ my_data->elapsed_time.tv_usec += 1000000;
+ my_data->elapsed_time.tv_sec--;
+ }
+
+ if (my_data->elapsed_time.tv_usec >= 1000000) {
+ my_data->elapsed_time.tv_usec -= 1000000;
+ my_data->elapsed_time.tv_sec++;
+ }
+}
+
+static int
+vst_test_clear_stats(vst_data_t *my_data)
+{
+ int i;
+ for (i = 0; i < VST_MAX_COUNTERS; i++) {
+ my_data->stats.counter[i] = 0;
+ }
+ my_data->elapsed_time.tv_usec = 0;
+ my_data->elapsed_time.tv_sec = 0;
+ gettimeofday(&(my_data->prev_time),NULL);
+ my_data->curr_time = my_data->prev_time;
+ return(NPE_SUCCESS);
+}
+
+static void
+vst_test_decode_stats(xmlNodePtr stats,test_t *test)
+{
+ if (test->debug) {
+ fprintf(test->where,"%s: entered for %s test %s\n",
+ __func__, test->id, test->test_name);
+ fflush(test->where);
+ }
+}
+
+static xmlNodePtr
+vst_test_get_stats(test_t *test)
+{
+ xmlNodePtr stats = NULL;
+ xmlAttrPtr ap = NULL;
+ int i;
+ char value[32];
+ char name[32];
+ uint64_t loc_cnt[VST_MAX_COUNTERS];
+
+ vst_data_t *my_data = GET_TEST_DATA(test);
+
+ if (test->debug) {
+ fprintf(test->where,"%s: entered for %s test %s\n",
+ __func__, test->id, test->test_name);
+ fflush(test->where);
+ }
+ if ((stats = xmlNewNode(NULL,(xmlChar *)"test_stats")) != NULL) {
+ /* set the properites of the test_stats message -
+ the tid and time stamps/values and counter values sgb 2004-07-07 */
+
+ ap = xmlSetProp(stats,(xmlChar *)"tid",test->id);
+ for (i = 0; i < VST_MAX_COUNTERS; i++) {
+ loc_cnt[i] = my_data->stats.counter[i];
+ if (test->debug) {
+ fprintf(test->where,"VST_COUNTER%X = %#"PRIx64"\n",i,loc_cnt[i]);
+ }
+ }
+ if (GET_TEST_STATE == TEST_MEASURE) {
+ gettimeofday(&(my_data->curr_time), NULL);
+ if (ap != NULL) {
+ sprintf(value,"%ld",my_data->curr_time.tv_sec);
+ ap = xmlSetProp(stats,(xmlChar *)"time_sec",(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"time_sec=%s\n",value);
+ fflush(test->where);
+ }
+ }
+ if (ap != NULL) {
+ sprintf(value,"%ld",my_data->curr_time.tv_usec);
+ ap = xmlSetProp(stats,(xmlChar *)"time_usec",(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"time_usec=%s\n",value);
+ fflush(test->where);
+ }
+ }
+ }
+ else {
+ if (ap != NULL) {
+ sprintf(value,"%ld",my_data->elapsed_time.tv_sec);
+ ap = xmlSetProp(stats,(xmlChar *)"elapsed_sec",(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"elapsed_sec=%s\n",value);
+ fflush(test->where);
+ }
+ }
+ if (ap != NULL) {
+ sprintf(value,"%ld",my_data->elapsed_time.tv_usec);
+ ap = xmlSetProp(stats,(xmlChar *)"elapsed_usec",(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"elapsed_usec=%s\n",value);
+ fflush(test->where);
+ }
+ }
+ }
+ for (i = 0; i < VST_MAX_COUNTERS; i++) {
+ if (ap == NULL) {
+ break;
+ }
+ if (loc_cnt[i]) {
+ sprintf(value,"%#"PRIx64,my_data->stats.counter[i]);
+ sprintf(name,"cntr%1X_value",i);
+ ap = xmlSetProp(stats,(xmlChar *)name,(xmlChar *)value);
+ if (test->debug) {
+ fprintf(test->where,"%s=%s\n",name,value);
+ fflush(test->where);
+ }
+ }
+ }
+ if (ap == NULL) {
+ xmlFreeNode(stats);
+ stats = NULL;
+ }
+ }
+ if (test->debug) {
+ fprintf(test->where,"%s: exiting for %s test %s\n",
+ __func__, test->id, test->test_name);
+ fflush(test->where);
+ }
+ return(stats);
+} /* end of vst_test_get_stats */
+
+
+static void
+recv_vst_rr_preinit(test_t *test)
+{
+ int rc;
+ int s_listen;
+ vst_data_t *my_data;
+ struct sockaddr myaddr;
+ netperf_socklen_t mylen;
+
+ my_data = GET_TEST_DATA(test);
+ mylen = sizeof(myaddr);
+
+ s_listen = create_data_socket(test);
+ my_data->s_listen = s_listen;
+ if (test->debug) {
+ dump_addrinfo(test->where, my_data->locaddr,
+ (xmlChar *)NULL, (xmlChar *)NULL, -1);
+ fprintf(test->where,
+ "%s:create_data_socket returned %d\n",
+ __func__, s_listen);
+ fflush(test->where);
+ }
+ rc = bind(s_listen, my_data->locaddr->ai_addr, my_data->locaddr->ai_addrlen);
+ if (test->debug) {
+ fprintf(test->where,
+ "%s:bind returned %d errno=%d\n",
+ __func__, rc, errno);
+ fflush(test->where);
+ }
+ if (rc == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_BIND_FAILED,
+ "data socket bind failed");
+ } else if (listen(s_listen,5) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_LISTEN_FAILED,
+ "data socket listen failed");
+ } else if (getsockname(s_listen,&myaddr,&mylen) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_GETSOCKNAME_FAILED,
+ "getting the listen socket name failed");
+ }
+ else {
+ memcpy(my_data->locaddr->ai_addr,&myaddr,mylen);
+ my_data->locaddr->ai_addrlen = mylen;
+ set_dependent_data(test);
+ }
+}
+
+static uint32_t
+recv_vst_rr_init(test_t *test)
+{
+ int s_data;
+ vst_data_t *my_data;
+ struct sockaddr peeraddr;
+ netperf_socklen_t peerlen;
+
+ my_data = GET_TEST_DATA(test);
+ peerlen = sizeof(peeraddr);
+
+ if (test->debug) {
+ fprintf(test->where, "%s:waiting in accept\n", __func__);
+ fflush(test->where);
+ }
+ if ((s_data = accept(my_data->s_listen,
+ &peeraddr,
+ &peerlen)) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_ACCEPT_FAILED,
+ "listen socket accept failed");
+ }
+ else {
+ if (test->debug) {
+ fprintf(test->where,
+ "%s:accept returned successfully %d\n",
+ __func__, s_data);
+ fflush(test->where);
+ }
+ my_data->s_data = s_data;
+ }
+ return(TEST_IDLE);
+}
+
+static void
+recv_vst_rr_idle_link(test_t *test, int last_len)
+{
+ int len;
+ uint32_t new_state;
+ vst_data_t *my_data;
+ struct sockaddr peeraddr;
+ netperf_socklen_t peerlen;
+
+ NETPERF_DEBUG_ENTRY(test->debug, test->where);
+
+ my_data = GET_TEST_DATA(test);
+ len = last_len;
+ peerlen = sizeof(peeraddr);
+
+ new_state = CHECK_REQ_STATE;
+ while (new_state == TEST_LOADED) {
+ sleep(1);
+ new_state = CHECK_REQ_STATE;
+ }
+
+ if (new_state == TEST_IDLE) {
+ if (test->debug) {
+ fprintf(test->where,"%s: transition from LOAD to IDLE\n", __func__);
+ fflush(test->where);
+ }
+ if (shutdown(my_data->s_data,SHUT_WR) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_SOCKET_SHUTDOWN_FAILED,
+ "data_recv_error");
+ }
+ else {
+ while (len > 0) {
+ len=recv(my_data->s_data,
+ my_data->vst_ring->recv_buff_ptr,
+ my_data->vst_ring->recv_size, 0);
+ }
+ close(my_data->s_data);
+ if (test->debug) {
+ fprintf(test->where,"%s: waiting in accept\n", __func__);
+ fflush(test->where);
+ }
+ if ((my_data->s_data=accept(my_data->s_listen,
+ &peeraddr,
+ &peerlen)) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_ACCEPT_FAILED,
+ "listen socket accept failed");
+ }
+ else {
+ if (test->debug) {
+ fprintf(test->where,
+ "%s: accept returned successfully %d\n",
+ __func__,
+ my_data->s_data);
+ fflush(test->where);
+ }
+ }
+ }
+ }
+ else {
+ /* a transition to a state other than TEST_IDLE was requested
+ after the link was closed in the TEST_LOADED state */
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_CONNECTION_CLOSED_ERROR,
+ "data connection closed and non idle state requested");
+ }
+}
+
+static uint32_t
+recv_vst_rr_meas(test_t *test)
+{
+ int len;
+ int bytes_left;
+ int received;
+ int *req_base;
+ int rsp_size;
+ char *req_ptr;
+ uint32_t new_state;
+ vst_data_t *my_data;
+
+ HISTOGRAM_VARS;
+ my_data = GET_TEST_DATA(test);
+
+ while (NO_STATE_CHANGE(test)) {
+ /* code to timestamp enabled by WANT_HISTOGRAM */
+ HIST_TIMESTAMP(&time_one);
+ /* recv the request for the test */
+ req_base = (int *)my_data->vst_ring->recv_buff_ptr;
+ req_ptr = my_data->vst_ring->recv_buff_ptr;
+ bytes_left = my_data->vst_ring->recv_size;
+ received = 0;
+ while (bytes_left > 0) {
+ if ((len=recv(my_data->s_data,
+ req_ptr,
+ bytes_left,
+ 0)) != 0) {
+ /* this macro hides windows differences */
+ if (CHECK_FOR_RECV_ERROR(len)) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_RECV_ERROR,
+ "data_recv_error");
+ break;
+ }
+ my_data->stats.named.bytes_received += len;
+ my_data->stats.named.recv_calls++;
+ received += len;
+ req_ptr += len;
+ if (received >= (sizeof(int)*4)) {
+ bytes_left = ntohl(req_base[0]);
+ rsp_size = ntohl(req_base[1]);
+ if ((bytes_left > my_data->vst_ring->recv_size) ||
+ (rsp_size > my_data->vst_ring->send_size) ||
+ (bytes_left < (sizeof(int)*4)) ||
+ (rsp_size < (sizeof(int)*4)) ||
+ (bytes_left != ntohl(req_base[2])) ||
+ (rsp_size != ntohl(req_base[3])) ) {
+ fprintf(test->where,
+ "\n%s: Error in received packet for test_id = '%s'\n",
+ __func__, test->id);
+ fprintf(test->where,
+ "\treq_base[0] = %d\treq_base[1] = %d\n",
+ bytes_left, rsp_size);
+ fprintf(test->where,
+ "\treq_base[2] = %d\treq_base[3] = %d\n\n",
+ ntohl(req_base[2]), ntohl(req_base[3]));
+ fprintf(test->where,
+ "\treq_base = %p\torig_req_ptr = %p\treceived = %d\n",
+ req_base, my_data->vst_ring->recv_buff_ptr, received);
+ fflush(test->where);
+ }
+ bytes_left = bytes_left - received;
+ }
+ else {
+ bytes_left = my_data->vst_ring->recv_size - received;
+ }
+ }
+ else {
+ /* just got a data connection close break out of while loop */
+ break;
+ }
+ }
+ if (len == 0) {
+ /* how do we deal with a closed connection in the measured state */
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_CONNECTION_CLOSED_ERROR,
+ "data connection closed during TEST_MEASURE state");
+ }
+ else {
+ my_data->stats.named.trans_received++;
+ if ((len=send(my_data->s_data,
+ my_data->vst_ring->send_buff_ptr,
+ rsp_size,
+ 0)) != rsp_size) {
+ /* this macro hides windows differences */
+ if (CHECK_FOR_SEND_ERROR(len)) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_SEND_ERROR,
+ "data_send_error");
+ }
+ }
+ my_data->stats.named.bytes_sent += len;
+ my_data->stats.named.send_calls++;
+ }
+ /* code to timestamp enabled by WANT_HISTOGRAM */
+ HIST_TIMESTAMP(&time_two);
+ HIST_ADD(my_data->time_hist,&time_one,&time_two);
+ get_next_vst_transaction(test);
+ }
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_LOADED) {
+ /* transitioning to loaded state from measure state
+ set current timestamp and update elapsed time */
+ gettimeofday(&(my_data->curr_time), NULL);
+ update_elapsed_time(my_data);
+ }
+ return(new_state);
+}
+
+static uint32_t
+recv_vst_rr_load(test_t *test)
+{
+ int len;
+ int bytes_left;
+ int received;
+ int *req_base;
+ int rsp_size;
+ char *req_ptr;
+ uint32_t new_state;
+ vst_data_t *my_data;
+
+ my_data = GET_TEST_DATA(test);
+
+ while (NO_STATE_CHANGE(test)) {
+ /* recv the request for the test */
+ req_base = (int *)my_data->vst_ring->recv_buff_ptr;
+ req_ptr = my_data->vst_ring->recv_buff_ptr;
+ bytes_left = my_data->vst_ring->recv_size;
+ received = 0;
+ while (bytes_left > 0) {
+ if ((len=recv(my_data->s_data,
+ req_ptr,
+ bytes_left,
+ 0)) != 0) {
+ /* this macro hides windows differences */
+ if (CHECK_FOR_RECV_ERROR(len)) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_RECV_ERROR,
+ "data_recv_error");
+ break;
+ }
+ received += len;
+ req_ptr += len;
+ if (received >= (sizeof(int)*4)) {
+ bytes_left = ntohl(req_base[0]);
+ rsp_size = ntohl(req_base[1]);
+ if ((bytes_left > my_data->vst_ring->recv_size) ||
+ (rsp_size > my_data->vst_ring->send_size) ||
+ (bytes_left < (sizeof(int)*4)) ||
+ (rsp_size < (sizeof(int)*4)) ||
+ (bytes_left != ntohl(req_base[2])) ||
+ (rsp_size != ntohl(req_base[3])) ) {
+ fprintf(test->where,
+ "\n%s: Error in received packet for test_id = '%s'\n",
+ __func__, test->id);
+ fprintf(test->where,
+ "\treq_base[0] = %d\treq_base[1] = %d\n",
+ bytes_left, rsp_size);
+ fprintf(test->where,
+ "\treq_base[2] = %d\treq_base[3] = %d\n\n",
+ ntohl(req_base[2]), ntohl(req_base[3]));
+ fprintf(test->where,
+ "\treq_base = %p\torig_req_ptr = %p\treceived = %d\n",
+ req_base, my_data->vst_ring->recv_buff_ptr, received);
+ fflush(test->where);
+ }
+ bytes_left = bytes_left - received;
+ }
+ else {
+ bytes_left = my_data->vst_ring->recv_size - received;
+ }
+ }
+ else {
+ /* just got a data connection close break out of while loop */
+ break;
+ }
+ }
+ /* check for state transition */
+ new_state = CHECK_REQ_STATE;
+ if ((len == 0) ||
+ (new_state == TEST_IDLE)) {
+ /* just got a data connection close or
+ a request to transition to the idle state */
+ break;
+ }
+ if ((len=send(my_data->s_data,
+ my_data->vst_ring->send_buff_ptr,
+ rsp_size,
+ 0)) != rsp_size) {
+ /* this macro hides windows differences */
+ if (CHECK_FOR_SEND_ERROR(len)) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_SEND_ERROR,
+ "data_send_error");
+ }
+ }
+ get_next_vst_transaction(test);
+ }
+ new_state = CHECK_REQ_STATE;
+ if ((len == 0) ||
+ (new_state == TEST_IDLE)) {
+ recv_vst_rr_idle_link(test,len);
+ new_state = TEST_IDLE;
+ }
+ else {
+ if (new_state == TEST_MEASURE) {
+ /* transitioning to measure state from loaded state
+ set previous timestamp */
+ gettimeofday(&(my_data->prev_time), NULL);
+ }
+ }
+ return(new_state);
+}
+
+static void
+send_vst_rr_preinit(test_t *test)
+{
+ vst_data_t *my_data;
+
+ my_data = GET_TEST_DATA(test);
+
+ get_dependency_data(test, SOCK_STREAM, IPPROTO_TCP);
+ my_data->s_data = create_data_socket(test);
+}
+
+static uint32_t
+send_vst_rr_init(test_t *test)
+{
+ vst_data_t *my_data;
+
+ my_data = GET_TEST_DATA(test);
+
+ if (test->debug) {
+ fprintf(test->where,"%s: in INIT state making connect call\n", __func__);
+ fflush(test->where);
+ }
+ if (connect(my_data->s_data,
+ my_data->remaddr->ai_addr,
+ my_data->remaddr->ai_addrlen) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_CONNECT_FAILED,
+ "data socket connect failed");
+ }
+ else {
+ if (test->debug) {
+ fprintf(test->where,"%s: connected and moving to IDLE\n", __func__);
+ fflush(test->where);
+ }
+ }
+ return(TEST_IDLE);
+}
+
+static void
+send_vst_rr_idle_link(test_t *test, int last_len)
+{
+ int len;
+ uint32_t new_state;
+ vst_data_t *my_data;
+
+ NETPERF_DEBUG_ENTRY(test->debug, test->where);
+
+ my_data = GET_TEST_DATA(test);
+ len = last_len;
+
+ new_state = CHECK_REQ_STATE;
+ while (new_state == TEST_LOADED) {
+ sleep(1);
+ new_state = CHECK_REQ_STATE;
+ }
+ if (new_state == TEST_IDLE) {
+ if (test->debug) {
+ fprintf(test->where,"%s: transition from LOAD to IDLE\n", __func__);
+ fflush(test->where);
+ }
+ if (shutdown(my_data->s_data,SHUT_WR) == -1) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_SOCKET_SHUTDOWN_FAILED,
+ "failure shuting down data socket");
+ }
+ else {
+ while (len > 0) {
+ len = recv(my_data->s_data,
+ my_data->vst_ring->recv_buff_ptr,
+ my_data->vst_ring->recv_size, 0);
+ }
+ close(my_data->s_data);
+ my_data->s_data = create_data_socket(test);
+ if (test->debug) {
+ fprintf(test->where,"%s: connecting from LOAD state\n", __func__);
+ fflush(test->where);
+ }
+ if (connect(my_data->s_data,
+ my_data->remaddr->ai_addr,
+ my_data->remaddr->ai_addrlen) < 0) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_CONNECT_FAILED,
+ "data socket connect failed");
+ }
+ else {
+ if (test->debug) {
+ fprintf(test->where,"%s: connected moving to IDLE\n", __func__);
+ fflush(test->where);
+ }
+ }
+ }
+ }
+ else {
+ /* a transition to a state other than TEST_IDLE was requested
+ after the link was closed in the TEST_LOADED state */
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_CONNECTION_CLOSED_ERROR,
+ "data connection closed and non idle state requested");
+
+ }
+}
+
+static uint32_t
+send_vst_rr_meas(test_t *test)
+{
+ uint32_t new_state;
+ int len;
+ int send_len;
+ int bytes_left;
+ char *rsp_ptr;
+ vst_data_t *my_data;
+ int *send_buf;
+
+ my_data = GET_TEST_DATA(test);
+
+ while (NO_STATE_CHANGE(test)) {
+ HISTOGRAM_VARS;
+ /* code to make data dirty macro enabled by DIRTY */
+ MAKE_DIRTY(my_data,my_data->vst_ring);
+ /* code to timestamp enabled by WANT_HISTOGRAM */
+ HIST_TIMESTAMP(&time_one);
+ /* send data for the test */
+ send_len = my_data->vst_ring->send_size;
+ bytes_left = my_data->vst_ring->recv_size;
+ send_buf = (int *)my_data->vst_ring->send_buff_ptr;
+ if ((send_len != send_buf[0]) ||
+ (bytes_left != send_buf[1]) ||
+ (send_len != send_buf[2]) ||
+ (bytes_left != send_buf[3])) {
+ fprintf(test->where,
+ "\n%s: Found corrupted buffer is %d,%d should be %d,%d\n\n",
+ __func__, send_buf[0], send_buf[1], send_len, bytes_left);
+ fflush(test->where);
+ }
+ if((len=send(my_data->s_data,
+ my_data->vst_ring->send_buff_ptr,
+ send_len,
+ 0)) != send_len) {
+ /* this macro hides windows differences */
+ if (CHECK_FOR_SEND_ERROR(len)) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_SEND_ERROR,
+ "data send error");
+ }
+ }
+ my_data->stats.named.bytes_sent += len;
+ my_data->stats.named.send_calls++;
+ /* recv the request for the test */
+ rsp_ptr = my_data->vst_ring->recv_buff_ptr;
+ while (bytes_left > 0) {
+ if ((len=recv(my_data->s_data,
+ rsp_ptr,
+ bytes_left,
+ 0)) != 0) {
+ /* this macro hides windows differences */
+ if (CHECK_FOR_RECV_ERROR(len)) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_RECV_ERROR,
+ "data_recv_error");
+ break;
+ }
+ my_data->stats.named.bytes_received += len;
+ my_data->stats.named.recv_calls++;
+ rsp_ptr += len;
+ bytes_left -= len;
+ }
+ else {
+ /* len is 0 the connection was closed exit the while loop */
+ break;
+ }
+ }
+ /* code to timestamp enabled by WANT_HISTOGRAM */
+ HIST_TIMESTAMP(&time_two);
+ HIST_ADD(my_data->time_hist,&time_one,&time_two);
+ my_data->stats.named.trans_sent++;
+ get_next_vst_transaction(test);
+ if (len == 0) {
+ /* how do we deal with a closed connection in the measured state */
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_CONNECTION_CLOSED_ERROR,
+ "data connection closed during TEST_MEASURE state");
+ }
+ }
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_LOADED) {
+ /* transitioning to loaded state from measure state
+ set current timestamp and update elapsed time */
+ gettimeofday(&(my_data->curr_time), NULL);
+ update_elapsed_time(my_data);
+ }
+ return(new_state);
+}
+
+static uint32_t
+send_vst_rr_load(test_t *test)
+{
+ uint32_t new_state;
+ int len;
+ int send_len;
+ int bytes_left;
+ char *rsp_ptr;
+ vst_data_t *my_data;
+ int *send_buf;
+
+ my_data = GET_TEST_DATA(test);
+
+ while (NO_STATE_CHANGE(test)) {
+ /* code to make data dirty macro enabled by DIRTY */
+ MAKE_DIRTY(my_data,my_data->vst_ring);
+ /* send data for the test */
+ send_len = my_data->vst_ring->send_size;
+ bytes_left = my_data->vst_ring->recv_size;
+ send_buf = (int *)my_data->vst_ring->send_buff_ptr;
+ if ((send_len != send_buf[0]) ||
+ (bytes_left != send_buf[1]) ||
+ (send_len != send_buf[2]) ||
+ (bytes_left != send_buf[3])) {
+ fprintf(test->where,
+ "\n%s: Found corrupted buffer is %d,%d should be %d,%d\n\n",
+ __func__, send_buf[0], send_buf[1], send_len, bytes_left);
+ fflush(test->where);
+ }
+ if((len=send(my_data->s_data,
+ my_data->vst_ring->send_buff_ptr,
+ send_len,
+ 0)) != send_len) {
+ /* this macro hides windows differences */
+ if (CHECK_FOR_SEND_ERROR(len)) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_SEND_ERROR,
+ "data send error");
+ }
+ }
+ /* recv the request for the test */
+ rsp_ptr = my_data->vst_ring->recv_buff_ptr;
+ while (bytes_left > 0) {
+ if ((len=recv(my_data->s_data,
+ rsp_ptr,
+ bytes_left,
+ 0)) != 0) {
+ /* this macro hides windows differences */
+ if (CHECK_FOR_RECV_ERROR(len)) {
+ report_test_failure(test,
+ (char *)__func__,
+ VSTE_DATA_RECV_ERROR,
+ "data_recv_error");
+ break;
+ }
+ rsp_ptr += len;
+ bytes_left -= len;
+ }
+ else {
+ /* len is 0 the connection was closed exit the while loop */
+ break;
+ }
+ }
+ if (len == 0) {
+ break;
+ }
+ get_next_vst_transaction(test);
+ }
+ new_state = CHECK_REQ_STATE;
+ if ((len == 0) ||
+ (new_state == TEST_IDLE)) {
+ send_vst_rr_idle_link(test,len);
+ new_state = TEST_IDLE;
+ }
+ else {
+ if (new_state == TEST_MEASURE) {
+ /* transitioning to measure state from loaded state
+ set previous timestamp */
+ gettimeofday(&(my_data->prev_time), NULL);
+ }
+ }
+ return(new_state);
+}
+
+int
+recv_vst_rr_clear_stats(test_t *test)
+{
+ return(vst_test_clear_stats(GET_TEST_DATA(test)));
+}
+
+
+xmlNodePtr
+recv_vst_rr_get_stats(test_t *test)
+{
+ return( vst_test_get_stats(test));
+}
+
+void
+recv_vst_rr_decode_stats(xmlNodePtr stats,test_t *test)
+{
+ vst_test_decode_stats(stats,test);
+}
+
+
+int
+send_vst_rr_clear_stats(test_t *test)
+{
+ return(vst_test_clear_stats(GET_TEST_DATA(test)));
+}
+
+xmlNodePtr
+send_vst_rr_get_stats(test_t *test)
+{
+ return( vst_test_get_stats(test));
+}
+
+void
+send_vst_rr_decode_stats(xmlNodePtr stats,test_t *test)
+{
+ vst_test_decode_stats(stats,test);
+}
+
+
+/* This routine implements the server-side of a TCP request/response */
+/* test (a.k.a. rr) for the sockets interface. It receives its */
+/* parameters via the xml node contained in the test structure. */
+/* The test looks at the first eight bytes of contents in the request */
+/* to determine the actual size of the request and response messages. */
+/* results are collected by the procedure recv_vst_rr_get_stats */
+
+void
+recv_vst_rr(test_t *test)
+{
+ uint32_t state, new_state;
+
+ NETPERF_DEBUG_ENTRY(test->debug, test->where);
+
+ vst_test_init(test, SOCK_STREAM, IPPROTO_TCP);
+ state = GET_TEST_STATE;
+ while ((state != TEST_ERROR) &&
+ (state != TEST_DEAD )) {
+ switch(state) {
+ case TEST_PREINIT:
+ recv_vst_rr_preinit(test);
+ new_state = TEST_INIT;
+ break;
+ case TEST_INIT:
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_IDLE) {
+ new_state = recv_vst_rr_init(test);
+ }
+ break;
+ case TEST_IDLE:
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_IDLE) {
+ sleep(1);
+ }
+ break;
+ case TEST_MEASURE:
+ new_state = recv_vst_rr_meas(test);
+ break;
+ case TEST_LOADED:
+ new_state = recv_vst_rr_load(test);
+ break;
+ default:
+ break;
+ } /* end of switch */
+ set_test_state(test, new_state);
+ state = GET_TEST_STATE;
+ } /* end of while */
+ wait_to_die(test,free_vst_test_data);
+
+ NETPERF_DEBUG_EXIT(test->debug, test->where);
+
+} /* end of recv_vst_rr */
+
+
+/* This routine implements a TCP request/responce test */
+/* (a.k.a. rr) for the sockets interface. It receives its */
+/* parameters via the xml node contained in the test structure */
+/* output to the standard output. The parameters include a pattern */
+/* of variable sized requests and responces to send for the test */
+/* results are collected by the procedure send_vst_rr_get_stats */
+
+void
+send_vst_rr(test_t *test)
+{
+ uint32_t state, new_state;
+ vst_test_init(test, SOCK_STREAM, IPPROTO_TCP);
+ state = GET_TEST_STATE;
+ while ((state != TEST_ERROR) &&
+ (state != TEST_DEAD )) {
+ switch(state) {
+ case TEST_PREINIT:
+ send_vst_rr_preinit(test);
+ new_state = TEST_INIT;
+ break;
+ case TEST_INIT:
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_IDLE) {
+ new_state = send_vst_rr_init(test);
+ }
+ break;
+ case TEST_IDLE:
+ new_state = CHECK_REQ_STATE;
+ if (new_state == TEST_IDLE) {
+ sleep(1);
+ }
+ break;
+ case TEST_MEASURE:
+ new_state = send_vst_rr_meas(test);
+ break;
+ case TEST_LOADED:
+ new_state = send_vst_rr_load(test);
+ break;
+ default:
+ break;
+ } /* end of switch */
+ set_test_state(test, new_state);
+ state = GET_TEST_STATE;
+ } /* end of while */
+ wait_to_die(test,free_vst_test_data);
+} /* end of send_vst_rr */
+
+
+/* This implementation of report_vst_test_results will generate strange
+ results if transaction count and throughput tests are included in the
+ same test set. The first test in the set sets the headers and algorithm
+ for computing service demand */
+
+static void
+vst_test_results_init(tset_t *test_set,char *report_flags,char *output)
+{
+ vst_results_t *rd;
+ FILE *outfd;
+ int max_count;
+ size_t malloc_size;
+
+ rd = test_set->report_data;
+ max_count = test_set->confidence.max_count;
+
+ if (output) {
+ if (test_set->debug) {
+ fprintf(test_set->where,
+ "%s: report going to file %s\n",
+ __func__, output);
+ fflush(test_set->where);
+ }
+ outfd = fopen(output,"a");
+ }
+ else {
+ if (test_set->debug) {
+ fprintf(test_set->where,
+ "%s: report going to file stdout\n",
+ __func__);
+ fflush(test_set->where);
+ }
+ outfd = stdout;
+ }
+ /* allocate and initialize report data */
+ malloc_size = sizeof(vst_results_t) + 7 * max_count * sizeof(double);
+ rd = malloc(malloc_size);
+ if (rd) {
+
+ /* original code took sizeof a math equation so memset only zeroed the */
+ /* first sizeof(size_t) bytes. This should work better sgb 20060203 */
+
+ memset(rd, 0, malloc_size);
+ rd->max_count = max_count;
+ rd->results = &(rd->results_start);
+ rd->xmit_results = &(rd->results[max_count]);
+ rd->recv_results = &(rd->xmit_results[max_count]);
+ rd->trans_results = &(rd->recv_results[max_count]);
+ rd->utilization = &(rd->trans_results[max_count]);
+ rd->servdemand = &(rd->utilization[max_count]);
+ rd->run_time = &(rd->servdemand[max_count]);
+ rd->result_minimum = DBL_MAX;
+ rd->result_maximum = DBL_MIN;
+ rd->outfd = outfd;
+ rd->sd_denominator = 0.0;
+ /* not all strcmp's play well with NULL pointers. bummer */
+ if (NULL != report_flags) {
+ if (!strcmp(report_flags,"PRINT_RUN")) {
+ rd->print_run = 1;
+ }
+ if (!strcmp(report_flags,"PRINT_TESTS")) {
+ rd->print_test = 1;
+ }
+ if (!strcmp(report_flags,"PRINT_ALL")) {
+ rd->print_run = 1;
+ rd->print_test = 1;
+ }
+ }
+ if (test_set->debug) {
+ rd->print_run = 1;
+ rd->print_test = 1;
+ }
+ test_set->report_data = rd;
+ }
+ else {
+ /* could not allocate memory can't generate report */
+ fprintf(outfd,
+ "%s: malloc failed can't generate report\n",
+ __func__);
+ fflush(outfd);
+ exit(-11);
+ }
+}
+
+static void
+process_test_stats(tset_t *test_set, xmlNodePtr stats, xmlChar *tid)
+{
+ int i;
+ int count;
+ int index;
+ FILE *outfd;
+ vst_results_t *rd;
+
+ double elapsed_seconds;
+ double result;
+ double xmit_rate;
+ double recv_rate;
+ double xmit_trans_rate;
+ double recv_trans_rate;
+
+#define TST_E_SEC 0
+#define TST_E_USEC 1
+#define TST_X_BYTES 5
+#define TST_R_BYTES 7
+#define TST_X_TRANS 8
+#define TST_R_TRANS 9
+
+#define MAX_TEST_CNTRS 12
+ double test_cntr[MAX_TEST_CNTRS];
+ const char *cntr_name[] = {
+ "elapsed_sec",
+ "elapsed_usec",
+ "time_sec",
+ "time_usec",
+ "cntr0_value",
+ "cntr1_value",
+ "cntr2_value",
+ "cntr3_value",
+ "cntr4_value",
+ "cntr5_value",
+ "cntr6_value",
+ "cntr7_value"
+ };
+
+ rd = test_set->report_data;
+ count = test_set->confidence.count;
+ outfd = rd->outfd;
+ index = count - 1;
+
+ /* process test statistics */
+ NETPERF_DEBUG_ENTRY(test_set->debug, test_set->where);
+
+ for (i=0; i<MAX_TEST_CNTRS; i++) {
+ char *value_str =
+ (char *)xmlGetProp(stats, (const xmlChar *)cntr_name[i]);
+ if (value_str) {
+ test_cntr[i] = strtod(value_str,NULL);
+ if (test_cntr[i] == 0.0) {
+ uint64_t x;
+ sscanf(value_str,"%"PRIx64,&x);
+ test_cntr[i] = (double)x;
+ }
+ }
+ else {
+ test_cntr[i] = 0.0;
+ }
+ if (test_set->debug) {
+ fprintf(test_set->where,"\t%12s test_cntr[%2d] = %10g\t'%s'\n",
+ cntr_name[i], i, test_cntr[i],
+ xmlGetProp(stats, (const xmlChar *)cntr_name[i]));
+ }
+ }
+ elapsed_seconds = test_cntr[TST_E_SEC] + test_cntr[TST_E_USEC]/1000000.0;
+ xmit_rate = test_cntr[TST_X_BYTES]*8/(elapsed_seconds*1000000.0);
+ recv_rate = test_cntr[TST_R_BYTES]*8/(elapsed_seconds*1000000.0);
+ xmit_trans_rate = test_cntr[TST_X_TRANS]/elapsed_seconds;
+ recv_trans_rate = test_cntr[TST_R_TRANS]/elapsed_seconds;
+ if (test_set->debug) {
+ fprintf(test_set->where,"\txmit_rate = %7g\t%7g\n",
+ xmit_rate, test_cntr[TST_X_BYTES]);
+ fprintf(test_set->where,"\trecv_rate = %7g\t%7g\n",
+ recv_rate, test_cntr[TST_R_BYTES]);
+ fprintf(test_set->where,"\txmit_trans_rate = %7g\t%7g\n",
+ xmit_trans_rate, test_cntr[TST_X_TRANS]);
+ fprintf(test_set->where,"\trecv_trans_rate = %7g\t%7g\n",
+ recv_trans_rate, test_cntr[TST_X_TRANS]);
+ fflush(test_set->where);
+ }
+ if (rd->sd_denominator == 0.0) {
+ if (xmit_trans_rate > 0.0 || recv_trans_rate > 0.0) {
+ rd->sd_denominator = 1.0;
+ }
+ else {
+ rd->sd_denominator = 1000000.0/(8.0*1024.0);
+ }
+ }
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tsd_denominator = %f\n",rd->sd_denominator);
+ fflush(test_set->where);
+ }
+ if (rd->sd_denominator != 1.0) {
+ result = recv_rate + xmit_rate;
+ }
+ else {
+ result = recv_trans_rate + xmit_trans_rate;
+ }
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tresult = %f\n",result);
+ fflush(test_set->where);
+ }
+ /* accumulate results for the run */
+ rd->run_time[index] += elapsed_seconds;
+ rd->results[index] += result;
+ rd->xmit_results[index] += xmit_rate;
+ rd->recv_results[index] += recv_rate;
+ rd->trans_results[index] += xmit_trans_rate;
+ rd->trans_results[index] += recv_trans_rate;
+
+ if (rd->print_test) {
+ /* Display per test results */
+ fprintf(outfd,"%3d ", count); /* 0,5 */
+ fprintf(outfd,"%-6s ", tid); /* 5,7 */
+ fprintf(outfd,"%-6.2f ",elapsed_seconds); /* 12,7 */
+ fprintf(outfd,"%7.2f ",result); /* 19,8 */
+ fprintf(outfd,"%7.2f ",xmit_rate); /* 27,8 */
+ fprintf(outfd,"%7.2f ",recv_rate); /* 35,8 */
+ fprintf(outfd,"\n");
+ fflush(outfd);
+ }
+ /* end of printing vst per test instance results */
+}
+
+static double
+process_sys_stats(tset_t *test_set, xmlNodePtr stats, xmlChar *tid)
+{
+ int i;
+ int count;
+ int index;
+ FILE *outfd;
+ vst_results_t *rd;
+ double elapsed_seconds;
+ double calibration;
+ double local_idle;
+ double local_busy;
+ double local_cpus;
+
+#define MAX_SYS_CNTRS 10
+#define E_SEC 0
+#define E_USEC 1
+#define NUM_CPU 4
+#define CALIBRATE 5
+#define IDLE 6
+
+ double sys_cntr[MAX_SYS_CNTRS];
+ const char *sys_cntr_name[] = {
+ "elapsed_sec",
+ "elapsed_usec",
+ "time_sec",
+ "time_usec",
+ "number_cpus",
+ "calibration",
+ "idle_count",
+ "",
+ "",
+ ""
+ };
+
+ rd = test_set->report_data;
+ count = test_set->confidence.count;
+ outfd = rd->outfd;
+ index = count - 1;
+
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tprocessing sys_stats\n");
+ fflush(test_set->where);
+ }
+ for (i=0; i<MAX_SYS_CNTRS; i++) {
+ char *value_str =
+ (char *)xmlGetProp(stats, (const xmlChar *)sys_cntr_name[i]);
+ if (value_str) {
+ sys_cntr[i] = strtod(value_str,NULL);
+ if (sys_cntr[i] == 0.0) {
+ uint64_t x;
+ sscanf(value_str,"%"PRIx64,&x);
+ sys_cntr[i] = (double)x;
+ }
+ }
+ else {
+ sys_cntr[i] = 0.0;
+ }
+ if (test_set->debug) {
+ fprintf(test_set->where,"\t%12s sys_stats[%d] = %10g '%s'\n",
+ sys_cntr_name[i], i, sys_cntr[i],
+ xmlGetProp(stats, (const xmlChar *)sys_cntr_name[i]));
+ }
+ }
+ local_cpus = sys_cntr[NUM_CPU];
+ elapsed_seconds = sys_cntr[E_SEC] + sys_cntr[E_USEC]/1000000;
+ calibration = sys_cntr[CALIBRATE];
+ local_idle = sys_cntr[IDLE] / calibration;
+ local_busy = (calibration-sys_cntr[IDLE])/calibration;
+
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tnum_cpus = %f\n",local_cpus);
+ fprintf(test_set->where,"\telapsed_seconds = %7.2f\n",elapsed_seconds);
+ fprintf(test_set->where,"\tidle_cntr = %e\n",sys_cntr[IDLE]);
+ fprintf(test_set->where,"\tcalibrate_cntr = %e\n",sys_cntr[CALIBRATE]);
+ fprintf(test_set->where,"\tlocal_idle = %e\n",local_idle);
+ fprintf(test_set->where,"\tlocal_busy = %e\n",local_busy);
+ fflush(test_set->where);
+ }
+ rd->utilization[index] += local_busy;
+ if (rd->print_test) {
+ /* Display per test results */
+ fprintf(outfd,"%3d ", count); /* 0,5 */
+ fprintf(outfd,"%-6s ", tid); /* 5,7 */
+ fprintf(outfd,"%-6.2f ",elapsed_seconds); /* 12,7 */
+ fprintf(outfd,"%24s",""); /* 19,24*/
+ fprintf(outfd,"%7.1e ",calibration); /* 43,8 */
+ fprintf(outfd,"%6.3f ",local_idle*100.0); /* 51,7 */
+ fprintf(outfd,"%6.3f ",local_busy*100.0); /* 58,7 */
+ fprintf(outfd,"\n"); /* 79,1 */
+ fflush(outfd);
+ }
+ /* end of printing sys stats instance results */
+ return(local_cpus);
+}
+
+static void
+process_stats_for_run(tset_t *test_set)
+{
+ vst_results_t *rd;
+ test_t *test;
+ tset_elt_t *set_elt;
+ xmlNodePtr stats;
+ xmlNodePtr prev_stats;
+ int count;
+ int index;
+ int num_of_tests;
+ double num_of_cpus;
+
+
+ rd = test_set->report_data;
+ set_elt = test_set->tests;
+ count = test_set->confidence.count;
+ index = count - 1;
+
+ if (test_set->debug) {
+ fprintf(test_set->where,
+ "test_set %s has %d tests looking for statistics\n",
+ test_set->id,test_set->num_tests);
+ fflush(test_set->where);
+ }
+
+ if (test_set->debug) {
+ fprintf(test_set->where, "%s count = %d\n", __func__, count);
+ fflush(test_set->where);
+ }
+
+ rd->results[index] = 0.0;
+ rd->xmit_results[index] = 0.0;
+ rd->recv_results[index] = 0.0;
+ rd->utilization[index] = 0.0;
+ rd->servdemand[index] = 0.0;
+ rd->run_time[index] = 0.0;
+
+ num_of_tests = 0;
+ num_of_cpus = 0.0;
+ while (set_elt != NULL) {
+ int stats_for_test;
+ test = set_elt->test;
+ stats = test->received_stats->xmlChildrenNode;
+ if (test_set->debug) {
+ if (stats) {
+ fprintf(test_set->where,
+ "\ttest %s has '%s' statistics\n",
+ test->id,stats->name);
+ }
+ else {
+ fprintf(test_set->where,
+ "\ttest %s has no statistics available!\n",
+ test->id);
+ }
+ fflush(test_set->where);
+ }
+ stats_for_test = 0;
+ while (stats != NULL) {
+ /* process all the statistics records for this test */
+ if (test_set->debug) {
+ fprintf(test_set->where,"\tfound some statistics");
+ fflush(test_set->where);
+ }
+ if(!xmlStrcmp(stats->name,(const xmlChar *)"sys_stats")) {
+ /* process system statistics */
+ num_of_cpus = process_sys_stats(test_set, stats, test->id);
+ stats_for_test++;
+ }
+ if(!xmlStrcmp(stats->name,(const xmlChar *)"test_stats")) {
+ /* process test statistics */
+ process_test_stats(test_set, stats, test->id);
+ stats_for_test++;
+ num_of_tests++;
+ }
+ /* other types of nodes just get skipped by this report routine */
+ /* delete statistics entry from test */
+ prev_stats = stats;
+ stats = stats->next;
+ xmlUnlinkNode(prev_stats);
+ xmlFreeNode(prev_stats);
+ }
+ /* should only have one stats record for each test otherwise error */
+ if (stats_for_test > 1) {
+ /* someone is playing games don't generate report*/
+ fprintf(test_set->where,
+ "More than one statistics measurement for test %d\n",
+ stats_for_test);
+ fprintf(test_set->where,
+ "%s was not designed to deal with this.\n",
+ __func__);
+ fprintf(test_set->where,
+ "exiting netperf now!!\n");
+ fflush(test_set->where);
+ exit(-13);
+ }
+ set_elt = set_elt->next;
+ }
+
+ if (rd->result_minimum > rd->results[index]) {
+ rd->result_minimum = rd->results[index];
+ }
+ if (rd->result_maximum < rd->results[index]) {
+ rd->result_maximum = rd->results[index];
+ }
+ rd->run_time[index] = rd->run_time[index] / (double)num_of_tests;
+
+ /* now calculate service demand for this test run. Remember the cpu */
+ /* utilization is in the range 0.0 to 1.0 so we need to multiply by */
+ /* the number of cpus and 1,000,000.0 to get to microseconds of cpu */
+ /* time per unit of work. The result is in transactions per second */
+ /* or in million bits per second so the sd_denominator is factored */
+ /* in to convert service demand into usec/trans or usec/Kbytes. */
+
+ if ((rd->results[index] != 0.0) && (num_of_cpus != 0.0)) {
+ rd->servdemand[index] = rd->utilization[index] * num_of_cpus * 1000000.0 /
+ (rd->results[index] * rd->sd_denominator);
+ }
+ NETPERF_DEBUG_EXIT(test_set->debug,test_set->where);
+}
+
+static void
+update_results_and_confidence(tset_t *test_set)
+{
+ vst_results_t *rd;
+ double confidence;
+ double temp;
+ int loc_debug = 0;
+
+ rd = test_set->report_data;
+
+ NETPERF_DEBUG_ENTRY(test_set->debug,test_set->where);
+
+ /* calculate confidence and summary result values */
+ confidence = (test_set->get_confidence)(rd->xmit_results,
+ &(test_set->confidence),
+ &(rd->xmit_measured_mean),
+ &(rd->xmit_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\txmit_results conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * confidence, rd->xmit_measured_mean, rd->xmit_interval);
+ fflush(test_set->where);
+ }
+
+ confidence = (test_set->get_confidence)(rd->recv_results,
+ &(test_set->confidence),
+ &(rd->recv_measured_mean),
+ &(rd->recv_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\trecv_results conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * confidence, rd->recv_measured_mean, rd->recv_interval);
+ fflush(test_set->where);
+ }
+
+ confidence = (test_set->get_confidence)(rd->run_time,
+ &(test_set->confidence),
+ &(rd->ave_time),
+ &(temp));
+
+ rd->result_confidence = (test_set->get_confidence)(rd->results,
+ &(test_set->confidence),
+ &(rd->result_measured_mean),
+ &(rd->result_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\tresults conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * rd->result_confidence,
+ rd->result_measured_mean, rd->result_interval);
+ fflush(test_set->where);
+ }
+ rd->cpu_util_confidence = (test_set->get_confidence)(rd->utilization,
+ &(test_set->confidence),
+ &(rd->cpu_util_measured_mean),
+ &(rd->cpu_util_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\tcpu_util conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * rd->cpu_util_confidence,
+ rd->cpu_util_measured_mean, rd->cpu_util_interval);
+ fflush(test_set->where);
+ }
+ rd->service_demand_confidence = (test_set->get_confidence)(rd->servdemand,
+ &(test_set->confidence),
+ &(rd->service_demand_measured_mean),
+ &(rd->service_demand_interval));
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\tserv_demand conf = %.2f%%\tmean = %10f +/- %8f\n",
+ 100.0 * rd->service_demand_confidence,
+ rd->service_demand_measured_mean, rd->service_demand_interval);
+ fflush(test_set->where);
+ }
+
+ if (rd->result_confidence > rd->cpu_util_confidence) {
+ confidence = rd->result_confidence;
+ }
+ else {
+ confidence = rd->cpu_util_confidence;
+ }
+ if (rd->service_demand_confidence > confidence) {
+ confidence = rd->service_demand_confidence;
+ }
+
+ if (test_set->confidence.min_count > 1) {
+ test_set->confidence.value = test_set->confidence.interval - confidence;
+ }
+ if (test_set->debug || loc_debug) {
+ fprintf(test_set->where,
+ "\t%3drun confidence = %.2f%%\tcheck value = %f\n",
+ test_set->confidence.count,
+ 100.0 * confidence, test_set->confidence.value);
+ fflush(test_set->where);
+ }
+ NETPERF_DEBUG_EXIT(test_set->debug,test_set->where);
+}
+
+static void
+print_run_results(tset_t *test_set)
+{
+ vst_results_t *rd;
+ FILE *outfd;
+ int i;
+ int count;
+ int index;
+
+#define HDR_LINES 3
+ char *field1[HDR_LINES] = { "INST", "NUM", " " }; /* 4 */
+ char *field2[HDR_LINES] = { "SET", "Name", " " }; /* 6 */
+ char *field3[HDR_LINES] = { "RUN", "Time", "sec" }; /* 6 */
+ char *field4[HDR_LINES] = { "TRANS", "RATE", "tran/s" }; /* 7 */
+ char *field5[HDR_LINES] = { "XMIT", "Rate", "mb/s" }; /* 7 */
+ char *field6[HDR_LINES] = { "RECV", "Rate", "mb/s" }; /* 7 */
+ char *field7[HDR_LINES] = { "SD", "usec", "/KB" }; /* 7 */
+ char *field8[HDR_LINES] = { "CPU", "Util", "%/100" }; /* 6 */
+#ifdef OFF
+ char *field9[HDR_LINES] = { "???", "???", "???" }; /* 6 */
+ char *field10[HDR_LINES] = { "???", "???", "???" }; /* 6 */
+ char *field11[HDR_LINES] = { "???", "???", "???" }; /* 6 */
+#endif
+
+ rd = test_set->report_data;
+ count = test_set->confidence.count;
+ outfd = rd->outfd;
+ index = count - 1;
+
+
+ /* Display per run header */
+ fprintf(outfd,"\n");
+ for (i=0;i < HDR_LINES; i++) {
+ fprintf(outfd,"%-4s ",field1[i]); /* 0,5 */
+ fprintf(outfd,"%-6s ",field2[i]); /* 5,7 */
+ fprintf(outfd,"%-6s ",field3[i]); /* 12,7 */
+ fprintf(outfd,"%7s ",field4[i]); /* 19,8 */
+ fprintf(outfd,"%7s ",field5[i]); /* 27,8 */
+ fprintf(outfd,"%7s ",field6[i]); /* 35,8 */
+ fprintf(outfd,"%7s ",field7[i]); /* 43,8 */
+ fprintf(outfd,"%6s ",field8[i]); /* 51,7 */
+#ifdef OFF
+ fprintf(outfd,"%6s ",field9[i]); /* 58,7 */
+ fprintf(outfd,"%6s ",field10[i]); /* 65,7 */
+ fprintf(outfd,"%6s ",field11[i]); /* 72,7 */
+#endif
+ fprintf(outfd,"\n");
+ }
+
+ /* Display per run results */
+ fprintf(outfd,"%-3d ", count); /* 0,5 */
+ fprintf(outfd,"%-6s ", test_set->id); /* 5,7 */
+ fprintf(outfd,"%-6.2f ",rd->run_time[index]); /* 12,7 */
+ fprintf(outfd,"%7.2f ",rd->results[index]); /* 19,8 */
+ fprintf(outfd,"%7.2f ",rd->xmit_results[index]); /* 27,8 */
+ fprintf(outfd,"%7.2f ",rd->recv_results[index]); /* 35,8 */
+ fprintf(outfd,"%7.3f ",rd->servdemand[index]); /* 43,8 */
+ fprintf(outfd,"%6.4f ",rd->utilization[index]); /* 51,7 */
+#ifdef OFF
+ fprintf(outfd,"%6.4f ",something to be added later); /* 58,7 */
+ fprintf(outfd,"%6.4f ",something to be added later); /* 65,7 */
+ fprintf(outfd,"%6.4f ",something to be added later); /* 72,7 */
+#endif
+ fprintf(outfd,"\n"); /* 79,1 */
+ fflush(outfd);
+}
+
+
+static void
+print_did_not_meet_confidence(tset_t *test_set)
+{
+ vst_results_t *rd;
+ FILE *outfd;
+
+ rd = test_set->report_data;
+ outfd = rd->outfd;
+
+
+ /* print the confidence failed line */
+ fprintf(outfd,"\n");
+ fprintf(outfd,"!!! WARNING\n");
+ fprintf(outfd,"!!! Desired confidence was not achieved within ");
+ fprintf(outfd,"the specified iterations. (%d)\n",
+ test_set->confidence.max_count);
+ fprintf(outfd,
+ "!!! This implies that there was variability in ");
+ fprintf(outfd,
+ "the test environment that\n");
+ fprintf(outfd,
+ "!!! must be investigated before going further.\n");
+ fprintf(outfd,
+ "!!! Confidence intervals: RESULT : %6.2f%%\n",
+ 100.0 * rd->result_confidence);
+ fprintf(outfd,
+ "!!! CPU util : %6.2f%%\n",
+ 100.0 * rd->cpu_util_confidence);
+ fprintf(outfd,
+ "!!! ServDemand : %6.2f%%\n",
+ 100.0 * rd->service_demand_confidence);
+ fflush(outfd);
+}
+
+
+static void
+print_results_summary(tset_t *test_set)
+{
+ vst_results_t *rd;
+ FILE *outfd;
+ int i;
+
+#define HDR_LINES 3
+ /* field
+ width*/
+ char *field1[HDR_LINES] = { "AVE", "Over", "Num" }; /* 4 */
+ char *field2[HDR_LINES] = { "SET", "Name", " " }; /* 6 */
+ char *field3[HDR_LINES] = { "TEST", "Time", "sec" }; /* 6 */
+ char *field4[HDR_LINES] = { "TRANS", "RATE", "tran/s" }; /* 7 */
+ char *field5[HDR_LINES] = { "conf", "+/-", "tran/s" }; /* 7 */
+ char *field6[HDR_LINES] = { "XMIT", "Rate", "mb/s" }; /* 7 */
+ char *field7[HDR_LINES] = { "RECV", "Rate", "mb/s" }; /* 7 */
+ char *field8[HDR_LINES] = { "CPU", "Util", "%/100" }; /* 6 */
+ char *field9[HDR_LINES] = { "+/-", "Util", "%/100" }; /* 6 */
+ char *field10[HDR_LINES] = { "SD", "usec", "/KB" }; /* 6 */
+ char *field11[HDR_LINES] = { "+/-", "usec", "/KB" }; /* 6 */
+
+ rd = test_set->report_data;
+ outfd = rd->outfd;
+
+ /* Print the summary header */
+ fprintf(outfd,"\n");
+ for (i = 0; i < HDR_LINES; i++) {
+ fprintf(outfd,"%-4s ",field1[i]); /* 0,5 */
+ fprintf(outfd,"%-6s ",field2[i]); /* 5,7 */
+ fprintf(outfd,"%-6s ",field3[i]); /* 12,7 */
+ fprintf(outfd,"%7s ",field4[i]); /* 19,8 */
+ fprintf(outfd,"%7s ",field5[i]); /* 27,8 */
+ fprintf(outfd,"%7s ",field6[i]); /* 35,8 */
+ fprintf(outfd,"%7s ",field7[i]); /* 43,8 */
+ fprintf(outfd,"%6s ",field8[i]); /* 51,7 */
+ fprintf(outfd,"%6s ",field9[i]); /* 58,7 */
+ fprintf(outfd,"%6s ",field10[i]); /* 65,7 */
+ fprintf(outfd,"%6s ",field11[i]); /* 72,7 */
+ fprintf(outfd,"\n");
+ }
+
+ /* print the summary results line */
+ fprintf(outfd,"A%-3d ",test_set->confidence.count); /* 0,5 */
+ fprintf(outfd,"%-6s ",test_set->id); /* 5,7 */
+ fprintf(outfd,"%-6.2f ",rd->ave_time); /* 12,7 */
+ fprintf(outfd,"%7.2f ",rd->result_measured_mean); /* 19,8 */
+ fprintf(outfd,"%7.3f ",rd->result_interval); /* 27,8 */
+ fprintf(outfd,"%7.2f ",rd->xmit_measured_mean); /* 35,8 */
+ fprintf(outfd,"%7.2f ",rd->recv_measured_mean); /* 43,8 */
+ fprintf(outfd,"%6.4f ",rd->cpu_util_measured_mean); /* 51,7 */
+ fprintf(outfd,"%6.4f ",rd->cpu_util_interval); /* 58,7 */
+ fprintf(outfd,"%6.3f ",rd->service_demand_measured_mean); /* 65,7 */
+ fprintf(outfd,"%6.3f ",rd->service_demand_interval); /* 72,7 */
+ fprintf(outfd,"\n"); /* 79,1 */
+ fflush(outfd);
+}
+
+void
+report_vst_test_results(tset_t *test_set, char *report_flags, char *output)
+{
+ vst_results_t *rd;
+ int count;
+ int max_count;
+ int min_count;
+
+ rd = test_set->report_data;
+
+ if (rd == NULL) {
+ vst_test_results_init(test_set,report_flags,output);
+ rd = test_set->report_data;
+ }
+
+ /* process statistics for this run */
+ process_stats_for_run(test_set);
+
+ /* calculate confidence and summary result values */
+ update_results_and_confidence(test_set);
+
+ if (rd->print_run) {
+ print_run_results(test_set);
+ }
+
+ count = test_set->confidence.count;
+ max_count = test_set->confidence.max_count;
+ min_count = test_set->confidence.min_count;
+
+ /* always print summary results at end of last call through loop */
+ if ((count >= max_count) ||
+ ((test_set->confidence.value >= 0) && (count >= min_count))) {
+ print_results_summary(test_set);
+ if ((test_set->confidence.value < 0) && (min_count > 1)) {
+ print_did_not_meet_confidence(test_set);
+ }
+ }
+} /* end of report_vst_test_results */
+
Added: branches/glib_migration/suites/vst/nettest_vst.h
===================================================================
--- branches/glib_migration/suites/vst/nettest_vst.h 2006-04-19 00:11:52 UTC (rev 167)
+++ branches/glib_migration/suites/vst/nettest_vst.h 2006-04-19 00:23:57 UTC (rev 168)
@@ -0,0 +1,169 @@
+
+/* This file is Hewlett_Packard Company Confidental */
+
+ /* This file contains the test-specific definitions for netperf4's */
+ /* Hewlett-Packard Company special variable sized data tests */
+
+#define MAX_PATTERNS 16
+#define VST_RAND_STATE_SIZE 128
+
+typedef struct vst_ring_elt *vst_ring_ptr;
+
+typedef struct distribution_data {
+ int num_patterns;
+ int dist_key;
+ int dist_count[MAX_PATTERNS];
+ vst_ring_ptr pattern[MAX_PATTERNS];
+ char random_state[VST_RAND_STATE_SIZE];
+} dist_t;
+
+typedef struct vst_ring_elt {
+ vst_ring_ptr next; /* next element in the ring */
+ char *recv_buff_base; /* in case we have to free at somepoint */
+ char *recv_buff_ptr; /* the aligned and offset pointer */
+ int recv_size; /* size of request to place in the buffer */
+ int recv_buff_size; /* the actual size of the physical buffer */
+ char *send_buff_base; /* in case we have to free at somepoint */
+ char *send_buff_ptr; /* the aligned and offset pointer */
+ int send_size; /* size of response to place in the buffer */
+ int send_buff_size; /* the actual size of the physical buffer */
+ dist_t *distribution; /* pointer to a distribution structure */
+} vst_ring_elt_t;
+
+
+enum {
+ SEND_CALLS = 0,
+ BYTES_SENT,
+ RECV_CALLS,
+ BYTES_RECEIVED,
+ TRANS_SENT,
+ TRANS_RECEIVED,
+ CONNECT_CALLS,
+ ACCEPT_CALLS,
+ VST_MAX_COUNTERS
+};
+
+typedef struct vst_test_data {
+ /* address information */
+ struct addrinfo *locaddr; /* local address informtion */
+ struct addrinfo *remaddr; /* remote address informtion */
+
+ int s_listen; /* listen sockets for catching type tests */
+ int s_data; /* data socket for executing tests */
+ vst_ring_ptr vst_ring; /* address of the vst_ring */
+ FILE *fill_source; /* pointer to file for filling rings */
+ xmlNodePtr wld; /* pointer to the work load description
+ for this test */
+ /* send parameters */
+ int sbuf_size_ret; /* send socket buffer size returned on creation */
+ int send_buf_size; /* send socket buffer size */
+ int send_size; /* how many bytes maximum to send at one time? */
+ int send_avoid; /* do we want to avoid send copies? */
+ int send_align; /* what is the alignment of the send buffer? */
+ int send_offset; /* and at what offset from that alignment? */
+ int no_delay; /* do we disable the nagle algorithm for send */
+
+
+ /* recv parameters */
+ int rbuf_size_ret; /* receive socket buffer size returned on creation */
+ int recv_buf_size; /* receive socket buffer size */
+ int recv_size; /* how many bytes maximum to receive at one time? */
+ int recv_avoid; /* do we want to avoid copies on receives? */
+ int recv_align; /* what is the alignment of the receive buffer? */
+ int recv_offset; /* and at what offset from that alignment? */
+ int recv_dirty_cnt; /* how many integers in the receive buffer */
+ /* should be made dirty before calling recv? */
+ int recv_clean_cnt; /* how many integers should be read from the */
+ /* recv buffer before calling recv? */
+
+ /* connection parameters */
+ /* request/response parameters */
+ int request_size; /* number of bytes to send */
+ int response_size; /* number of bytes to receive */
+
+ /* other parameters */
+ int port_min;
+ int port_max;
+ int send_width;
+ int recv_width;
+ int req_size;
+ int rsp_size;
+
+ /* Statistics Counters */
+ union {
+ uint64_t counter[VST_MAX_COUNTERS];
+ struct {
+ uint64_t send_calls;
+ uint64_t bytes_sent;
+ uint64_t recv_calls;
+ uint64_t bytes_received;
+ uint64_t trans_sent;
+ uint64_t trans_received;
+ uint64_t connect_calls;
+ uint64_t accepts;
+ } named;
+ } stats;
+ struct timeval elapsed_time;
+ struct timeval prev_time;
+ struct timeval curr_time;
+
+ /* Place for HISTOGRAM fields */
+ HIST time_hist;
+} vst_data_t;
+
+typedef struct vst_results_data {
+ int max_count;
+ int print_test;
+ int print_run;
+ FILE *outfd;
+ double *results;
+ double *xmit_results;
+ double *recv_results;
+ double *trans_results;
+ double *utilization;
+ double *servdemand;
+ double *run_time;
+ double ave_time;
+ double result_measured_mean;
+ double result_interval;
+ double result_confidence;
+ double result_minimum;
+ double result_maximum;
+ double xmit_measured_mean;
+ double xmit_interval;
+ double recv_measured_mean;
+ double recv_interval;
+ double cpu_util_measured_mean;
+ double cpu_util_interval;
+ double cpu_util_confidence;
+ double service_demand_measured_mean;
+ double service_demand_interval;
+ double service_demand_confidence;
+ double confidence;
+ double sd_denominator;
+ double results_start; /* must be the last field in structure */
+} vst_results_t;
+
+/* Error codes to be used within nettest_vst */
+enum {
+ VSTE_MAX_ERROR = -32,
+ VSTE_SOCKET_SHUTDOWN_FAILED,
+ VSTE_BIND_FAILED,
+ VSTE_GETADDRINFO_ERROR,
+ VSTE_XMLSETPROP_ERROR,
+ VSTE_XMLNEWNODE_ERROR,
+ VSTE_NO_SOCKET_ARGS,
+ VSTE_SOCKET_ERROR,
+ VSTE_SETSOCKOPT_ERROR,
+ VSTE_LISTEN_FAILED,
+ VSTE_GETSOCKNAME_FAILED,
+ VSTE_REQUESTED_STATE_INVALID,
+ VSTE_ACCEPT_FAILED,
+ VSTE_DATA_RECV_ERROR,
+ VSTE_TEST_STATE_CORRUPTED,
+ VSTE_CONNECT_FAILED,
+ VSTE_DATA_SEND_ERROR,
+ VSTE_DATA_CONNECTION_CLOSED_ERROR,
+ VSTE_MALLOC_FAILED,
+ VSTE_SUCCESS = 0
+};
More information about the netperf-dev
mailing list