Belle II Software light-2406-ragdoll
|
A class to manage processes for parallel processing. More...
#include <GlobalProcHandler.h>
Static Public Member Functions | |
static void | initialize (unsigned int nWorkerProc) |
Create a new process handler, which will handle nWorkerProc processes. | |
static bool | startInputProcess () |
Fork and initialize an input process. | |
static bool | startWorkerProcesses (unsigned int numProcesses) |
Fork and initialize as many worker processes as requested. | |
static bool | startOutputProcess (bool local=false) |
Fork and initialize an output process. | |
static bool | startProxyProcess () |
Fork and initialize a proxy process. | |
static bool | startMonitoringProcess () |
Fork and initialize a monitoring process. | |
static void | waitForAllProcesses () |
Wait until all forked processes handled by this GlobalProcHandler. | |
static bool | parallelProcessingUsed () |
Returns true if multiple processes have been spawned, false in single-core mode. | |
static bool | isInputProcess () |
Return true if the process is of type c_Input. | |
static bool | isWorkerProcess () |
Return true if the process is of type c_Worker. | |
static bool | isOutputProcess () |
Return true if the process is of type c_Output. | |
static int | numEventProcesses () |
Return number of worker processes (configured value, not current) | |
static int | EvtProcID () |
Get the ID of this process. Attention: this ID may not be a stable API feature. | |
static std::string | getProcessName () |
Get a human readable name for this process. (input, event, output...). | |
static void | killAllProcesses () |
Hard kill all processes. | |
static const std::vector< int > & | getPIDList () |
Return the PID list handled by the running GlobalProcHandler. This PID list is updated using the signal handlers and the startup of processes. | |
static bool | isProcess (ProcType procType) |
Return true if the process is of type procType. | |
static ProcType | getProcType (int pid) |
Return the proc type of this process. | |
Static Private Member Functions | |
static bool | startProc (ProcType procType, int id) |
Start a new process, sets the type and id and returns true if in this new process. | |
static void | addPID (int pid) |
Add a new PID. Is called when forking. | |
static bool | findPID (int pid) |
Find a PID in the list and return true, if found. | |
static void | removePID (int pid) |
Remove a PID from the list by setting it to 0. | |
static void | clearPIDs () |
Remove all PIDs. | |
static bool | pidListEmpty () |
Check if the PID list is empty (only 0). | |
static void | childSignalHandler (int) |
This function is called on SIG_CLD. | |
Static Private Attributes | |
static ProcType | s_procType = ProcType::c_Init |
Our current proc type. | |
static int | s_processID = -1 |
Our current process id. | |
static int | s_numEventProcesses = 0 |
How many processes are handled in this GlobalProcHandler. | |
static std::vector< int > | s_pidVector |
global list of PIDs managed by GlobalProcHandler. | |
static std::map< int, ProcType > | s_startedPIDs |
Which PIDs were started with which types. | |
A class to manage processes for parallel processing.
Definition at line 22 of file GlobalProcHandler.h.
|
staticprivate |
Add a new PID. Is called when forking.
Definition at line 83 of file GlobalProcHandler.cc.
|
staticprivate |
This function is called on SIG_CLD.
Definition at line 40 of file GlobalProcHandler.cc.
|
staticprivate |
Remove all PIDs.
Definition at line 111 of file GlobalProcHandler.cc.
|
static |
Get the ID of this process. Attention: this ID may not be a stable API feature.
Definition at line 238 of file GlobalProcHandler.cc.
|
staticprivate |
Find a PID in the list and return true, if found.
Definition at line 96 of file GlobalProcHandler.cc.
|
static |
Return the PID list handled by the running GlobalProcHandler. This PID list is updated using the signal handlers and the startup of processes.
Definition at line 257 of file GlobalProcHandler.cc.
|
static |
Get a human readable name for this process. (input, event, output...).
Definition at line 221 of file GlobalProcHandler.cc.
|
static |
Return the proc type of this process.
Definition at line 262 of file GlobalProcHandler.cc.
|
static |
Create a new process handler, which will handle nWorkerProc processes.
Definition at line 126 of file GlobalProcHandler.cc.
|
static |
Return true if the process is of type c_Input.
Definition at line 286 of file GlobalProcHandler.cc.
|
static |
Return true if the process is of type c_Output.
Definition at line 276 of file GlobalProcHandler.cc.
|
static |
Return true if the process is of type procType.
Definition at line 177 of file GlobalProcHandler.cc.
|
static |
Return true if the process is of type c_Worker.
Definition at line 281 of file GlobalProcHandler.cc.
|
static |
Hard kill all processes.
Definition at line 243 of file GlobalProcHandler.cc.
|
static |
Return number of worker processes (configured value, not current)
Definition at line 271 of file GlobalProcHandler.cc.
|
static |
Returns true if multiple processes have been spawned, false in single-core mode.
Definition at line 172 of file GlobalProcHandler.cc.
|
staticprivate |
Check if the PID list is empty (only 0).
Definition at line 116 of file GlobalProcHandler.cc.
|
staticprivate |
Remove a PID from the list by setting it to 0.
Definition at line 101 of file GlobalProcHandler.cc.
|
static |
Fork and initialize an input process.
Definition at line 141 of file GlobalProcHandler.cc.
|
static |
Fork and initialize a monitoring process.
Definition at line 166 of file GlobalProcHandler.cc.
|
static |
Fork and initialize an output process.
If local is true, do not fork.
Definition at line 156 of file GlobalProcHandler.cc.
|
staticprivate |
Start a new process, sets the type and id and returns true if in this new process.
Also adds the signal handling.
Definition at line 182 of file GlobalProcHandler.cc.
|
static |
|
static |
Fork and initialize as many worker processes as requested.
Definition at line 146 of file GlobalProcHandler.cc.
|
static |
Wait until all forked processes handled by this GlobalProcHandler.
Definition at line 291 of file GlobalProcHandler.cc.
|
staticprivate |
How many processes are handled in this GlobalProcHandler.
Definition at line 77 of file GlobalProcHandler.h.
|
staticprivate |
global list of PIDs managed by GlobalProcHandler.
Definition at line 80 of file GlobalProcHandler.h.
|
staticprivate |
Our current process id.
Definition at line 75 of file GlobalProcHandler.h.
|
staticprivate |
Our current proc type.
Definition at line 73 of file GlobalProcHandler.h.
|
staticprivate |
Which PIDs were started with which types.
Definition at line 82 of file GlobalProcHandler.h.