00001 //--------------------------------------------------------------- 00002 // Go4 Release Package v2.10-5 (build 21005) 00003 // 03-Nov-2005 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at DVEE department, GSI 00007 //--------------------------------------------------------------- 00008 // 00009 //Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI 00010 // Planckstr. 1, 64291 Darmstadt, Germany 00011 //Contact: http://go4.gsi.de 00012 //---------------------------------------------------------------- 00013 //This software can be used under the license agreements as stated 00014 //in Go4License.txt file which is part of the distribution. 00015 //---------------------------------------------------------------- 00016 #include "TGo4AnalysisWatchRunnable.h" 00017 00018 #include <iostream.h> 00019 00020 #include "Go4Log/TGo4Log.h" 00021 #include "Go4LockGuard/TGo4LockGuard.h" 00022 00023 #include "Go4TaskHandler/TGo4ClientStatus.h" 00024 #include "Go4AnalysisClient/TGo4AnalysisClientImp.h" 00025 #include "Go4Analysis/TGo4AnalysisImp.h" 00026 00027 const UInt_t TGo4AnalysisWatchRunnable::fguWATCHINTERVAL=1000; 00028 //const UInt_t TGo4AnalysisWatchRunnable::fguWATCHINTERVAL=50; 00029 00030 TGo4AnalysisWatchRunnable::TGo4AnalysisWatchRunnable(const char* name, TGo4AnalysisClient* cli) 00031 : TGo4Runnable(name,cli->GetTask()), fxAnalysisClient(cli) 00032 { 00033 fxAnalysis=cli->GetAnalysis(); 00034 } 00035 00036 TGo4AnalysisWatchRunnable::~TGo4AnalysisWatchRunnable() 00037 { 00038 00039 } 00040 00041 Int_t TGo4AnalysisWatchRunnable::Run(void*) 00042 { 00043 // check if ratemeter was updated 00044 if (fxAnalysis && fxAnalysis->IsInitDone()) 00045 { 00046 if(!fxAnalysisClient->TestRatemeter()) 00047 { 00048 // no, we have to update it ourselves and fill the status buffer 00049 if(fxAnalysisClient->MainIsRunning()) 00050 fxAnalysisClient->UpdateRate(0); // update with calculation of time and average rate 00051 else 00052 fxAnalysisClient->UpdateRate(-1); // stopped: keep latest values for time and avrate 00053 { 00054 TGo4LockGuard mainguard; 00055 //cout << "watch runnable updated status buffer itself!!!"<< endl; 00056 fxAnalysisClient->UpdateStatusBuffer(); 00057 } // lock guard 00058 } 00059 else 00060 { // yes, main thread is running on that, we do nothing 00061 00062 } // if(!fxAnalysisClient->TestRatemeter()) 00063 fxAnalysisClient->SendAnalysisClientStatus(); 00064 } 00065 else 00066 { // analysis not initialized, no status to update 00067 00068 } // if (ana && ana->fbInitIsDone) 00069 00070 TGo4Thread::Sleep(fguWATCHINTERVAL); 00071 return 0; 00072 } 00073 00074 //----------------------------END OF GO4 SOURCE FILE ---------------------