milk
1.01
Modular Image processing Library toolKit
|
Tools to manage processes. More...
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/file.h>
#include <malloc.h>
#include <sys/mman.h>
#include <time.h>
#include <signal.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ncurses.h>
#include <fcntl.h>
#include <ctype.h>
#include <dirent.h>
#include <wchar.h>
#include <locale.h>
#include <pthread.h>
#include "CommandLineInterface/timeutils.h"
#include "CLIcore.h"
#include "COREMOD_tools/COREMOD_tools.h"
#include <processtools.h>
Typedefs | |
typedef int | errno_t |
Functions | |
errno_t | processinfo_procdirname (char *procdname) |
PROCESSINFO * | processinfo_setup (char *pinfoname, char descriptionstring[200], char msgstring[200], const char *functionname, const char *filename, int linenumber) |
errno_t | processinfo_error (PROCESSINFO *processinfo, char *errmsgstring) |
errno_t | processinfo_loopstart (PROCESSINFO *processinfo) |
int | processinfo_loopstep (PROCESSINFO *processinfo) |
int | processinfo_compute_status (PROCESSINFO *processinfo) |
long | processinfo_shm_list_create () |
PROCESSINFO * | processinfo_shm_create (const char *pname, int CTRLval) |
PROCESSINFO * | processinfo_shm_link (const char *pname, int *fd) |
int | processinfo_shm_close (PROCESSINFO *pinfo, int fd) |
int | processinfo_cleanExit (PROCESSINFO *processinfo) |
int | processinfo_SIGexit (PROCESSINFO *processinfo, int SignalNumber) |
int | processinfo_WriteMessage (PROCESSINFO *processinfo, const char *msgstring) |
int | processinfo_CatchSignals () |
int | processinfo_ProcessSignals (PROCESSINFO *processinfo) |
errno_t | processinfo_waitoninputstream_init (PROCESSINFO *processinfo, imageID trigID, int triggermode, int semindexrequested) |
Set up input wait stream. More... | |
errno_t | processinfo_waitoninputstream (PROCESSINFO *processinfo) |
Wait on a stream. More... | |
errno_t | processinfo_update_output_stream (PROCESSINFO *processinfo, imageID outstreamID) |
Update ouput stream at completion of processinfo-enabled loop iteration. More... | |
int | processinfo_exec_start (PROCESSINFO *processinfo) |
int | processinfo_exec_end (PROCESSINFO *processinfo) |
static int | processtools__print_header (const char *str, char c) |
static errno_t | initncurses () |
int | GetNumberCPUs (PROCINFOPROC *pinfop) |
static int | GetCPUloads (PROCINFOPROC *pinfop) |
static int | PIDcollectSystemInfo (PROCESSINFODISP *pinfodisp, int level) |
int | processinfo_CPUsets_List (STRINGLISTENTRY *CPUsetList) |
int | processinfo_SelectFromList (STRINGLISTENTRY *StringList, int NBelem) |
void * | processinfo_scan (void *thptr) |
void | processinfo_CTRLscreen_atexit () |
void | processinfo_CTRLscreen_handle_winch (int __attribute__((unused)) sig) |
errno_t | processinfo_CTRLscreen () |
Variables | |
static int | CTRLscreenExitLine = 0 |
static PROCESSINFOLIST * | pinfolist |
static int | wrow |
static int | wcol |
static int | wcolmax |
static struct timespec | t1 |
static struct timespec | t2 |
static struct timespec | tdiff |
static double | scantime_cpuset |
static double | scantime_status |
static double | scantime_stat |
static double | scantime_pstree |
static double | scantime_top |
static double | scantime_CPUload |
static double | scantime_CPUpcnt |
Tools to manage processes.
Manages structure PROCESSINFO.
int GetNumberCPUs | ( | PROCINFOPROC * | pinfop | ) |
detects the number of CPU and fill the cpuids
populates cpuids array with the global system PU numbers in the physical order: [PU0 of CPU0, PU1 of CPU0, ... PU0 of CPU1, PU1 of CPU1, ...]
|
static |
INITIALIZE ncurses
int processinfo_CPUsets_List | ( | STRINGLISTENTRY * | CPUsetList | ) |
Creates list of CPU sets
Uses command: cset set -l
errno_t processinfo_CTRLscreen | ( | ) |
void* processinfo_scan | ( | void * | thptr | ) |
Scan function for processinfo CTRL
Runs in background loop as thread initiated by processinfo_CTRL
PROCESSINFO* processinfo_shm_create | ( | const char * | pname, |
int | CTRLval | ||
) |
Create PROCESSINFO structure in shared memory
The structure holds real-time information about a process, so its status can be monitored and controlled See structure PROCESSINFO in CLLIcore.h for details
long processinfo_shm_list_create | ( | ) |
Read/create processinfo list
If list does not exist, create it and return index = 0
If list exists, return first available index
errno_t processinfo_update_output_stream | ( | PROCESSINFO * | processinfo, |
imageID | outstreamID | ||
) |
Update ouput stream at completion of processinfo-enabled loop iteration.
errno_t processinfo_waitoninputstream | ( | PROCESSINFO * | processinfo | ) |
Wait on a stream.
errno_t processinfo_waitoninputstream_init | ( | PROCESSINFO * | processinfo, |
imageID | trigID, | ||
int | triggermode, | ||
int | semindexrequested | ||
) |
Set up input wait stream.
Specify stream on which the loop process will be triggering, and what is the trigger mode.
The actual trigger mode may be different from the requested trigger mode.
The standard option should be tiggermode = PROCESSINFO_TRIGGERMODE_SEMAPHORE and semindex = -1, which will automatically find a suitable semaphore