MAOS
Multithreaded Adaptive Optics Simulator
Loading...
Searching...
No Matches
process.c File Reference

Functions

void init_process (void)
void set_dirout (const char *dir)
void free_process ()
double get_usage_cpu (void)
int get_cpu_avail (void)

Detailed Description

Obtain information about system

A few routines handles process resource.

Function Documentation

◆ init_process()

void init_process ( void )

Set the HOME, TEMP, USER names.

◆ set_dirout()

void set_dirout ( const char * dir)

Set DIROUT, the result directory, to the absolute path of dir with the build directory and HOME abbreviated.

Parameters
[in]dirOutput directory. Uses the current directory if NULL.

◆ free_process()

void free_process ( void )

Free the path strings (DIRBUILD, DIRCACHE, DIROUT, HOST, etc.) allocated by init_process(). TEMP and HOME are kept.

◆ get_usage_cpu()

double get_usage_cpu ( void )

Obtain the current usage level of CPU, between 0 and 1.

Returns
Fraction of CPU time spent in user/system since the previous call (cached if called within 0.1 s).

◆ get_cpu_avail()

int get_cpu_avail ( void )

Return number of idle CPUs that are available to run jobs. Do not count hyperthread cores.

Returns
Number of available CPUs, 0 if the load is too high.