[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] New version of mingw patch with working createfilemap
From: |
Martin Dvh |
Subject: |
[Discuss-gnuradio] New version of mingw patch with working createfilemapping and resolved backslash problems |
Date: |
Wed, 20 Jul 2005 15:43:43 +0200 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030823 |
Hi all,
For some reason not the latest version of src/lib/swig/Makefile.am was included
in my patches.
(I think I accidently edited Makefile and not Makefile.am, so it was
overwritted with a new build)
So I made a new set of patches (this also includes the version of gr_python.m4
which workes on mingw, see my last mail)
If you already ran my previous patches you only need this little Patch:
--- gnuradio-core-mingw/src/lib/swig/Makefile.am Wed Jul 20 02:11:59 2005
+++ gnuradio-core-mingw2/src/lib/swig/Makefile.am Wed Jul 20 15:08:01 2005
@@ -80,7 +80,7 @@
gnuradio_swig_python.cc gnuradio_swig_python.py : gnuradio.i
if $(SWIG) $(SWIGCPPPYTHONARGS) -MMD -MF "$*.Td" -module
gnuradio_swig_python -o gnuradio_swig_python.cc $< ;\
- then if test $host_os = mingw32; \
+ then if test $(host_os) = mingw32; \
then cat "$*.Td" | sed 's,\\\\,/,g' >"$*.d"; rm -f "$*.Td"; \
else mv -f "$*.Td" "$*.d"; fi \
else rm -f "$*.Td"; exit 1; fi
Sorry about this patch on patch. I am not that experienced in patch releases.
(And every rebuild takes me several hours because there is no ccache for mingw)
Greetings,
Martin
Martin Dvh wrote:
> Hi all,
> I have been busy trying to get the mingw patches ready for integration
> with gnuradio-core.
> Here are the result(see attached patches).
> I also wrote a new short readme because a lot of the required configure
> parameters are not needed anymore.(see attached readme)
>
> I have put in checks so the new mingw hacks are only executed on mingw.
> We have to check if cross-compiling still works.
>
> I added a working lib/runtime/gr_vmcircbuf_createfilemapping which
> searches for a working second_copy like the gr_vmcircbuf_mmap_tmpfile.cc
> does.
> (First it tries to use CreateMapOfFileEx with the adress of the wanted
> second copy as a parameter, if this doesn't work it tries several times
> without the parameter and checks if the second copy is at the wanted
> adress.
>
> I added some additional code to gr_python.m4 to get rid of all remaining
> backslash problems in python pathnames.
> I put it in a section which is only executed on mingw (case host_os in
> mingw*)
> (No more python related patchnames required as ./configure parameters.)
>
> I put a check for sys/resource.h in configure.ac and changed the timing
> code in the benchmarks to work on mingw (added ifdef HAVE_SYS_RESOURCE_H
> code)
>
> I added code in lib/swig/Makefile.am to change backslashes in forward
> slashes in gnuradio_swig_python.d
> This is only executed on ming32 (maybe someone knows of a better way to
> do this)
>
> The only thing that still barkes at make check is gr_circular_file
> I haven't changed gr_circular_file to use createfilemapping code, since
> it is not used (at the moment)
> so qa_gr_circular_file is the only thing which still fails at make check
> (see make_check_stderr.log)
>
> ....... gr_vmcircbuf_createfilemapping_factory: OK
> ...................qa_gr_circular_file.data: file too small to be
> circular buffer
>
> Short build instructions for mingw:
> All python/fftw/swig/cppunit executables AND dlls have to be on the PATH
> Make sure NO cygwin executables are on the PATH (especially cygwins swig
> and python)
> Make sure you use latest libtool and its libtool.m4 macros
>
> configure on msys/mingw with a commandline like:
> ./configure --with-md-cpu=generic --with-cppunit-prefix=/usr/local
> --with-boost-include-dir=/c/boost_1_32_0/include/boost-1_32
> PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
>
> Greetings,
> Martin
>
>
diff -urN gnuradio-core-cvs/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
gnuradio-core-mingw/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
--- gnuradio-core-cvs/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc Thu Jan
1 01:00:00 1970
+++ gnuradio-core-mingw/src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
Wed Jul 20 02:09:26 2005
@@ -0,0 +1,221 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+#include <gr_vmcircbuf_createfilemapping.h>
+#include <stdexcept>
+#include <assert.h>
+#include <unistd.h>
+#include <fcntl.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+#include <errno.h>
+#include <stdio.h>
+#include <gr_pagesize.h>
+#include <gr_tmp_path.h>
+
+
+static int s_seg_counter = 0;
+
+gr_vmcircbuf_createfilemapping::gr_vmcircbuf_createfilemapping (int size)
+ : gr_vmcircbuf (size)
+{
+#if !defined(HAVE_CREATEFILEMAPPING)
+ fprintf (stderr, "%s: createfilemapping is not available\n",__FUNCTION__);
+ throw std::runtime_error ("gr_vmcircbuf_createfilemapping");
+#else
+ if (size <= 0 || (size % gr_pagesize ()) != 0)
+ {
+ fprintf (stderr, "gr_vmcircbuf_createfilemapping: invalid size = %d\n",
size);
+ throw std::runtime_error ("gr_vmcircbuf_createfilemapping");
+ }
+ char seg_name[1024];
+ snprintf (seg_name, sizeof (seg_name),
+ "/gnuradio-%d-%d", getpid (), s_seg_counter);
+ d_handle = CreateFileMapping(
+ INVALID_HANDLE_VALUE, // use paging file
+ NULL, // default security
+ PAGE_READWRITE, // read/write access
+ 0, // max. object size
+ size, // buffer size
+ seg_name); // name of mapping object
+
+ s_seg_counter++;
+ if (d_handle == NULL || d_handle == INVALID_HANDLE_VALUE)
+ {
+ char msg[1024];
+ snprintf (msg, sizeof (msg), "gr_vmcircbuf_mmap_createfilemapping:
CreateFileMapping [%s] :%d", seg_name,GetLastError());
+ perror (msg);
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+ d_first_copy = MapViewOfFile((HANDLE)d_handle, // handle to map object
+ FILE_MAP_WRITE,//FILE_MAP_ALL_ACCESS, // read/write
permission
+ 0,
+ 0,
+ size);
+ if (d_first_copy == NULL)
+ {
+ CloseHandle(d_handle); // cleanup
+ char msg[1024];
+ snprintf (msg, sizeof (msg), "gr_vmcircbuf_mmap_createfilemapping:
MapViewOfFile (1) :%d", GetLastError());
+ perror (msg);
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+ d_second_copy = MapViewOfFileEx((HANDLE)d_handle, // handle to map object
+ FILE_MAP_WRITE, // read/write permission
+ 0,
+ 0,
+ size,
+ (char *)d_first_copy + size);//(LPVOID) ((char
*)d_first_copy + size));
+ //CloseHandle(d_handle); // is d_handle still needed ? Is the mapping
retained if the handle is closed?
+ if (((char *) d_first_copy + size) != (char *)d_second_copy)
+ {
+ UnmapViewOfFile(d_first_copy);
+ if(d_second_copy!=NULL) UnmapViewOfFile(d_second_copy);
+ d_first_copy = MapViewOfFile((HANDLE)d_handle, // handle to map object
+ FILE_MAP_WRITE, // read/write permission
+ 0,
+ 0,
+ size);
+
+ if (d_first_copy == NULL)
+ {
+ CloseHandle(d_handle); // cleanup
+ char msg[1024];
+ snprintf (msg, sizeof (msg), "gr_vmcircbuf_mmap_createfilemapping:
MapViewOfFile (2) :%d", GetLastError());
+ perror (msg);
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+ int i;
+
+ for (i=0; i<8; i++)
+ {
+ d_second_copy = MapViewOfFile((HANDLE)d_handle, // handle to map
object
+ FILE_MAP_WRITE, // read/write permission
+ 0,
+ 0,
+ size);
+
+ if (d_second_copy == NULL)
+ {
+ char msg[1024];
+ snprintf (msg, sizeof (msg), "gr_vmcircbuf_mmap_createfilemapping:
MapViewOfFile (3) :%d", GetLastError());
+ perror (msg);
+ fprintf (stderr,"gr_vmcircbuf_mmap_createfilemapping: %p %p %p %p\n",
+ (char *)d_first_copy, (char *)d_second_copy, size, (char
*)d_first_copy + size);
+ UnmapViewOfFile(d_first_copy);
+ CloseHandle(d_handle); // cleanup
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+ if (((char *) d_first_copy + size) == (char *)d_second_copy)
+ break;
+
+ UnmapViewOfFile(d_first_copy);
+ d_first_copy = d_second_copy;
+ }
+
+ if (i!=0) fprintf (stderr,"gr_vmcircbuf_mmap_createfilemapping:
contiguous? mmap %p %p %p %p, %d\n",
+ (char *)d_first_copy, (char *)d_second_copy, size, (char
*)d_first_copy + size,i);
+
+ if (((char *) d_first_copy + size) != (char *)d_second_copy)
+ {
+ // cleanup
+ fprintf (stderr,"gr_vmcircbuf_mmap_createfilemapping: non contiguous
mmap %p %p %p %p\n",
+ (char *)d_first_copy, (char *)d_second_copy, size, (char
*)d_first_copy + size);
+ UnmapViewOfFile(d_first_copy);
+ UnmapViewOfFile(d_second_copy);
+ CloseHandle(d_handle); // cleanup
+ throw std::runtime_error ("gr_vmcircbuf_mmap_createfilemapping");
+ }
+ }
+ // Now remember the important stuff
+ d_base = (char *) d_first_copy;
+ //d_second =(char *) d_second_copy;
+ d_size = size;
+#endif /*HAVE_CREATEFILEMAPPING*/
+}
+
+gr_vmcircbuf_createfilemapping::~gr_vmcircbuf_createfilemapping ()
+{
+#ifdef HAVE_CREATEFILEMAPPING
+ if (UnmapViewOfFile(d_first_copy) == 0)
+ {
+ perror ("gr_vmcircbuf_createfilemapping: UnmapViewOfFile(d_first_copy)");
+ }
+ d_base=NULL;
+ if (UnmapViewOfFile(d_second_copy) == 0)
+ {
+ perror ("gr_vmcircbuf_createfilemapping: UnmapViewOfFile(d_second_copy)");
+ }
+ //d_second=NULL;
+ CloseHandle(d_handle);
+#endif
+}
+
+// ----------------------------------------------------------------
+// The factory interface
+// ----------------------------------------------------------------
+
+
+gr_vmcircbuf_factory *gr_vmcircbuf_createfilemapping_factory::s_the_factory =
0;
+
+gr_vmcircbuf_factory *
+gr_vmcircbuf_createfilemapping_factory::singleton ()
+{
+ if (s_the_factory)
+ return s_the_factory;
+ s_the_factory = new gr_vmcircbuf_createfilemapping_factory ();
+ return s_the_factory;
+}
+
+int
+gr_vmcircbuf_createfilemapping_factory::granularity ()
+{
+#ifdef HAVE_CREATEFILEMAPPING
+ // return 65536;//TODO, check, is this needed or can we just use
gr_pagesize()
+ SYSTEM_INFO system_info;
+ GetSystemInfo(&system_info);
+ //fprintf(stderr,"win32 AllocationGranularity
%p\n",(int)system_info.dwAllocationGranularity);
+ return (int)system_info.dwAllocationGranularity;
+#else
+ return gr_pagesize ();
+#endif
+}
+
+gr_vmcircbuf *
+gr_vmcircbuf_createfilemapping_factory::make (int size)
+{
+ try
+ {
+ return new gr_vmcircbuf_createfilemapping (size);
+ }
+ catch (...)
+ {
+ return 0;
+ }
+}
diff -urN gnuradio-core-cvs/src/lib/runtime/gr_vmcircbuf_createfilemapping.h
gnuradio-core-mingw/src/lib/runtime/gr_vmcircbuf_createfilemapping.h
--- gnuradio-core-cvs/src/lib/runtime/gr_vmcircbuf_createfilemapping.h Thu Jan
1 01:00:00 1970
+++ gnuradio-core-mingw/src/lib/runtime/gr_vmcircbuf_createfilemapping.h
Wed Jul 20 02:09:26 2005
@@ -0,0 +1,76 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2003 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio 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, or (at your option)
+ * any later version.
+ *
+ * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef _GR_VMCIRCBUF_CREATEFILEMAPPING_H_
+#define _GR_VMCIRCBUF_CREATEFILEMAPPING_H_
+
+#include <gr_vmcircbuf.h>
+
+#ifdef HAVE_CREATEFILEMAPPING
+#include <windows.h>
+#include <stdio.h>
+#include <conio.h>
+#endif
+/*!
+ * \brief concrete class to implement circular buffers with mmap and shm_open
+ */
+class gr_vmcircbuf_createfilemapping : public gr_vmcircbuf
+{
+ public:
+ // CREATORS
+ gr_vmcircbuf_createfilemapping (int size);
+ virtual ~gr_vmcircbuf_createfilemapping ();
+#ifdef HAVE_CREATEFILEMAPPING
+ private:
+ HANDLE d_handle;
+ LPVOID d_first_copy;
+ LPVOID d_second_copy;
+#endif
+};
+
+/*!
+ * \brief concrete factory for circular buffers built using mmap and shm_open
+ */
+class gr_vmcircbuf_createfilemapping_factory : public gr_vmcircbuf_factory
+{
+ private:
+ static gr_vmcircbuf_factory *s_the_factory;
+
+ public:
+ static gr_vmcircbuf_factory *singleton ();
+
+ virtual const char *name () const { return
"gr_vmcircbuf_createfilemapping_factory"; }
+
+ /*!
+ * \brief return granularity of mapping, typically equal to page size
+ */
+ virtual int granularity ();
+
+ /*!
+ * \brief return a gr_vmcircbuf, or 0 if unable.
+ *
+ * Call this to create a doubly mapped circular buffer.
+ */
+ virtual gr_vmcircbuf *make (int size);
+};
+
+#endif /* _GR_VMCIRCBUF_CREATEFILEMAPPING_H_ */
? bootstrap-mdvh
? src/lib/runtime/gr_vmcircbuf_createfilemapping.cc
? src/lib/runtime/gr_vmcircbuf_createfilemapping.h
Index: configure.ac
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/configure.ac,v
retrieving revision 1.38
diff -u -r1.38 configure.ac
--- configure.ac 14 Jul 2005 01:41:55 -0000 1.38
+++ configure.ac 20 Jul 2005 13:17:46 -0000
@@ -81,6 +81,7 @@
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h strings.h time.h sys/ioctl.h sys/time.h
unistd.h)
AC_CHECK_HEADERS(linux/ppdev.h sys/mman.h sys/select.h sys/types.h)
+AC_CHECK_HEADERS(sys/resource.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
Index: config/gr_python.m4
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/config/gr_python.m4,v
retrieving revision 1.6
diff -u -r1.6 gr_python.m4
--- config/gr_python.m4 19 Jul 2005 01:11:19 -0000 1.6
+++ config/gr_python.m4 20 Jul 2005 13:17:48 -0000
@@ -1,5 +1,5 @@
dnl
-dnl Copyright 2003,2004,2005 Free Software Foundation, Inc.
+dnl Copyright 2003 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Radio
dnl
@@ -25,11 +25,10 @@
# It provides the $(PYTHON_CPPFLAGS) output variable.
AC_DEFUN([PYTHON_DEVEL],[
AC_REQUIRE([AM_PATH_PYTHON])
+ AC_REQUIRE([AC_CANONICAL_HOST])
# Check for Python include path
- AC_CACHE_CHECK([for Python include path],
- cv_python_path,
- [
+ AC_MSG_CHECKING([for Python include path])
if test -z "$PYTHON" ; then
AC_MSG_ERROR([cannot find Python path])
fi
@@ -43,13 +42,13 @@
path = path.replace("\\", "/")
print path
'
- cv_python_path=`$PYTHON -c "$python_cmd"`
- if test -z "$cv_python_path" ; then
+ python_path=`$PYTHON -c "$python_cmd"`
+ AC_MSG_RESULT([$python_path])
+ if test -z "$python_path" ; then
AC_MSG_ERROR([cannot find Python include path])
fi
- ])
- AC_SUBST(PYTHON_CPPFLAGS,[-I$cv_python_path])
+ AC_SUBST(PYTHON_CPPFLAGS,[-I$python_path])
# Check for Python headers usability
python_save_CPPFLAGS=$CPPFLAGS
@@ -60,28 +59,67 @@
# The block below is commented out because it breaks the x86-64 and
OS/X build.
- # set these to null for now
+ # Only set this on mingw target, (only implemented for mingw host, for
crosscompiling you need to trick this)
PYTHON_LDFLAGS=""
+ case $host_os in
+ *mingw* )
+ AC_MSG_CHECKING([for Python LDFLAGS])
+ python_cmd='
+import distutils.sysconfig
+import os
+path = distutils.sysconfig.PREFIX + "/libs"
+if os.sep == "\\":
+ path = path.replace("\\", "/")
+print path
+'
+ python_stdlib_path=`$PYTHON -c "$python_cmd"`
+ python_version_nodot=`echo $PYTHON_VERSION | sed "s,\.,,"`
+ libpython_name="python$PYTHON_VERSION"
+ # Standard install of python for win32 has libpython24.a in stead of
libpython2.4.a so we check for the library without the dot in the
versionnumber.
+ python_stdlib_filename=`find $python_stdlib_path -type f -name
libpython$python_version_nodot.* -print | sed "1q"`
+ if test -n "$python_stdlib_filename" ; then
+ libpython_name="python$python_version_nodot"
+ fi
+ PYTHON_LDFLAGS="-L$python_stdlib_path -l$libpython_name"
+ AC_MSG_RESULT($PYTHON_LDFLAGS)
+ # Replace all backslashes in PYTHON Paths with forward slashes
+ AC_MSG_CHECKING([for pythondir])
+ pythondir=`echo $pythondir |sed 's,\\\\,/,g'`
+ AC_MSG_RESULT($pythondir)
+ AC_SUBST([pythondir])
+ AC_MSG_CHECKING([for pkgpythondir])
+ pkgpythondir=`echo $pkgpythondir |sed 's,\\\\,/,g'`
+ AC_MSG_RESULT($pkgpythondir)
+ AC_SUBST([pkgpythondir])
+ AC_MSG_CHECKING([for pyexecdir])
+ pyexecdir=`echo $pyexecdir |sed 's,\\\\,/,g'`
+ AC_MSG_RESULT($pyexecdir)
+ AC_SUBST([pyexecdir])
+ AC_MSG_CHECKING([for pkgpyexecdir])
+ pkgpyexecdir=`echo $pkgpyexecdir |sed 's,\\\\,/,g'`
+ AC_MSG_RESULT($pkgpyexecdir)
+ AC_SUBST([pkgpyexecdir])
+ esac
AC_SUBST([PYTHON_LDFLAGS])
dnl # Check for Python library path
dnl AC_MSG_CHECKING([for Python library path])
-dnl cv_python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
-dnl for i in "$cv_python_path/lib/python$PYTHON_VERSION/config/"
"$cv_python_path/lib/python$PYTHON_VERSION/"
"$cv_python_path/lib/python/config/" "$cv_python_path/lib/python/"
"$cv_python_path/" "$cv_python_path/libs" ; do
-dnl cv_python_path=`find $i -type f -name
libpython$PYTHON_VERSION.* -print | sed "1q"`
-dnl if test -n "$cv_python_path" ; then
+dnl python_path=`echo $PYTHON | sed "s,/bin.*$,,"`
+dnl for i in "$python_path/lib/python$PYTHON_VERSION/config/"
"$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/"
"$python_path/lib/python/" "$python_path/" "$python_path/libs" ; do
+dnl python_path=`find $i -type f -name libpython$PYTHON_VERSION.*
-print | sed "1q"`
+dnl if test -n "$python_path" ; then
dnl break
dnl fi
dnl done
-dnl cv_python_path=`echo $cv_python_path | sed "s,/libpython.*$,,"`
-dnl if test -z "$cv_python_path" ; then
+dnl python_path=`echo $python_path | sed "s,/libpython.*$,,"`
+dnl if test -z "$python_path" ; then
dnl AC_MSG_WARN(cannot find Python library path)
dnl fi
-dnl AC_MSG_RESULT([$cv_python_path])
+dnl AC_MSG_RESULT([$python_path])
dnl
-dnl AC_SUBST([PYTHON_LDFLAGS],["-L$cv_python_path -lpython$PYTHON_VERSION"])
+dnl AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -lpython$PYTHON_VERSION"])
dnl #
-dnl python_site=`echo $cv_python_path | sed "s/config/site-packages/"`
+dnl python_site=`echo $python_path | sed "s/config/site-packages/"`
dnl AC_SUBST([PYTHON_SITE_PKG],[$python_site])
dnl #
dnl # libraries which must be linked in when embedding
Index: src/lib/runtime/Makefile.am
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/lib/runtime/Makefile.am,v
retrieving revision 1.9
diff -u -r1.9 Makefile.am
--- src/lib/runtime/Makefile.am 16 Jun 2005 17:41:25 -0000 1.9
+++ src/lib/runtime/Makefile.am 20 Jul 2005 13:18:06 -0000
@@ -47,6 +47,7 @@
gr_vmcircbuf.cc \
gr_vmcircbuf_mmap_shm_open.cc \
gr_vmcircbuf_mmap_tmpfile.cc \
+ gr_vmcircbuf_createfilemapping.cc \
gr_vmcircbuf_sysv_shm.cc \
gr_select_handler.cc
@@ -83,6 +84,7 @@
gr_vmcircbuf_mmap_shm_open.h \
gr_vmcircbuf_mmap_tmpfile.h \
gr_vmcircbuf_sysv_shm.h \
+ gr_vmcircbuf_createfilemapping.h \
qa_gr_block.h \
qa_gr_buffer.h \
qa_gr_io_signature.h \
Index: src/lib/runtime/gr_vmcircbuf.cc
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/lib/runtime/gr_vmcircbuf.cc,v
retrieving revision 1.7
diff -u -r1.7 gr_vmcircbuf.cc
--- src/lib/runtime/gr_vmcircbuf.cc 9 May 2005 21:10:55 -0000 1.7
+++ src/lib/runtime/gr_vmcircbuf.cc 20 Jul 2005 13:18:06 -0000
@@ -31,6 +31,7 @@
#include <gr_local_sighandler.h>
// all the factories we know about
+#include <gr_vmcircbuf_createfilemapping.h>
#include <gr_vmcircbuf_sysv_shm.h>
#include <gr_vmcircbuf_mmap_shm_open.h>
#include <gr_vmcircbuf_mmap_tmpfile.h>
@@ -97,6 +98,7 @@
{
std::vector<gr_vmcircbuf_factory *> result;
+ result.push_back (gr_vmcircbuf_createfilemapping_factory::singleton ());
result.push_back (gr_vmcircbuf_sysv_shm_factory::singleton ());
result.push_back (gr_vmcircbuf_mmap_shm_open_factory::singleton ());
result.push_back (gr_vmcircbuf_mmap_tmpfile_factory::singleton ());
Index: src/lib/swig/Makefile.am
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/lib/swig/Makefile.am,v
retrieving revision 1.17
diff -u -r1.17 Makefile.am
--- src/lib/swig/Makefile.am 3 Jul 2005 05:52:24 -0000 1.17
+++ src/lib/swig/Makefile.am 20 Jul 2005 13:18:06 -0000
@@ -80,7 +80,10 @@
gnuradio_swig_python.cc gnuradio_swig_python.py : gnuradio.i
if $(SWIG) $(SWIGCPPPYTHONARGS) -MMD -MF "$*.Td" -module
gnuradio_swig_python -o gnuradio_swig_python.cc $< ;\
- then mv -f "$*.Td" "$*.d"; else rm -f "$*.Td"; exit 1; fi
+ then if test $(host_os) = mingw32; \
+ then cat "$*.Td" | sed 's,\\\\,/,g' >"$*.d"; rm -f "$*.Td"; \
+ else mv -f "$*.Td" "$*.d"; fi \
+ else rm -f "$*.Td"; exit 1; fi
gnuradio_swig_bug_workaround.h : gnuradio_swig_python.cc
$(srcdir)/gen-swig-bug-fix $< $@
Index: src/tests/benchmark_dotprod.cc
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/tests/benchmark_dotprod.cc,v
retrieving revision 1.1
diff -u -r1.1 benchmark_dotprod.cc
--- src/tests/benchmark_dotprod.cc 9 Nov 2004 00:29:51 -0000 1.1
+++ src/tests/benchmark_dotprod.cc 20 Jul 2005 13:18:10 -0000
@@ -1,28 +1,33 @@
/* -*- c++ -*- */
/*
* Copyright 2002 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio 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, or (at your option)
* any later version.
- *
+ *
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
+#endif
+
#include <unistd.h>
#include <gr_fir_util.h>
#include <gr_fir_fff.h>
@@ -55,10 +60,13 @@
float input[BLOCK_SIZE + NTAPS];
long n;
float result;
+#ifdef HAVE_SYS_RESOURCE_H
struct rusage rusage_start;
struct rusage rusage_stop;
-
-
+#else
+ double clock_start;
+ double clock_end;
+#endif
// setup coefficients and input data
for (i = 0; i < NTAPS; i++)
@@ -69,14 +77,16 @@
std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
filter_t *f = filter_maker (taps);
-
- // get starting CPU usage
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
perror ("getrusage");
exit (1);
}
-
+#else
+clock_start= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+#endif
// do the actual work
for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
@@ -85,9 +95,9 @@
result = f->filter (&input[j]);
}
}
-
- // get ending CPU usage
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
perror ("getrusage");
exit (1);
@@ -104,7 +114,10 @@
- timeval_to_double (&rusage_start.ru_stime);
double total = user + sys;
-
+#else
+clock_end= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+double total = clock_end -clock_start;
+#endif
double macs = NTAPS * (double) TOTAL_TEST_SIZE;
printf ("%10s: taps: %4d input: %4g cpu: %6.3f taps/sec: %10.4g \n",
@@ -117,7 +130,7 @@
do_all ()
{
std::vector<gr_fir_fff_info> info;
- gr_fir_util::get_gr_fir_fff_info (&info); // get all known FFF
implementations
+ gr_fir_util::get_gr_fir_fff_info (&info); // get all known FFF
implementations
for (std::vector<gr_fir_fff_info>::iterator p = info.begin ();
p != info.end ();
@@ -127,7 +140,7 @@
}
}
-int
+int
main (int argc, char **argv)
{
do_all ();
Index: src/tests/benchmark_dotprod_ccc.cc
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/tests/benchmark_dotprod_ccc.cc,v
retrieving revision 1.2
diff -u -r1.2 benchmark_dotprod_ccc.cc
--- src/tests/benchmark_dotprod_ccc.cc 10 May 2005 01:11:33 -0000 1.2
+++ src/tests/benchmark_dotprod_ccc.cc 20 Jul 2005 13:18:10 -0000
@@ -1,28 +1,32 @@
/* -*- c++ -*- */
/*
* Copyright 2002 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio 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, or (at your option)
* any later version.
- *
+ *
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
+#endif
#include <unistd.h>
#include <gr_fir_util.h>
#include <gr_fir_ccc.h>
@@ -51,32 +55,39 @@
benchmark (fir_maker_t filter_maker, const char *implementation_name)
{
int i;
- gr_complex coeffs[NTAPS];
- gr_complex input[BLOCK_SIZE + NTAPS];
+ float coeffs[NTAPS];
+ float input[BLOCK_SIZE + NTAPS];
long n;
gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
struct rusage rusage_start;
struct rusage rusage_stop;
-
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
// setup coefficients and input data
for (i = 0; i < NTAPS; i++)
- coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+ coeffs[i] = random() - RANDOM_MAX/2;
for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
- input[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+ input[i] = random() - RANDOM_MAX/2;
std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
filter_t *f = filter_maker (taps);
-
- // get starting CPU usage
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
perror ("getrusage");
exit (1);
}
-
+#else
+clock_start= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+#endif
// do the actual work
for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
@@ -85,9 +96,9 @@
result = f->filter ((gr_complex*)&input[j]);
}
}
-
- // get ending CPU usage
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
perror ("getrusage");
exit (1);
@@ -104,6 +115,10 @@
- timeval_to_double (&rusage_start.ru_stime);
double total = user + sys;
+#else
+clock_end= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+double total = clock_end -clock_start;
+#endif
double macs = NTAPS * (double) TOTAL_TEST_SIZE;
@@ -117,7 +132,7 @@
do_all ()
{
std::vector<gr_fir_ccc_info> info;
- gr_fir_util::get_gr_fir_ccc_info (&info); // get all known CCC
implementations
+ gr_fir_util::get_gr_fir_ccc_info (&info); // get all known CCC
implementations
for (std::vector<gr_fir_ccc_info>::iterator p = info.begin ();
p != info.end () ;
@@ -126,7 +141,7 @@
}
}
-int
+int
main (int argc, char **argv)
{
do_all ();
Index: src/tests/benchmark_dotprod_ccf.cc
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/tests/benchmark_dotprod_ccf.cc,v
retrieving revision 1.1
diff -u -r1.1 benchmark_dotprod_ccf.cc
--- src/tests/benchmark_dotprod_ccf.cc 10 May 2005 01:38:19 -0000 1.1
+++ src/tests/benchmark_dotprod_ccf.cc 20 Jul 2005 13:18:10 -0000
@@ -1,28 +1,32 @@
/* -*- c++ -*- */
/*
* Copyright 2002 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio 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, or (at your option)
* any later version.
- *
+ *
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
+#endif
#include <unistd.h>
#include <gr_fir_util.h>
#include <gr_fir_ccf.h>
@@ -55,9 +59,14 @@
gr_complex input[BLOCK_SIZE + NTAPS];
long n;
gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
struct rusage rusage_start;
struct rusage rusage_stop;
-
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
// setup coefficients and input data
for (i = 0; i < NTAPS; i++)
@@ -68,13 +77,17 @@
std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
filter_t *f = filter_maker (taps);
-
+
// get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
perror ("getrusage");
exit (1);
}
+#else
+ clock_start= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+#endif
// do the actual work
@@ -84,9 +97,10 @@
result = f->filter (&input[j]);
}
}
-
+
// get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
perror ("getrusage");
exit (1);
@@ -103,6 +117,10 @@
- timeval_to_double (&rusage_start.ru_stime);
double total = user + sys;
+#else
+ clock_end= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+ double total = clock_end -clock_start;
+#endif
double macs = NTAPS * (double) TOTAL_TEST_SIZE;
@@ -116,7 +134,7 @@
do_all ()
{
std::vector<gr_fir_ccf_info> info;
- gr_fir_util::get_gr_fir_ccf_info (&info); // get all known CCF
implementations
+ gr_fir_util::get_gr_fir_ccf_info (&info); // get all known CCF
implementations
for (std::vector<gr_fir_ccf_info>::iterator p = info.begin ();
p != info.end () ;
@@ -125,7 +143,7 @@
}
}
-int
+int
main (int argc, char **argv)
{
do_all ();
Index: src/tests/benchmark_dotprod_fcc.cc
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/tests/benchmark_dotprod_fcc.cc,v
retrieving revision 1.2
diff -u -r1.2 benchmark_dotprod_fcc.cc
--- src/tests/benchmark_dotprod_fcc.cc 10 May 2005 01:11:33 -0000 1.2
+++ src/tests/benchmark_dotprod_fcc.cc 20 Jul 2005 13:18:10 -0000
@@ -1,28 +1,32 @@
/* -*- c++ -*- */
/*
* Copyright 2002 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio 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, or (at your option)
* any later version.
- *
+ *
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
+#endif
#include <unistd.h>
#include <gr_fir_util.h>
#include <gr_fir_fcc.h>
@@ -51,32 +55,39 @@
benchmark (fir_maker_t filter_maker, const char *implementation_name)
{
int i;
- gr_complex coeffs[NTAPS];
+ float coeffs[NTAPS];
float input[BLOCK_SIZE + NTAPS];
long n;
gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
struct rusage rusage_start;
struct rusage rusage_stop;
-
+#else
+ double clock_start;
+ double clock_end;
+#endif
+
// setup coefficients and input data
for (i = 0; i < NTAPS; i++)
- coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+ coeffs[i] = random() - RANDOM_MAX/2;
for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
input[i] = random() - RANDOM_MAX/2;
std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
filter_t *f = filter_maker (taps);
-
- // get starting CPU usage
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
perror ("getrusage");
exit (1);
}
-
+#else
+ clock_start= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+#endif
// do the actual work
for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
@@ -85,9 +96,10 @@
result = f->filter (&input[j]);
}
}
-
+
// get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
perror ("getrusage");
exit (1);
@@ -104,6 +116,10 @@
- timeval_to_double (&rusage_start.ru_stime);
double total = user + sys;
+#else
+ clock_end= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+ double total = clock_end -clock_start;
+#endif
double macs = NTAPS * (double) TOTAL_TEST_SIZE;
@@ -117,7 +133,7 @@
do_all ()
{
std::vector<gr_fir_fcc_info> info;
- gr_fir_util::get_gr_fir_fcc_info (&info); // get all known FCC
implementations
+ gr_fir_util::get_gr_fir_fcc_info (&info); // get all known FCC
implementations
for (std::vector<gr_fir_fcc_info>::iterator p = info.begin ();
p != info.end () ;
@@ -126,7 +142,7 @@
}
}
-int
+int
main (int argc, char **argv)
{
do_all ();
Index: src/tests/benchmark_dotprod_fsf.cc
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/tests/benchmark_dotprod_fsf.cc,v
retrieving revision 1.1
diff -u -r1.1 benchmark_dotprod_fsf.cc
--- src/tests/benchmark_dotprod_fsf.cc 10 May 2005 01:38:19 -0000 1.1
+++ src/tests/benchmark_dotprod_fsf.cc 20 Jul 2005 13:18:10 -0000
@@ -1,28 +1,32 @@
/* -*- c++ -*- */
/*
* Copyright 2002 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio 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, or (at your option)
* any later version.
- *
+ *
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
+#endif
#include <unistd.h>
#include <gr_fir_util.h>
#include <gr_fir_fsf.h>
@@ -55,9 +59,13 @@
float input[BLOCK_SIZE + NTAPS];
long n;
short result;
+#ifdef HAVE_SYS_RESOURCE_H
struct rusage rusage_start;
struct rusage rusage_stop;
-
+#else
+ double clock_start;
+ double clock_end;
+#endif
// setup coefficients and input data
@@ -69,13 +77,16 @@
std::vector<float> taps (&coeffs[0], &coeffs[NTAPS]);
filter_t *f = filter_maker (taps);
-
- // get starting CPU usage
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
perror ("getrusage");
exit (1);
}
+#else
+ clock_start= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+#endif
// do the actual work
@@ -85,9 +96,10 @@
result = f->filter (&input[j]);
}
}
-
+
// get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
perror ("getrusage");
exit (1);
@@ -104,6 +116,10 @@
- timeval_to_double (&rusage_start.ru_stime);
double total = user + sys;
+#else
+ clock_end= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+ double total = clock_end -clock_start;
+#endif
double macs = NTAPS * (double) TOTAL_TEST_SIZE;
@@ -117,7 +133,7 @@
do_all ()
{
std::vector<gr_fir_fsf_info> info;
- gr_fir_util::get_gr_fir_fsf_info (&info); // get all known FFF
implementations
+ gr_fir_util::get_gr_fir_fsf_info (&info); // get all known FFF
implementations
for (std::vector<gr_fir_fsf_info>::iterator p = info.begin ();
p != info.end ();
@@ -127,7 +143,7 @@
}
}
-int
+int
main (int argc, char **argv)
{
do_all ();
Index: src/tests/benchmark_dotprod_scc.cc
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/tests/benchmark_dotprod_scc.cc,v
retrieving revision 1.2
diff -u -r1.2 benchmark_dotprod_scc.cc
--- src/tests/benchmark_dotprod_scc.cc 10 May 2005 01:11:33 -0000 1.2
+++ src/tests/benchmark_dotprod_scc.cc 20 Jul 2005 13:18:10 -0000
@@ -1,28 +1,32 @@
/* -*- c++ -*- */
/*
* Copyright 2002 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio 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, or (at your option)
* any later version.
- *
+ *
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
+#endif
#include <unistd.h>
#include <gr_fir_util.h>
#include <gr_fir_scc.h>
@@ -51,32 +55,38 @@
benchmark (fir_maker_t filter_maker, const char *implementation_name)
{
int i;
- gr_complex coeffs[NTAPS];
+ float coeffs[NTAPS];
short input[BLOCK_SIZE + NTAPS];
long n;
gr_complex result;
+#ifdef HAVE_SYS_RESOURCE_H
struct rusage rusage_start;
struct rusage rusage_stop;
-
+#else
+ double clock_start;
+ double clock_end;
+#endif
// setup coefficients and input data
for (i = 0; i < NTAPS; i++)
- coeffs[i] = gr_complex(random() - RANDOM_MAX/2, random() - RANDOM_MAX/2);
+ coeffs[i] = random() - RANDOM_MAX/2;
for (i = 0; i < BLOCK_SIZE + NTAPS; i++)
input[i] = random() - RANDOM_MAX/2;
std::vector<gr_complex> taps (&coeffs[0], &coeffs[NTAPS]);
filter_t *f = filter_maker (taps);
-
- // get starting CPU usage
+ // get starting CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
perror ("getrusage");
exit (1);
}
-
+#else
+clock_start= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+#endif
// do the actual work
for (n = 0; n < TOTAL_TEST_SIZE; n += BLOCK_SIZE){
@@ -85,9 +95,9 @@
result = f->filter (&input[j]);
}
}
-
- // get ending CPU usage
+ // get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
perror ("getrusage");
exit (1);
@@ -104,6 +114,10 @@
- timeval_to_double (&rusage_start.ru_stime);
double total = user + sys;
+#else
+clock_end= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+double total = clock_end -clock_start;
+#endif
double macs = NTAPS * (double) TOTAL_TEST_SIZE;
@@ -117,7 +131,7 @@
do_all ()
{
std::vector<gr_fir_scc_info> info;
- gr_fir_util::get_gr_fir_scc_info (&info); // get all known SCC
implementations
+ gr_fir_util::get_gr_fir_scc_info (&info); // get all known SCC
implementations
for (std::vector<gr_fir_scc_info>::iterator p = info.begin ();
p != info.end () ;
@@ -126,7 +140,7 @@
}
}
-int
+int
main (int argc, char **argv)
{
do_all ();
Index: src/tests/benchmark_nco.cc
===================================================================
RCS file: /cvsroot/gnuradio/gnuradio-core/src/tests/benchmark_nco.cc,v
retrieving revision 1.1
diff -u -r1.1 benchmark_nco.cc
--- src/tests/benchmark_nco.cc 19 Dec 2004 05:48:39 -0000 1.1
+++ src/tests/benchmark_nco.cc 20 Jul 2005 13:18:10 -0000
@@ -1,28 +1,32 @@
/* -*- c++ -*- */
/*
* Copyright 2002,2004 Free Software Foundation, Inc.
- *
+ *
* This file is part of GNU Radio
- *
+ *
* GNU Radio 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, or (at your option)
* any later version.
- *
+ *
* GNU Radio 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 GNU Radio; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
#include <stdio.h>
#include <sys/time.h>
+#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
+#endif
#include <unistd.h>
#include <gr_nco.h>
#include <gr_fxpt_nco.h>
@@ -39,23 +43,31 @@
static void
benchmark (void test (float *x, float *y), const char *implementation_name)
{
+#ifdef HAVE_SYS_RESOURCE_H
struct rusage rusage_start;
struct rusage rusage_stop;
+#else
+ double clock_start;
+ double clock_end;
+#endif
float x, y;
// get starting CPU usage
-
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_start) < 0){
perror ("getrusage");
exit (1);
}
-
+#else
+clock_start= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+#endif
// do the actual work
test (&x, &y);
-
+
// get ending CPU usage
+#ifdef HAVE_SYS_RESOURCE_H
if (getrusage (RUSAGE_SELF, &rusage_stop) < 0){
perror ("getrusage");
exit (1);
@@ -72,6 +84,10 @@
- timeval_to_double (&rusage_start.ru_stime);
double total = user + sys;
+#else
+clock_end= (double) clock () * (double)(1000000 / CLOCKS_PER_SEC);
+double total = clock_end -clock_start;
+#endif
printf ("%16s: cpu: %6.3f steps/sec: %10.3e\n",
implementation_name, total, ITERATIONS / total);
@@ -82,9 +98,9 @@
void native_sincos (float *x, float *y)
{
gr_nco<float,float> nco;
-
+
nco.set_freq (2 * M_PI / 5003.123);
-
+
for (int i = 0; i < ITERATIONS; i++){
nco.sincos (x, y);
nco.step ();
@@ -94,9 +110,9 @@
void fxpt_sincos (float *x, float *y)
{
gr_fxpt_nco nco;
-
+
nco.set_freq (2 * M_PI / 5003.123);
-
+
for (int i = 0; i < ITERATIONS; i++){
nco.sincos (x, y);
nco.step ();
@@ -108,9 +124,9 @@
void native_sin (float *x, float *y)
{
gr_nco<float,float> nco;
-
+
nco.set_freq (2 * M_PI / 5003.123);
-
+
for (int i = 0; i < ITERATIONS; i++){
*x = nco.sin ();
nco.step ();
@@ -120,9 +136,9 @@
void fxpt_sin (float *x, float *y)
{
gr_fxpt_nco nco;
-
+
nco.set_freq (2 * M_PI / 5003.123);
-
+
for (int i = 0; i < ITERATIONS; i++){
*x = nco.sin ();
nco.step ();
@@ -142,7 +158,7 @@
}
}
-int
+int
main (int argc, char **argv)
{
benchmark (nop_loop, "nop loop");
Building and using gnuradio on windows (win32) using mingw
Required tools and libraries
MingW and Msys
Download the latest stable version from the mingw site oand follow their
installation instructions)
Python for windows version 2.4 (or higher)
You do not need to build this yourself.
You can just install the windows executable which you can find on the python
site.
I am not sure if it will work if you have speces in your python pathname.
I recommend installing it in C:\Python24 or D:\Python24
Libtool
If you are building from cvs you need a recent libtool
msys comes with libtool, but the version distributed with current mingw doesn't
work with gnuradio.
download, build and install a recent libtool
cppunit
Build and install cppunit
boost
build and install boost (maybe you can get away with only unpacking the source,
we only use the boost header files)
If you build boost, you first have to download jam (boost jam) for win32. (Do
not use build and use the cygwin version)
build environment:
You need to have the following files on your PATH:
python.exe python24.dll libcppunit-1-10-2.dll libfftw3f-3.dll fftwf-wisdom.exe
cppunit-config
If you have cygwin installed Make sure that NO cygwin executables are on your
path.
needed on PATH:
/usr/local/bin
/mingw/bin
/bin
/c/Python24/ python.exe
/c/Python24/libs python24.dll
/c/Python24/DLLs
/usr/local/bin or /mingw/bin or /my/special/installed/lib/folder/bin
libcppunit-1-10-2.dll
libfftw3f-3.dll
fftw-wisdom-to-conf
fftwf-wisdom.exe
cppunit-config
/c/WINNT/system32
/c/WINNT
I made a little script set_clean_path.sh to set my path for building gnuradio
where I just discard the original PATH (to get rid of the cygwin executables on
my default path) and just include what is needed:
#!/bin/sh
export
PATH=".:/usr/local/bin:/mingw/bin:/bin:/c/Python24:/c/Python24/DLLs:/c/Python24/libs:/my/special/installed/lib/folder/bin:/c/WINNT/system32:/c/WINNT:/c/WINNT/System32/Wbem:.
You need to source this script to set the PATH.
. ./set_clean_path.sh
(notice the extra dot and space in the beginning of the line, this means source
this file. Sourcing means execute it and remember all environment variables set
in this script)
If you are building from cvs it is recommended that you edit bootstrap to your
needs and use it
If you built a recent libtool and didn't overwrite the original libtool
(because you installed the new version in /usr/local) then you have to tell
aclocal to use the more recent libtool m4 macros.
You can do this by appending -I /usr/local/share/aclocal to the aclocal
commandline
I also changed the aclocal and automake invocations to use the most recent
version in my bootstrap script
Here follows the bootstrap script I use
#!/bin/sh
rm -fr config.cache autom4te*.cache
aclocal-1.8 -I config -I /usr/local/share/aclocal
autoconf
autoheader
libtoolize --automake
automake-1.8 --add-missing
If you run this script it will convert a clean cvs checkout to a version which
you can configure, build and install
So now you can configure gnuradio.
On win32 /mingw you need to give it a few parameters
You need to tell it where cppunit is installed
where boost include files are to be found
where the pkg-config of libfftw is to be found
to use a generic cpu (no 3Dnow,SSE,MMX) (This option will not be needed anymore
soon)
If you have boost installed in C:\boost_1_32_0 and cppunit and fftw in
/usr/local then you would need the following configur commandline
$ ./configure --with-md-cpu=generic --with-cppunit-prefix=/usr/local
--with-boost-include-dir=/c/boost_1_32_0/include/boost-1_32
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
If everything went well you cannow do
make
make install
Now you have a working gnuradio-core
Now you can go on building and installing gr-audio-windows and windows usrp and
wxgui
remember that all gnuradio and python dlls need to be on your path to use
gnuradio
The gnuradio dlls are installed at
/c/Python24/Lib/site-packages:/c/Python24/Lib/site-packages/gnuradio:/c/Python24/Lib/site-packages/gnuradio/gr