Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

agent_watcher.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           agent_watcher.h  -  description
00003                              -------------------
00004     begin                : Fri Dec 28 2001
00005     copyright            : (C) 2001 by Vlad Mereuta
00006     email                : dizzy@deity.fsnet.co.uk
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 #ifdef HAVE_CONFIG_H
00018 #include "config.h"
00019 #endif
00020 
00021 #ifndef AGENT_WATCHER_H
00022 #define AGENT_WATCHER_H
00023 
00024 #include <zthread/Thread.h>
00025 #include <zthread/Mutex.h>
00026 #include <zthread/Semaphore.h>
00027 #include <zthread/CountingSemaphore.h>
00028 #include <zthread/Guard.h>
00029 #include <dalt_client/run_time_info.h>
00030 
00031 using namespace ZThread;
00032 using namespace std;
00033 
00034 namespace DALT_Client {
00035 
00042 class AgentWatcher : public Thread
00043 {
00044 private:
00046     int             agents;
00048     Semaphore*      loop_locker;
00050     Mutex           rti_mutex;
00052     Mutex           agents_mutex;
00054     Mutex           l_mon;
00056     bool            locker_idle;
00058     CountingSemaphore*      agent_sem;
00060     RunTimeInfo     rti;
00062     AgentWatcher*   self_reference;
00064     bool            is_new_cycle;
00066     bool            first_run;
00067     
00068 public:
00070     AgentWatcher(AgentWatcher*& ref);
00072     ~AgentWatcher();
00074     void agentFinished();
00077     void addAgentsToWatch(int n);
00079     void newCycle();
00080     /*  @return the last cycle time in ms*/
00081     unsigned long int getLastCycleTime();
00082     /*  @return the average cycle time in ms*/
00083     unsigned long int getAverageCycleTime();
00085     virtual void run() throw();
00086 };
00087 
00088 }
00089 
00090 #endif

Generated at Thu Jan 31 15:20:07 2002 for DALT Client by doxygen1.2.8 written by Dimitri van Heesch, © 1997-2001