commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r7006 - in gnuradio/branches/developers/eb/gcell: . sr


From: eb
Subject: [Commit-gnuradio] r7006 - in gnuradio/branches/developers/eb/gcell: . src/apps src/include src/lib
Date: Tue, 20 Nov 2007 02:09:58 -0700 (MST)

Author: eb
Date: 2007-11-20 02:09:57 -0700 (Tue, 20 Nov 2007)
New Revision: 7006

Added:
   gnuradio/branches/developers/eb/gcell/src/include/gc_atomic.h
   gnuradio/branches/developers/eb/gcell/src/lib/gc_client_thread_info.h
Modified:
   gnuradio/branches/developers/eb/gcell/Makefile.common
   gnuradio/branches/developers/eb/gcell/src/apps/
   gnuradio/branches/developers/eb/gcell/src/include/gc_job_manager.h
   gnuradio/branches/developers/eb/gcell/src/include/gc_job_manager_impl.h
   gnuradio/branches/developers/eb/gcell/src/lib/Makefile.am
   gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.cc
   gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc
Log:
work-in-progress

Modified: gnuradio/branches/developers/eb/gcell/Makefile.common
===================================================================
--- gnuradio/branches/developers/eb/gcell/Makefile.common       2007-11-20 
03:54:09 UTC (rev 7005)
+++ gnuradio/branches/developers/eb/gcell/Makefile.common       2007-11-20 
09:09:57 UTC (rev 7006)
@@ -19,5 +19,8 @@
 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 #
 
-STD_DEFINES_AND_INCLUDES= -I$(top_srcdir)/src/include -I$(top_srcdir)/src/lib
+STD_DEFINES_AND_INCLUDES= \
+       -I$(top_srcdir)/src/include \
+       -I$(top_srcdir)/src/lib \
+       $(GR_OMNITHREAD_CFLAGS)
 


Property changes on: gnuradio/branches/developers/eb/gcell/src/apps
___________________________________________________________________
Name: svn:ignore
   - Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo

   + Makefile
Makefile.in
.la
.lo
.deps
.libs
*.la
*.lo
test_all


Added: gnuradio/branches/developers/eb/gcell/src/include/gc_atomic.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_atomic.h               
                (rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_atomic.h       
2007-11-20 09:09:57 UTC (rev 7006)
@@ -0,0 +1,29 @@
+/* -*- 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_GC_ATOMIC_H
+#define INCLUDED_GC_ATOMIC_H
+
+#include <stdint.h>
+
+typedef uint32_t       gc_atomic_t;
+
+
+#endif /* INCLUDED_GC_ATOMIC_H */


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

Modified: gnuradio/branches/developers/eb/gcell/src/include/gc_job_manager.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_job_manager.h  
2007-11-20 03:54:09 UTC (rev 7005)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_job_manager.h  
2007-11-20 09:09:57 UTC (rev 7006)
@@ -28,13 +28,24 @@
 class gc_job_manager;
 
 /*
+ * \brief Hard limits that size key data structures.
+ * The default values are reasonble.
+ */
+struct gc_jm_limits {
+  unsigned int max_jobs;
+  unsigned int max_client_threads;
+
+  gc_jm_limits() : max_jobs(0), max_client_threads(0) {}
+};
+
+
+/*
  * \brief Create an instance of the job manager
  */
 gc_job_manager *
-gc_make_job_manager(int nspes = -1);
+gc_make_job_manager(int nspes = -1, const gc_jm_limits *limits = 0);
 
 
-
 /*!
  * \brief Abstract class that manages SPE jobs.
  *
@@ -48,7 +59,7 @@
    * \param nspes number of SPEs job manager should use.
    * If nspes == -1, all available SPEs will be allocated.
    */
-  gc_job_manager(int nspes = -1);
+  gc_job_manager(int nspes = -1, const gc_jm_limits *limits = 0);
 
   virtual ~gc_job_manager();
 

Modified: 
gnuradio/branches/developers/eb/gcell/src/include/gc_job_manager_impl.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/include/gc_job_manager_impl.h     
2007-11-20 03:54:09 UTC (rev 7005)
+++ gnuradio/branches/developers/eb/gcell/src/include/gc_job_manager_impl.h     
2007-11-20 09:09:57 UTC (rev 7006)
@@ -23,8 +23,10 @@
 #define INCLUDED_GC_JOB_MANAGER_IMPL_H
 
 #include "gc_job_manager.h"
+#include "gc_client_thread_info.h"
+#include "gc_jd_stack.h"
+#include <libspe2.h>
 
-
 class gc_job_manager_impl;
 
 /*!
@@ -32,16 +34,31 @@
  *
  * This class contains all the implementation details.
  */
-
 class gc_job_manager_impl : public gc_job_manager
 {
-  friend gc_job_manager *gc_make_job_manager(int nspes);
+  static const unsigned int MAX_SPES =  16;
 
+  gc_jm_limits          d_limits;
+  int                   d_nspes;               // number of SPEs we've 
allocated
+  int                   d_nclients;            // number of client threads
+  spe_gang_context_ptr_t d_gang;
+  spe_context_ptr_t     d_spe_context[MAX_SPES];
+  gc_job_desc_t                *d_jd;                  // [limits.max_jobs]
+  gc_client_thread_info        *d_client_thread;       // 
[limits.max_client_threads]
+
+  int                   d_bvlen;               // bit vector length in longs
+  unsigned long                *d_job_busy;            // bitvector of job's 
status 1=BUSY
+
+  gc_jd_stack_t                 d_free_list;           // stack of free job 
descriptors
+
+
+  friend gc_job_manager *gc_make_job_manager(int nspes, const gc_jm_limits 
*limits);
+
   /*!
    * \param nspes number of SPEs job manager should use.
    * If nspes == -1, all available SPEs will be allocated.
    */
-  gc_job_manager_impl(int nspes = -1);
+  gc_job_manager_impl(int nspes = -1, const gc_jm_limits *limits = 0);
 
 public:
   virtual ~gc_job_manager_impl();
@@ -119,5 +136,4 @@
 
 };
 
-
 #endif /* INCLUDED_GC_JOB_MANAGER_IMPL_H */

Modified: gnuradio/branches/developers/eb/gcell/src/lib/Makefile.am
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/Makefile.am   2007-11-20 
03:54:09 UTC (rev 7005)
+++ gnuradio/branches/developers/eb/gcell/src/lib/Makefile.am   2007-11-20 
09:09:57 UTC (rev 7006)
@@ -30,6 +30,8 @@
        gc_job_manager_impl.cc \
        gc_jd_stack.c
 
+libgcell_la_LIBADD = \
+       $(GR_OMNITHREAD_LIBS)
 
 libgcell_qa_la_SOURCES = \
        qa_lib.cc \

Added: gnuradio/branches/developers/eb/gcell/src/lib/gc_client_thread_info.h
===================================================================
--- gnuradio/branches/developers/eb/gcell/src/lib/gc_client_thread_info.h       
                        (rev 0)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_client_thread_info.h       
2007-11-20 09:09:57 UTC (rev 7006)
@@ -0,0 +1,59 @@
+/* -*- 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_GC_CLIENT_THREAD_INFO_H
+#define INCLUDED_GC_CLIENT_THREAD_INFO_H
+
+#include <omnithread.h>
+#include <gc_atomic.h>
+
+enum gc_ct_state_t {
+  CT_RUNNING,
+  CT_WAITING_JOB,
+  CT_WAITING_SHUTDOWN
+};
+
+/*
+ * \brief per client-thread data used by gc_job_manager
+ *
+ * "Client threads" are any threads that invoke methods
+ * on gc_job_manager.  We use pthread_set_specific to
+ * store a pointer to one of these for each thread
+ * that comes our way.
+ */
+class gc_client_thread_info {
+public:
+  gc_client_thread_info() :
+    d_allocated(0), d_cond(&d_mutex),
+    d_state(CT_RUNNING), d_jobs_were_waiting_for(0) { }
+
+  ~gc_client_thread_info() {
+    d_jobs_were_waiting_for = 0;
+    d_allocated = 0;
+  }
+
+  gc_atomic_t     d_allocated; // is this gc_client_thread_info allocated ?
+  omni_mutex      d_mutex;     // mutex & condition var used to stop/start 
client
+  omni_condition   d_cond;
+  gc_ct_state_t           d_state;
+  unsigned long          *d_jobs_were_waiting_for;  // bitvector
+};
+
+#endif /* INCLUDED_GC_CLIENT_THREAD_INFO_H */


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

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-20 03:54:09 UTC (rev 7005)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager.cc     
2007-11-20 09:09:57 UTC (rev 7006)
@@ -24,7 +24,7 @@
 #endif
 #include "gc_job_manager.h"
 
-gc_job_manager::gc_job_manager(int nspes)
+gc_job_manager::gc_job_manager(int nspes, const gc_jm_limits *limits)
 {
   // 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-20 03:54:09 UTC (rev 7005)
+++ gnuradio/branches/developers/eb/gcell/src/lib/gc_job_manager_impl.cc        
2007-11-20 09:09:57 UTC (rev 7006)
@@ -24,9 +24,28 @@
 #endif
 #include "gc_job_manager_impl.h"
 
+static const unsigned int DEFAULT_MAX_JOBS = 256;
+static const unsigned int DEFAULT_MAX_CLIENT_THREADS = 64;
 
-gc_job_manager_impl::gc_job_manager_impl(int nspes)
+gc_job_manager_impl::gc_job_manager_impl(int nspes, const gc_jm_limits *limits)
+  : d_nspes(0), d_nclients(0)
 {
+  d_limits.max_jobs = DEFAULT_MAX_JOBS;
+  d_limits.max_client_threads = DEFAULT_MAX_CLIENT_THREADS;
+
+  if (limits != 0){
+    if (limits->max_jobs != 0)
+      d_limits.max_jobs = limits->max_jobs;
+    if (limits->max_client_threads != 0)
+      d_limits.max_client_threads = limits->max_client_threads;
+  }
+
+  for (unsigned int i = 0; i < MAX_SPES; i++)
+    d_spe_context[i] = 0;
+
+  // FIXME more storage init.  Think about shared pointers w/ custom 
destructors
+
+  gc_jd_stack_init(&d_free_list);
 }
 
 gc_job_manager_impl::~gc_job_manager_impl()





reply via email to

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