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

SleepModule.cxx

Go to the documentation of this file.
00001 #include "SleepModule.h"
00002 
00003 #include <Conventions/Munits.h>
00004 #include <JobControl/JobCModuleRegistry.h>
00005 #include <JobControl/JobCResult.h>
00006 #include <MessageService/MsgService.h>
00007 
00008 #include <JobControl/JobCPath.h>
00009 
00010 // For current_file
00011 #include <IoModules/IoInputModule.h>
00012 
00013 #include <TSystem.h>
00014 #include <TStopwatch.h>
00015 
00016 CVSID("$Id: SleepModule.cxx,v 1.2 2005/04/15 14:50:02 bv Exp $");
00017 JOBMODULE(SleepModule,"Sleep","Sleep for a while");
00018 
00019 SleepModule::SleepModule()
00020 {
00021 }
00022 SleepModule::~SleepModule()
00023 {
00024 }
00025 
00026 void SleepModule::BeginRun()
00027 {
00028     MSG("Sleep",Msg::kDebug) << " begin run \n";
00029 }
00030 void SleepModule::EndRun()
00031 {
00032     MSG("Sleep",Msg::kDebug) << " end run \n";
00033 }
00034 
00035 void SleepModule::BeginFile()
00036 {
00037     const char* file = this->GetCurrentFile();
00038     if (!file) file = "unknown";
00039     MSG("Sleep",Msg::kDebug)
00040         << " begin file:" << file << endl;
00041 }
00042 void SleepModule::EndFile()
00043 {
00044     const char* file = this->GetCurrentFile();
00045     if (!file) file = "unknown";
00046     MSG("Sleep",Msg::kDebug)
00047         << " end file:" << file << endl;
00048 }
00049 
00050 JobCResult SleepModule::Ana(const MomNavigator *)
00051 {
00052     double delay = 1.0;
00053     this->GetConfig().Get("delay",delay);
00054     
00055     MSG("Sleep",Msg::kVerbose)
00056         << "Sleeping for " << delay/Munits::millisecond << " msec\n";
00057     TStopwatch timer;
00058     timer.Start();    
00059     gSystem->Sleep((int)(delay/Munits::millisecond));
00060     timer.Stop();
00061     MSG("Sleep",Msg::kVerbose)
00062         << "Slept for: " << timer.RealTime() << endl;
00063     
00064     return JobCResult::kAOK;
00065 }
00066 const Registry& SleepModule::DefaultConfig() const
00067 {
00068     static Registry cfg;
00069     if (cfg.Size() == 0) {
00070         cfg.Set("delay",1.0);
00071     }
00072     return cfg;
00073 }

Generated on Mon Feb 15 11:07:38 2010 for loon by  doxygen 1.3.9.1