00001 //------------------------------------------------------------- 00002 // Go4 Release Package v3.04-01 (build 30401) 00003 // 28-November-2008 00004 //--------------------------------------------------------------- 00005 // The GSI Online Offline Object Oriented (Go4) Project 00006 // Experiment Data Processing at EE 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 "Riostream.h" 00019 00020 #include "TGo4Log.h" 00021 #include "TGo4LockGuard.h" 00022 #include "TGo4Thread.h" 00023 #include "TGo4Task.h" 00024 00025 #include "TGo4ClientStatus.h" 00026 #include "TGo4AnalysisClientImp.h" 00027 #include "TGo4AnalysisImp.h" 00028 00029 const UInt_t TGo4AnalysisWatchRunnable::fguWATCHINTERVAL=1000; 00030 //const UInt_t TGo4AnalysisWatchRunnable::fguWATCHINTERVAL=50; 00031 00032 TGo4AnalysisWatchRunnable::TGo4AnalysisWatchRunnable(const char* name, TGo4AnalysisClient* cli) 00033 : TGo4Runnable(name,cli->GetTask()), fxAnalysisClient(cli) 00034 { 00035 fxAnalysis=cli->GetAnalysis(); 00036 } 00037 00038 TGo4AnalysisWatchRunnable::~TGo4AnalysisWatchRunnable() 00039 { 00040 00041 } 00042 00043 Int_t TGo4AnalysisWatchRunnable::Run(void*) 00044 { 00045 // check if ratemeter was updated 00046 if (fxAnalysis && fxAnalysis->IsInitDone()) 00047 { 00048 if(!fxAnalysisClient->TestRatemeter()) 00049 { 00050 // no, we have to update it ourselves and fill the status buffer 00051 if(fxAnalysisClient->MainIsRunning()) 00052 fxAnalysisClient->UpdateRate(0); // update with calculation of time and average rate 00053 else 00054 fxAnalysisClient->UpdateRate(-1); // stopped: keep latest values for time and avrate 00055 { 00056 //TGo4LockGuard mainguard; // in UpdateStatusBuffer now JA 00057 //cout << "watch runnable updated status buffer itself!!!"<< endl; 00058 fxAnalysisClient->UpdateStatusBuffer(); 00059 } // lock guard 00060 } 00061 else 00062 { // yes, main thread is running on that, we do nothing 00063 00064 } // if(!fxAnalysisClient->TestRatemeter()) 00065 fxAnalysisClient->SendAnalysisClientStatus(); 00066 } 00067 else 00068 { // analysis not initialized, no status to update 00069 00070 } // if (ana && ana->fbInitIsDone) 00071 00072 TGo4Thread::Sleep(fguWATCHINTERVAL); 00073 return 0; 00074 } 00075 00076 //----------------------------END OF GO4 SOURCE FILE ---------------------