Moved mb_time to omni_time and left mb_time.h with typedef to maintain
authoreb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 19 Jun 2008 15:04:26 +0000 (15:04 +0000)
committereb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 19 Jun 2008 15:04:26 +0000 (15:04 +0000)
backwards compatibility. Removed gcell's dependency on mblocks. Now
gcell only depends on omnithread. Merged eb/wip -r8621:8623 to trunk.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8624 221aa14e-8319-0410-a670-987f0aec2ac5

config/grc_gcell.m4
configure.ac
gcell/src/apps/Makefile.am
gcell/src/apps/benchmark_dma.cc
gcell/src/apps/benchmark_nop.cc
mblock/src/lib/Makefile.am
mblock/src/lib/mb_time.cc [deleted file]
mblock/src/lib/mb_time.h
omnithread/Makefile.am
omnithread/omni_time.cc [new file with mode: 0644]
omnithread/omni_time.h [new file with mode: 0644]

index 188437f0481bf9e44bad5e278a02e0f4bc7be892..38854b95b497f9ec4039feba33451dbd713ba7d2 100644 (file)
@@ -21,10 +21,8 @@ AC_DEFUN([GRC_GCELL],[
     GRC_ENABLE(gcell)
     dnl GRC_WITH(gcell)
 
-    dnl Don't do gcell if omnithread or mblock skipped
-    dnl (The mblock dependency should be refactored, we're just using some timing utilities)
+    dnl Don't do gcell if omnithread skipped
     GRC_CHECK_DEPENDENCY(gcell, omnithread)
-    GRC_CHECK_DEPENDENCY(gcell, mblock)
 
     dnl If execution gets to here, $passed will be:
     dnl   with : if the --with code didn't error out
index e3cd1870f263f2369f07cf782185bc0a862c03ce..9160b4ca442ad1240feaf35a2f52244dafee2eca 100644 (file)
@@ -240,10 +240,10 @@ AC_ARG_ENABLE(
 
 build_dirs="config"
 GRC_OMNITHREAD                 dnl must come before gnuradio-core and mblock
-GRC_PMT
-GRC_MBLOCK                     dnl this must come after GRC_PMT
 GRC_GCELL
 GRC_GNURADIO_CORE
+GRC_PMT
+GRC_MBLOCK                     dnl this must come after GRC_PMT
 GRC_USRP
 GRC_GR_USRP                    dnl this must come after GRC_USRP
 GRC_GR_GCELL                   dnl this must come after GRC_GCELL and GRC_GNURADIO_CORE
index e8cbf3cfc73fe80c4eea14ab9e91b56470ad1483..7dd695653fd8a6261689682d826d3be152a9c6b6 100644 (file)
@@ -22,7 +22,7 @@ include $(top_srcdir)/Makefile.common
 
 SUBDIRS = spu .
 
-AM_CPPFLAGS = $(DEFINES) $(OMNITHREAD_INCLUDES) $(MBLOCK_INCLUDES) \
+AM_CPPFLAGS = $(DEFINES) $(OMNITHREAD_INCLUDES) \
        $(GCELL_INCLUDES) $(CPPUNIT_INCLUDES) $(WITH_INCLUDES)
 
 
@@ -41,7 +41,7 @@ test_all_SOURCES = test_all.cc
 test_all_LDADD = $(GCELL_QA_LA) $(GCELL_LA)
 
 benchmark_dma_SOURCES = benchmark_dma.cc
-benchmark_dma_LDADD = spu/benchmark_procs $(GCELL_LA) $(MBLOCK_LA)
+benchmark_dma_LDADD = spu/benchmark_procs $(GCELL_LA)
 
 benchmark_nop_SOURCES = benchmark_nop.cc
-benchmark_nop_LDADD = spu/benchmark_procs $(GCELL_LA) $(MBLOCK_LA)
+benchmark_nop_LDADD = spu/benchmark_procs $(GCELL_LA)
index 961876ad867197e148d2c2690f6ecacd8319ec43..7dfaa4c22cb06b9ffbedf723e8d8105c64ac2a7e 100644 (file)
@@ -23,7 +23,7 @@
 #include <config.h>
 #endif
 #include "gc_job_manager.h"
-#include "mb_time.h"
+#include <omni_time.h>
 #include <getopt.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -148,7 +148,7 @@ run_test(unsigned int nspes, unsigned int usecs, unsigned int dma_size, int getp
 
   for (int iter = 0; iter < 1; iter++){
 
-    mb_time t_start = mb_time::time();
+    omni_time t_start = omni_time::time();
 
     nsubmitted = 0;
     ncompleted = 0;
@@ -203,7 +203,7 @@ run_test(unsigned int nspes, unsigned int usecs, unsigned int dma_size, int getp
     }
 
     // stop timing
-    mb_time t_stop = mb_time::time();
+    omni_time t_stop = omni_time::time();
 
     double delta = (t_stop - t_start).double_time();
     printf("nspes: %2d  udelay: %4d  elapsed_time: %7.3f  dma_size: %5d  dma_throughput: %7.3e\n",
index b87137d50444071349ee1f91a5962dd4a4f49ca7..f427c85d81263efe734f2bf7ec17dab1c94ceb2b 100644 (file)
@@ -23,7 +23,7 @@
 #include <config.h>
 #endif
 #include "gc_job_manager.h"
-#include "mb_time.h"
+#include <omni_time.h>
 #include <getopt.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -73,7 +73,7 @@ run_test(unsigned int nspes, unsigned int usecs, int njobs)
     init_jd(all_jds[i], usecs);
   }
 
-  mb_time t_start = mb_time::time();
+  omni_time t_start = omni_time::time();
 
   ci = 0;
   njds[0] = 0;
@@ -122,7 +122,7 @@ run_test(unsigned int nspes, unsigned int usecs, int njobs)
   }
 
   // stop timing
-  mb_time t_stop = mb_time::time();
+  omni_time t_stop = omni_time::time();
   double delta = (t_stop - t_start).double_time();
   printf("nspes: %2d  udelay: %4d  elapsed_time: %7.3f  njobs: %g  speedup: %6.3f\n",
         mgr->nspes(), usecs, delta, (double) njobs,
index 4bdd9b1a8d2fff2ade368c60bb8ee12e66e9278a..a005f83008aac3936adaa92e6da1b32eaa159546 100644 (file)
@@ -61,7 +61,6 @@ libmblock_la_SOURCES =                        \
        mb_runtime_base.cc              \
        mb_runtime_nop.cc               \
        mb_runtime_thread_per_block.cc  \
-       mb_time.cc                      \
        mb_timer_queue.cc               \
        mb_util.cc                      \
        mb_worker.cc                    
diff --git a/mblock/src/lib/mb_time.cc b/mblock/src/lib/mb_time.cc
deleted file mode 100644 (file)
index 48b2c66..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 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 3, 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 this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <mb_time.h>
-#include <omnithread.h>
-#include <math.h>
-#include <assert.h>
-
-
-mb_time::mb_time(double real_secs)
-{
-  double floor_secs = floor(real_secs);
-  d_secs = (long) floor_secs;
-  d_nsecs = (long) ((real_secs - floor_secs) * 1e9);     // always positive
-}
-
-mb_time
-mb_time::time(const mb_time &delta_t)
-{
-  unsigned long        abs_sec, abs_nsec;
-  unsigned long rel_sec  = delta_t.d_secs;
-  unsigned long rel_nsec = delta_t.d_nsecs;
-  
-  omni_thread::get_time(&abs_sec, &abs_nsec, rel_sec, rel_nsec);
-  return mb_time(abs_sec, abs_nsec);
-}
-
-
-mb_time
-operator+(const mb_time &x, const mb_time &y)
-{
-  mb_time r(x.d_secs + y.d_secs, x.d_nsecs + y.d_nsecs);
-  while (r.d_nsecs >= 1000000000){
-    r.d_nsecs -= 1000000000;
-    r.d_secs++;
-  }
-  return r;
-}
-
-mb_time
-operator-(const mb_time &x, const mb_time &y)
-{
-  // assert(!(x < y));
-
-  mb_time r(x.d_secs - y.d_secs, x.d_nsecs - y.d_nsecs);
-  while (r.d_nsecs < 0){
-    r.d_nsecs += 1000000000;
-    r.d_secs--;
-  }
-  return r;
-}
-
-mb_time
-operator+(const mb_time &x, double y)
-{
-  return x + mb_time(y);
-}
-
-mb_time
-operator-(const mb_time &x, double y)
-{
-  return x - mb_time(y);
-}
index b9c655b6e4cd2ea077e9a3db68373b993b308126..cba6be78518dd94ea226b20fab663e904af20954 100644 (file)
@@ -1,6 +1,6 @@
 /* -*- c++ -*- */
 /*
- * Copyright 2007 Free Software Foundation, Inc.
+ * Copyright 2008 Free Software Foundation, Inc.
  * 
  * This file is part of GNU Radio
  * 
 #ifndef INCLUDED_MB_TIME_H
 #define INCLUDED_MB_TIME_H
 
-struct mb_time {
-  long int d_secs;     // seconds.
-  long int d_nsecs;    // nanoseconds.  Always in [0, 1e9-1]
-
-  mb_time() : d_secs(0), d_nsecs(0) {}
-  mb_time(long secs, long nanosecs=0) : d_secs(secs), d_nsecs(nanosecs) {}
-
-  // N.B., this only makes sense for differences between times.
-  // Double doesn't have enough bits to precisely represent an absolute time.
-  mb_time(double secs);
-
-  // N.B. This only makes sense for differences between times.
-  // Double doesn't have enough bits to precisely represent an absolute time.
-  double double_time() const { return (double)d_secs + d_nsecs * 1e-9; }
-
-  /*!
-   * \brief Return an absolute time suitable for use with
-   * schedule_one_shot_timeout & schedule_periodic_timeout
-   *
-   * The return value is the current time plus the given relative offset.
-   */
-  static mb_time time(const mb_time &relative_offset = mb_time());
-};
-
-
-inline static bool
-operator<(const mb_time &x, const mb_time &y)
-{
-  return ((x.d_secs < y.d_secs)
-         || (x.d_secs == y.d_secs && x.d_nsecs < y.d_nsecs));
-}
-
-inline static bool
-operator>(const mb_time &x, const mb_time &y)
-{
-  return ((x.d_secs > y.d_secs)
-         || (x.d_secs == y.d_secs && x.d_nsecs > y.d_nsecs));
-}
-
-inline static bool
-operator>=(const mb_time &x, const mb_time &y)
-{
-  return ((x.d_secs > y.d_secs)
-         || (x.d_secs == y.d_secs && x.d_nsecs >= y.d_nsecs));
-}
-
-inline static bool
-operator<=(const mb_time &x, const mb_time &y)
-{
-  return ((x.d_secs < y.d_secs)
-         || (x.d_secs == y.d_secs && x.d_nsecs <= y.d_nsecs));
-}
-
-inline static bool
-operator==(const mb_time &x, const mb_time &y)
-{
-  return (x.d_secs == y.d_secs && x.d_nsecs == y.d_nsecs);
-}
-
-
-mb_time operator+(const mb_time &x, const mb_time &y);
-mb_time operator+(const mb_time &x, double y);
-mb_time operator-(const mb_time &x, const mb_time &y);
-mb_time operator-(const mb_time &x, double y);
+#include <omni_time.h>
+typedef omni_time mb_time;
 
 #endif /* INCLUDED_MB_TIME_H */
index 0985f4ed454b0abea4e24f8d074f0e8f251d0de5..d0dde72b2a27d3691c6f0765d06b5d4a38947569 100644 (file)
@@ -37,11 +37,13 @@ lib_LTLIBRARIES = libgromnithread.la
 
 if OMNITHREAD_POSIX
 libgromnithread_la_SOURCES =           \
+       omni_time.cc \
        posix.cc
 endif
 
 if OMNITHREAD_NT
 libgromnithread_la_SOURCES =           \
+       omni_time.cc \
        nt.cc
 endif
 
@@ -67,6 +69,7 @@ EXTRA_DIST =                          \
 
 grinclude_HEADERS =                    \
        omnithread.h                    \
+       omni_time.h                     \
        ot_mach.h                       \
        ot_nt.h                         \
        ot_posix.h                      \
diff --git a/omnithread/omni_time.cc b/omnithread/omni_time.cc
new file mode 100644 (file)
index 0000000..8703245
--- /dev/null
@@ -0,0 +1,84 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008 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 3, 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <omni_time.h>
+#include <omnithread.h>
+#include <math.h>
+#include <assert.h>
+
+
+omni_time::omni_time(double real_secs)
+{
+  double floor_secs = floor(real_secs);
+  d_secs = (long) floor_secs;
+  d_nsecs = (long) ((real_secs - floor_secs) * 1e9);     // always positive
+}
+
+omni_time
+omni_time::time(const omni_time &delta_t)
+{
+  unsigned long        abs_sec, abs_nsec;
+  unsigned long rel_sec  = delta_t.d_secs;
+  unsigned long rel_nsec = delta_t.d_nsecs;
+  
+  omni_thread::get_time(&abs_sec, &abs_nsec, rel_sec, rel_nsec);
+  return omni_time(abs_sec, abs_nsec);
+}
+
+
+omni_time
+operator+(const omni_time &x, const omni_time &y)
+{
+  omni_time r(x.d_secs + y.d_secs, x.d_nsecs + y.d_nsecs);
+  while (r.d_nsecs >= 1000000000){
+    r.d_nsecs -= 1000000000;
+    r.d_secs++;
+  }
+  return r;
+}
+
+omni_time
+operator-(const omni_time &x, const omni_time &y)
+{
+  // assert(!(x < y));
+
+  omni_time r(x.d_secs - y.d_secs, x.d_nsecs - y.d_nsecs);
+  while (r.d_nsecs < 0){
+    r.d_nsecs += 1000000000;
+    r.d_secs--;
+  }
+  return r;
+}
+
+omni_time
+operator+(const omni_time &x, double y)
+{
+  return x + omni_time(y);
+}
+
+omni_time
+operator-(const omni_time &x, double y)
+{
+  return x - omni_time(y);
+}
diff --git a/omnithread/omni_time.h b/omnithread/omni_time.h
new file mode 100644 (file)
index 0000000..bfb1516
--- /dev/null
@@ -0,0 +1,89 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2007,2008 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 3, 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_OMNI_TIME_H
+#define INCLUDED_OMNI_TIME_H
+
+struct omni_time {
+  long int d_secs;     // seconds.
+  long int d_nsecs;    // nanoseconds.  Always in [0, 1e9-1]
+
+  omni_time() : d_secs(0), d_nsecs(0) {}
+  omni_time(long secs, long nanosecs=0) : d_secs(secs), d_nsecs(nanosecs) {}
+
+  // N.B., this only makes sense for differences between times.
+  // Double doesn't have enough bits to precisely represent an absolute time.
+  omni_time(double secs);
+
+  // N.B. This only makes sense for differences between times.
+  // Double doesn't have enough bits to precisely represent an absolute time.
+  double double_time() const { return (double)d_secs + d_nsecs * 1e-9; }
+
+  /*!
+   * \brief Return an absolute time suitable for use with
+   * schedule_one_shot_timeout & schedule_periodic_timeout
+   *
+   * The return value is the current time plus the given relative offset.
+   */
+  static omni_time time(const omni_time &relative_offset = omni_time());
+};
+
+
+inline static bool
+operator<(const omni_time &x, const omni_time &y)
+{
+  return ((x.d_secs < y.d_secs)
+         || (x.d_secs == y.d_secs && x.d_nsecs < y.d_nsecs));
+}
+
+inline static bool
+operator>(const omni_time &x, const omni_time &y)
+{
+  return ((x.d_secs > y.d_secs)
+         || (x.d_secs == y.d_secs && x.d_nsecs > y.d_nsecs));
+}
+
+inline static bool
+operator>=(const omni_time &x, const omni_time &y)
+{
+  return ((x.d_secs > y.d_secs)
+         || (x.d_secs == y.d_secs && x.d_nsecs >= y.d_nsecs));
+}
+
+inline static bool
+operator<=(const omni_time &x, const omni_time &y)
+{
+  return ((x.d_secs < y.d_secs)
+         || (x.d_secs == y.d_secs && x.d_nsecs <= y.d_nsecs));
+}
+
+inline static bool
+operator==(const omni_time &x, const omni_time &y)
+{
+  return (x.d_secs == y.d_secs && x.d_nsecs == y.d_nsecs);
+}
+
+
+omni_time operator+(const omni_time &x, const omni_time &y);
+omni_time operator+(const omni_time &x, double y);
+omni_time operator-(const omni_time &x, const omni_time &y);
+omni_time operator-(const omni_time &x, double y);
+
+#endif /* INCLUDED_OMNI_TIME_H */