From 5ba1cb20fe6f6699cef1cc726718e760cd4c9af1 Mon Sep 17 00:00:00 2001 From: Martin Lucina Date: Mon, 23 Jan 2012 08:53:25 +0100 Subject: Imported Upstream version 2.0.9.dfsg --- perf/Makefile.am | 9 +++--- perf/Makefile.in | 22 +++++++------- perf/helpers.cpp | 86 ----------------------------------------------------- perf/helpers.h | 40 ------------------------- perf/local_lat.cpp | 4 +-- perf/local_thr.cpp | 8 ++--- perf/remote_lat.cpp | 6 ++-- perf/remote_thr.cpp | 6 ++-- 8 files changed, 26 insertions(+), 155 deletions(-) delete mode 100644 perf/helpers.cpp delete mode 100644 perf/helpers.h (limited to 'perf') diff --git a/perf/Makefile.am b/perf/Makefile.am index 323c91a..bf3dde9 100644 --- a/perf/Makefile.am +++ b/perf/Makefile.am @@ -1,16 +1,15 @@ INCLUDES = -I$(top_builddir)/include noinst_PROGRAMS = local_lat remote_lat local_thr remote_thr -EXTRA_DIST = helpers.h local_lat_LDADD = $(top_builddir)/src/libzmq.la -local_lat_SOURCES = local_lat.cpp helpers.cpp +local_lat_SOURCES = local_lat.cpp remote_lat_LDADD = $(top_builddir)/src/libzmq.la -remote_lat_SOURCES = remote_lat.cpp helpers.cpp +remote_lat_SOURCES = remote_lat.cpp local_thr_LDADD = $(top_builddir)/src/libzmq.la -local_thr_SOURCES = local_thr.cpp helpers.cpp +local_thr_SOURCES = local_thr.cpp remote_thr_LDADD = $(top_builddir)/src/libzmq.la -remote_thr_SOURCES = remote_thr.cpp helpers.cpp +remote_thr_SOURCES = remote_thr.cpp diff --git a/perf/Makefile.in b/perf/Makefile.in index ed9e5d7..8eba409 100644 --- a/perf/Makefile.in +++ b/perf/Makefile.in @@ -48,16 +48,16 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/src/platform.hpp CONFIG_CLEAN_FILES = PROGRAMS = $(noinst_PROGRAMS) -am_local_lat_OBJECTS = local_lat.$(OBJEXT) helpers.$(OBJEXT) +am_local_lat_OBJECTS = local_lat.$(OBJEXT) local_lat_OBJECTS = $(am_local_lat_OBJECTS) local_lat_DEPENDENCIES = $(top_builddir)/src/libzmq.la -am_local_thr_OBJECTS = local_thr.$(OBJEXT) helpers.$(OBJEXT) +am_local_thr_OBJECTS = local_thr.$(OBJEXT) local_thr_OBJECTS = $(am_local_thr_OBJECTS) local_thr_DEPENDENCIES = $(top_builddir)/src/libzmq.la -am_remote_lat_OBJECTS = remote_lat.$(OBJEXT) helpers.$(OBJEXT) +am_remote_lat_OBJECTS = remote_lat.$(OBJEXT) remote_lat_OBJECTS = $(am_remote_lat_OBJECTS) remote_lat_DEPENDENCIES = $(top_builddir)/src/libzmq.la -am_remote_thr_OBJECTS = remote_thr.$(OBJEXT) helpers.$(OBJEXT) +am_remote_thr_OBJECTS = remote_thr.$(OBJEXT) remote_thr_OBJECTS = $(am_remote_thr_OBJECTS) remote_thr_DEPENDENCIES = $(top_builddir)/src/libzmq.la DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src @@ -211,15 +211,14 @@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ INCLUDES = -I$(top_builddir)/include -EXTRA_DIST = helpers.h local_lat_LDADD = $(top_builddir)/src/libzmq.la -local_lat_SOURCES = local_lat.cpp helpers.cpp +local_lat_SOURCES = local_lat.cpp remote_lat_LDADD = $(top_builddir)/src/libzmq.la -remote_lat_SOURCES = remote_lat.cpp helpers.cpp +remote_lat_SOURCES = remote_lat.cpp local_thr_LDADD = $(top_builddir)/src/libzmq.la -local_thr_SOURCES = local_thr.cpp helpers.cpp +local_thr_SOURCES = local_thr.cpp remote_thr_LDADD = $(top_builddir)/src/libzmq.la -remote_thr_SOURCES = remote_thr.cpp helpers.cpp +remote_thr_SOURCES = remote_thr.cpp all: all-am .SUFFIXES: @@ -233,9 +232,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu perf/Makefile'; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign perf/Makefile'; \ cd $(top_srcdir) && \ - $(AUTOMAKE) --gnu perf/Makefile + $(AUTOMAKE) --foreign perf/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -279,7 +278,6 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/helpers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local_lat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local_thr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote_lat.Po@am__quote@ diff --git a/perf/helpers.cpp b/perf/helpers.cpp deleted file mode 100644 index 94b653f..0000000 --- a/perf/helpers.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/* - Copyright (c) 2007-2010 iMatix Corporation - - This file is part of 0MQ. - - 0MQ is free software; you can redistribute it and/or modify it under - the terms of the Lesser GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - 0MQ 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 - Lesser GNU General Public License for more details. - - You should have received a copy of the Lesser GNU General Public License - along with this program. If not, see . -*/ - -#include -#include -#ifdef _WIN32 -# include "../src/windows.hpp" -#else -# include -# include -#endif -#include "../src/stdint.hpp" - -#ifdef _WIN32 - -static uint64_t now () -{ - // Get the high resolution counter's accuracy. - LARGE_INTEGER ticksPerSecond; - QueryPerformanceFrequency (&ticksPerSecond); - - // What time is it? - LARGE_INTEGER tick; - QueryPerformanceCounter (&tick); - - // Convert the tick number into the number of seconds - // since the system was started. - double ticks_div = (double) (ticksPerSecond.QuadPart / 1000000); - return (uint64_t) (tick.QuadPart / ticks_div); -} - -void perf_sleep (int seconds_) -{ - Sleep (seconds_ * 1000); -} - -#else /* not _WIN32 */ - -static uint64_t now () -{ - struct timeval tv; - int rc; - - rc = gettimeofday (&tv, NULL); - assert (rc == 0); - return (tv.tv_sec * (uint64_t) 1000000 + tv.tv_usec); -} - -void perf_sleep (int seconds_) -{ - sleep (seconds_); -} - -#endif /* _WIN32 */ - -void *stopwatch_start () -{ - uint64_t *watch = (uint64_t*) malloc (sizeof (uint64_t)); - assert (watch); - *watch = now (); - return (void*) watch; -} - -unsigned long stopwatch_stop (void *watch_) -{ - uint64_t end = now (); - uint64_t start = *(uint64_t*) watch_; - free (watch_); - return (unsigned long) (end - start); -} diff --git a/perf/helpers.h b/perf/helpers.h deleted file mode 100644 index b790f59..0000000 --- a/perf/helpers.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (c) 2007-2010 iMatix Corporation - - This file is part of 0MQ. - - 0MQ is free software; you can redistribute it and/or modify it under - the terms of the Lesser GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - 0MQ 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 - Lesser GNU General Public License for more details. - - You should have received a copy of the Lesser GNU General Public License - along with this program. If not, see . -*/ - -#ifndef __HELPERS_H_INCLUDED__ -#define __HELPERS_H_INCLUDED__ - -/******************************************************************************/ -/* Helper functions. */ -/******************************************************************************/ - -/* Helper functions are used by perf tests so that they don't have to care */ -/* about minutiae of time-related functions on different OS platforms. */ - -/* Starts the stopwatch. Returns the handle to the watch. */ -void *stopwatch_start (); - -/* Stops the stopwatch. Returns the number of microseconds elapsed since */ -/* the stopwatch was started. */ -unsigned long stopwatch_stop (void *watch_); - -/* Sleeps for specified number of seconds. */ -void perf_sleep (int seconds_); - -#endif diff --git a/perf/local_lat.cpp b/perf/local_lat.cpp index 0628a97..4db756d 100644 --- a/perf/local_lat.cpp +++ b/perf/local_lat.cpp @@ -18,9 +18,9 @@ */ #include "../include/zmq.h" +#include "../include/zmq_utils.h" #include #include -#include "helpers.h" int main (int argc, char *argv []) { @@ -89,7 +89,7 @@ int main (int argc, char *argv []) return -1; } - perf_sleep (1); + zmq_sleep (1); rc = zmq_close (s); if (rc != 0) { diff --git a/perf/local_thr.cpp b/perf/local_thr.cpp index 8480ebd..016826b 100644 --- a/perf/local_thr.cpp +++ b/perf/local_thr.cpp @@ -18,9 +18,9 @@ */ #include "../include/zmq.h" +#include "../include/zmq_utils.h" #include #include -#include "helpers.h" int main (int argc, char *argv []) { @@ -47,7 +47,7 @@ int main (int argc, char *argv []) ctx = zmq_init (1); if (!ctx) { - printf ("error in zmq_send: %s\n", zmq_strerror (errno)); + printf ("error in zmq_init: %s\n", zmq_strerror (errno)); return -1; } @@ -88,7 +88,7 @@ int main (int argc, char *argv []) return -1; } - watch = stopwatch_start (); + watch = zmq_stopwatch_start (); for (i = 0; i != message_count - 1; i++) { rc = zmq_recv (s, &msg, 0); @@ -102,7 +102,7 @@ int main (int argc, char *argv []) } } - elapsed = stopwatch_stop (watch); + elapsed = zmq_stopwatch_stop (watch); if (elapsed == 0) elapsed = 1; diff --git a/perf/remote_lat.cpp b/perf/remote_lat.cpp index cd465f7..37535e6 100644 --- a/perf/remote_lat.cpp +++ b/perf/remote_lat.cpp @@ -18,10 +18,10 @@ */ #include "../include/zmq.h" +#include "../include/zmq_utils.h" #include #include #include -#include "helpers.h" int main (int argc, char *argv []) { @@ -71,7 +71,7 @@ int main (int argc, char *argv []) } memset (zmq_msg_data (&msg), 0, message_size); - watch = stopwatch_start (); + watch = zmq_stopwatch_start (); for (i = 0; i != roundtrip_count; i++) { rc = zmq_send (s, &msg, 0); @@ -90,7 +90,7 @@ int main (int argc, char *argv []) } } - elapsed = stopwatch_stop (watch); + elapsed = zmq_stopwatch_stop (watch); rc = zmq_msg_close (&msg); if (rc != 0) { diff --git a/perf/remote_thr.cpp b/perf/remote_thr.cpp index 002aaf2..1e69601 100644 --- a/perf/remote_thr.cpp +++ b/perf/remote_thr.cpp @@ -18,9 +18,9 @@ */ #include "../include/zmq.h" +#include "../include/zmq_utils.h" #include #include -#include "helpers.h" int main (int argc, char *argv []) { @@ -44,7 +44,7 @@ int main (int argc, char *argv []) ctx = zmq_init (1); if (!ctx) { - printf ("error in zmq_recv: %s\n", zmq_strerror (errno)); + printf ("error in zmq_init: %s\n", zmq_strerror (errno)); return -1; } @@ -81,7 +81,7 @@ int main (int argc, char *argv []) } } - perf_sleep (10); + zmq_sleep (10); rc = zmq_close (s); if (rc != 0) { -- cgit v1.2.3