CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_8_patch3/src/EventFilter/Utilities/interface/Vulture.h

Go to the documentation of this file.
00001 #ifndef EVENTFILTER_UTILITIES_VULTURE_H
00002 #define EVENTFILTER_UTILITIES_VULTURE_H
00003 
00004 
00005 
00006 #include <string>
00007 #include <vector>
00008 
00009 #include <sys/types.h>
00010 #include <dirent.h>
00011 #include <stdint.h>
00012 
00013 #include <toolbox/lang/Class.h>
00014 
00015 #include "EventFilter/Utilities/interface/MasterQueue.h"
00016 #include "EventFilter/Utilities/interface/SlaveQueue.h"
00017 
00018 namespace toolbox{
00019   namespace task{
00020     class WorkLoop;
00021     class ActionSignature;
00022   }
00023 }
00024 
00025 namespace evf{
00026 
00027   class CurlPoster;
00028   
00029   static const int VULTURE_START_MESSAGE_URL_SIZE = 128;
00030 
00031   struct vulture_start_message{
00032     char url_[VULTURE_START_MESSAGE_URL_SIZE];
00033     int  run_;
00034   };
00035 
00036   class Vulture : public toolbox::lang::Class {
00037 
00038   public:
00039 
00040     Vulture(bool);
00041     virtual ~Vulture();
00042     pid_t makeProcess();
00043     int start(std::string,int=0);
00044     int stop();
00045     int  hasStarted();
00046     int  hasStopped();
00047     pid_t kill();
00048     void retrieve_corefile(char *, char *, uint64_t);
00049 
00050 
00051   private:
00052     
00053     static const int vulture_queue_offset = 400;
00054     void startProwling();
00055     bool control(toolbox::task::WorkLoop*);
00056     bool prowling(toolbox::task::WorkLoop*);
00057     void analyze();
00058 
00059     static const std::string FS;
00060     toolbox::task::WorkLoop         *wlCtrl_;      
00061     toolbox::task::ActionSignature  *asCtrl_;
00062     bool                             running_;
00063     toolbox::task::WorkLoop         *wlProwl_;      
00064     toolbox::task::ActionSignature  *asProwl_;
00065     bool                             prowling_;
00066     std::string                      iDieUrl_;
00067     bool                             updateMode_;
00068     pid_t                            vulturePid_;
00069     DIR                             *tmp_;
00070     std::vector<std::string>         currentCoreList_;
00071     time_t                           lastUpdate_;
00072     unsigned int                     newCores_;
00073     CurlPoster                      *poster_;
00074     MasterQueue                     *mq_;
00075     SlaveQueue                      *sq_;
00076     int                              started_;
00077     int                              stopped_;
00078     bool                             handicapped_;
00079   };
00080 }
00081 #endif