RocketLogger  1.0
lib_util.c File Reference
#include "rl_util.h"
+ Include dependency graph for lib_util.c:

Go to the source code of this file.

Macros

#define NUMBER_SAMPLE_RATES   10
 Number of possible sampling rates. More...
 
#define NUMBER_UPDATE_RATES   4
 Number of possible update rates. More...
 

Functions

int check_sample_rate (int sample_rate)
 
int check_update_rate (int update_rate)
 
pid_t get_pid (void)
 
int set_pid (pid_t pid)
 

Variables

int possible_sample_rates [NUMBER_SAMPLE_RATES] = {1, 10, 100, 1000, 2000, 4000, 8000, 16000, 32000, 64000}
 Possible sampling rates. More...
 
int possible_update_rates [NUMBER_UPDATE_RATES] = {1,2,5,10}
 Possible update rates. More...
 

Macro Definition Documentation

#define NUMBER_SAMPLE_RATES   10

Number of possible sampling rates.

Copyright (c) 2016-2017, ETH Zurich, Computer Engineering Group

Definition at line 8 of file lib_util.c.

Referenced by check_sample_rate().

#define NUMBER_UPDATE_RATES   4

Number of possible update rates.

Definition at line 13 of file lib_util.c.

Referenced by check_update_rate().

Function Documentation

int check_sample_rate ( int  sample_rate)

Check if provided sampling rate is possible

Parameters
sample_rateSampling rate
Returns
SUCCESS if possible, FAILURE otherwise

Definition at line 22 of file lib_util.c.

References FAILURE, NUMBER_SAMPLE_RATES, possible_sample_rates, and SUCCESS.

Referenced by parse_args(), and rl_start().

int check_update_rate ( int  update_rate)

Check if provided update rate is possible

Parameters
update_rateUpdate rate
Returns
SUCCESS if possible, FAILURE otherwise

Definition at line 37 of file lib_util.c.

References FAILURE, NUMBER_UPDATE_RATES, possible_update_rates, and SUCCESS.

Referenced by parse_args(), and rl_start().

pid_t get_pid ( void  )

Get process ID (PID) of background sampling process

Returns
PID of background process

Definition at line 51 of file lib_util.c.

References FAILURE, and PID_FILE.

Referenced by rl_get_status(), rl_read_status(), and rl_stop().

int set_pid ( pid_t  pid)

Store process ID (PID)

Parameters
pidOwn PID
Returns
SUCCESS in case of success, FAILURE otherwise.

Definition at line 74 of file lib_util.c.

References ERROR, FAILURE, PID_FILE, rl_log(), and SUCCESS.

Referenced by rl_start().

+ Here is the call graph for this function:

Variable Documentation

int possible_sample_rates[NUMBER_SAMPLE_RATES] = {1, 10, 100, 1000, 2000, 4000, 8000, 16000, 32000, 64000}

Possible sampling rates.

Definition at line 10 of file lib_util.c.

Referenced by check_sample_rate().

int possible_update_rates[NUMBER_UPDATE_RATES] = {1,2,5,10}

Possible update rates.

Definition at line 15 of file lib_util.c.

Referenced by check_update_rate().