commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r7014 - gnuradio/branches/developers/eb/gcell/src/lib


From: eb
Subject: [Commit-gnuradio] r7014 - gnuradio/branches/developers/eb/gcell/src/lib
Date: Wed, 21 Nov 2007 16:39:14 -0700 (MST)

Author: eb
Date: 2007-11-21 16:39:04 -0700 (Wed, 21 Nov 2007)
New Revision: 7014

Added:
   gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
   gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.h
Modified:
   gnuradio/branches/developers/eb/gcell/src/lib/Makefile.am
   gnuradio/branches/developers/eb/gcell/src/lib/gc_client_thread_info.h
   gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.cc
   gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc
   gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.h
   gnuradio/branches/developers/eb/gcell/src/lib/qa_lib.cc
Log:
start of QA code for gc_job_manager

Modified: gnuradio/branches/developers/eb/gcell/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/Makefile.am   2007-11-21 
08:33:02 UTC (rev 7013)
+++ gnuradio/branches/developers/eb/gcell/src/lib/Makefile.am   2007-11-21 
23:39:04 UTC (rev 7014)
@@ -36,7 +36,8 @@
 
 libgcell_qa_la_SOURCES = \
        qa_lib.cc \
-       qa_jd_stack.cc
+       qa_jd_stack.cc \
+       qa_job_manager.cc
 
 libgcell_qa_la_LIBADD = \
        libgcell.la \

Modified: gnuradio/branches/developers/eb/gcell/src/lib/gc_client_thread_info.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/gc_client_thread_info.h       
2007-11-21 08:33:02 UTC (rev 7013)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_client_thread_info.h       
2007-11-21 23:39:04 UTC (rev 7014)
@@ -41,17 +41,16 @@
 class gc_client_thread_info {
 public:
   gc_client_thread_info() :
-    d_free(1), d_cond(&d_mutex),
-    d_state(CT_RUNNING) { }
+    d_free(1), d_state(CT_RUNNING), d_cond(&d_mutex) { }
 
   ~gc_client_thread_info() {
     d_free = 1;
   }
 
   volatile uint32_t    d_free;         // is this cti free? (1->free, 0->in 
use)
+  gc_ct_state_t                d_state;
   omni_mutex           d_mutex;        // used to suspend/resume client
   omni_condition       d_cond;         // used to suspend/resume client
-  gc_ct_state_t                d_state;
   unsigned long                d_jobs_were_waiting_for[0];  // bitvector
 };
 

Modified: gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.cc     
2007-11-21 08:33:02 UTC (rev 7013)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.cc     
2007-11-21 23:39:04 UTC (rev 7014)
@@ -23,7 +23,14 @@
 #include "config.h"
 #endif
 #include "gc_job_manager.h"
+#include "gc_job_manager_impl.h"
 
+gc_job_manager *
+gc_make_job_manager(const gc_jm_options *options)
+{
+  return new gc_job_manager_impl(options);
+}
+
 gc_job_manager::gc_job_manager(const gc_jm_options *options)
 {
   // nop

Modified: gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc        
2007-11-21 08:33:02 UTC (rev 7013)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc        
2007-11-21 23:39:04 UTC (rev 7014)
@@ -72,9 +72,11 @@
     }
   }
 
+  // clamp nspes
+  d_options.nspes = std::min(d_options.nspes, (unsigned int) MAX_SPES);
+
   // FIXME when we get that next gen Cell
-  if (nusable_spes > (int) MAX_SPES)
-    nusable_spes = MAX_SPES;   // be safe in the meanwhile
+  nusable_spes = std::min(nusable_spes, (int) MAX_SPES);
 
   //
   // sanity check requested number of spes.
@@ -94,6 +96,7 @@
     }
   }
 
+
   if (d_options.use_affinity){
     printf("gc_job_manager: warning: affinity request was ignored\n");
   }
@@ -187,7 +190,7 @@
 
 worker_ctx::~worker_ctx()
 {
-  fprintf(stderr, "\n~worker_ctx\n");
+  // fprintf(stderr, "\n~worker_ctx\n");
   if (spe_ctx){
     int r = spe_context_destroy(spe_ctx);
     if (r != 0){
@@ -197,4 +200,3 @@
   }
   state = WS_FREE;
 }
-

Modified: gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.h 
2007-11-21 08:33:02 UTC (rev 7013)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.h 
2007-11-21 23:39:04 UTC (rev 7014)
@@ -52,7 +52,7 @@
  */
 class gc_job_manager_impl : public gc_job_manager
 {
-  static const unsigned int MAX_SPES =  16;
+  enum { MAX_SPES =  16 };
 
   gc_jm_options                 d_options;
   spe_gang_context_sptr  d_gang;               // boost::shared_ptr

Added: gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc             
                (rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc     
2007-11-21 23:39:04 UTC (rev 7014)
@@ -0,0 +1,66 @@
+/* -*- 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.
+ */
+
+#include "qa_job_manager.h"
+#include <cppunit/TestAssert.h>
+#include "gc_job_manager.h"
+#include <stdexcept>
+#include <stdio.h>
+
+void
+qa_job_manager::t1()
+{
+  gc_job_manager *mgr;
+
+  mgr = gc_make_job_manager();
+  delete mgr;
+
+  {
+    gc_jm_options opts;
+    opts.nspes = 100;
+    opts.gang_schedule = true;
+    CPPUNIT_ASSERT_THROW(mgr = gc_make_job_manager(&opts), std::out_of_range);
+  }
+
+  {
+    gc_jm_options opts;
+    opts.nspes = 100;
+    opts.gang_schedule = false;
+    mgr = gc_make_job_manager(&opts);
+    delete mgr;
+  }
+}
+
+void
+qa_job_manager::t2()
+{
+}
+
+void
+qa_job_manager::t3()
+{
+}
+
+void
+qa_job_manager::t4()
+{
+}
+


Property changes on: 
gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.cc
___________________________________________________________________
Name: svn:eol-style
   + native

Added: gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.h              
                (rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.h      
2007-11-21 23:39:04 UTC (rev 7014)
@@ -0,0 +1,44 @@
+/* -*- 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.
+ */
+#ifndef INCLUDED_QA_JOB_MANAGER_H
+#define INCLUDED_QA_JOB_MANAGER_H
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/TestCase.h>
+
+class qa_job_manager : public CppUnit::TestCase {
+
+  CPPUNIT_TEST_SUITE(qa_job_manager);
+  CPPUNIT_TEST(t1);
+  CPPUNIT_TEST(t2);
+  CPPUNIT_TEST(t3);
+  CPPUNIT_TEST(t4);
+  CPPUNIT_TEST_SUITE_END();
+
+ private:
+  void t1();
+  void t2();
+  void t3();
+  void t4();
+
+};
+
+#endif /* INCLUDED_QA_JOB_MANAGER_H */


Property changes on: 
gnuradio/branches/developers/eb/gcell/src/lib/qa_job_manager.h
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: gnuradio/branches/developers/eb/gcell/src/lib/qa_lib.cc
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/qa_lib.cc     2007-11-21 
08:33:02 UTC (rev 7013)
+++ gnuradio/branches/developers/eb/gcell/src/lib/qa_lib.cc     2007-11-21 
23:39:04 UTC (rev 7014)
@@ -27,13 +27,15 @@
 
 #include <qa_lib.h>
 #include <qa_jd_stack.h>
+#include <qa_job_manager.h>
 
 CppUnit::TestSuite *
 qa_lib::suite()
 {
-  CppUnit::TestSuite   *s = new CppUnit::TestSuite("general");
+  CppUnit::TestSuite   *s = new CppUnit::TestSuite("lib");
 
   s->addTest(qa_jd_stack::suite());
+  s->addTest(qa_job_manager::suite());
 
   return s;
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]