Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

VrMultiTask.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*- */
00002 /*
00003  * Copyright 2001,2003 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * GNU Radio is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 /*
00023  *  Copyright 1997 Massachusetts Institute of Technology
00024  * 
00025  *  Permission to use, copy, modify, distribute, and sell this software and its
00026  *  documentation for any purpose is hereby granted without fee, provided that
00027  *  the above copyright notice appear in all copies and that both that
00028  *  copyright notice and this permission notice appear in supporting
00029  *  documentation, and that the name of M.I.T. not be used in advertising or
00030  *  publicity pertaining to distribution of the software without specific,
00031  *  written prior permission.  M.I.T. makes no representations about the
00032  *  suitability of this software for any purpose.  It is provided "as is"
00033  *  without express or implied warranty.
00034  * 
00035  */
00036 
00037 #ifndef _VRMULTITASK_H_
00038 #define _VRMULTITASK_H_
00039 
00040 #include <VrSigProc.h>
00041 
00042 #ifdef PERFMON
00043 #include <VrPerfGraph.h>
00044 #endif
00045 
00046 extern int BufferSizeMultiplier;
00047 
00049 
00050 class VrMultiTask {
00051 private:
00052   VrSigProc **sinks;     
00053   int numberSinks;       
00054 
00055   VrSigProc **goodSinks; 
00056   int numSinks;          
00057   int numThreads;
00058 
00059 #ifdef THREADS
00060   pthread_t *threads;
00061   
00063   pthread_cond_t start_condition;
00065   pthread_mutex_t mutex;
00066 #endif
00067 
00068   volatile int stopFlag;
00069   struct timeval initialTime;
00070 
00071 #ifdef PERFMON
00072   VrPerfGraph *perfgraph;
00073 #endif
00074 
00075 public:
00076   VrMultiTask ();
00077   VrMultiTask (int n_threads);
00078   ~VrMultiTask ();
00079   
00080 
00081   void add (VrSigProc *s);
00082 
00083   void start();         
00084   void stop();          
00085   void process();       
00086 
00087   int isStarted() {return !stopFlag;}
00088 
00089 #ifdef PERFMON
00090   VrPerfGraph *getGraph() {return perfgraph;}
00091   void print_stats();
00092 #endif
00093 
00094   //Internal methods:
00095   void schedule();
00096   void startTimer();
00097 
00098   //Call to find out how long the system has been running:
00099   double elapsedTime();
00100 
00101 
00102 #ifdef THREADS
00103   void start_worker_threads();
00104   void _start_worker();
00105 #endif
00106 
00107 };
00108 
00109 #endif

Generated on Tue Mar 15 23:47:08 2005 for GNU Radio by  doxygen 1.4.0