The ROme OpTimistic Simulator  3.0.0
A General-Purpose Multithreaded Parallel/Distributed Simulation Platform
init.c File Reference

Initialization routines. More...

#include <core/init.h>
#include <arch/io.h>
#include <arch/thread.h>
#include <core/arg_parse.h>
#include <core/core.h>
#include <inttypes.h>
#include <limits.h>
#include <memory.h>
#include <stdlib.h>
+ Include dependency graph for init.c:

Go to the source code of this file.

Macros

#define ROOTSIM_VERSION   "debugging_version"
 

Enumerations

enum  option_key {
  OPT_NPRC, OPT_LOG, OPT_CLOG, OPT_SIMT,
  OPT_GVT, OPT_NP, OPT_BIND, OPT_SERIAL,
  OPT_SEED, OPT_LAST
}
 This is the list of arg_parse.h mnemonics for command line arguments.
 

Functions

static void print_config (void)
 Pretty prints ROOT-Sim current configuration.
 
static unsigned long long parse_ullong_limits (const char *str, unsigned long long low, unsigned long long high, bool *err_chk)
 Parses a string into a unsigned long long value with bounds checks. More...
 
static long double parse_ldouble_limits (const char *str, long double low, long double high, bool *err_chk)
 Parses a string into a long double value with bounds checks. More...
 
static void parse_opt (int key, const char *arg)
 Parses a single ROOT-Sim option, also handles parsing events. More...
 
void model_parse (int key, const char *arg)
 
void init_args_parse (int argc, char **argv)
 Parses ROOT-Sim command line arguments. More...
 

Variables

struct simulation_configuration global_config
 The configuration filled in by init_args_parse()
 
static struct ap_option ap_options []
 The array of ROOT-Sim supported command line options. More...
 
struct ap_option model_options [] = {0}
 
struct ap_section ap_sects []
 The struct ap_section containing ROOT-Sim internal parser and the model one. More...
 
struct ap_settings ap_sets
 The struct ap_settings with the ROOT-Sim command line parsing configuration. More...
 

Detailed Description

Initialization routines.

This module implements the simulator initialization routines

Definition in file init.c.

Function Documentation

◆ init_args_parse()

void init_args_parse ( int  argc,
char **  argv 
)

Parses ROOT-Sim command line arguments.

Parameters
argcthe argc value from the main() function
argvthe argv value from the main() function

The result of the parsing is stored in the global_config variable.

Definition at line 217 of file init.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parse_ldouble_limits()

static long double parse_ldouble_limits ( const char *  str,
long double  low,
long double  high,
bool *  err_chk 
)
static

Parses a string into a long double value with bounds checks.

Parameters
strThe string to parse
lowThe minimum allowed value of the parsed value
highThe maximum allowed value of the parsed value
err_chkA valid pointer to a boolean, which gets set in case of errors
Returns
The parsed long double value or undefined in case of errors

Definition at line 89 of file init.c.

◆ parse_opt()

static void parse_opt ( int  key,
const char *  arg 
)
static

Parses a single ROOT-Sim option, also handles parsing events.

Parameters
keythe key identifying the currently parsed option or event
argthe command line argument supplied with the option if present

This is used in ROOT-Sim struct ap_section

Definition at line 105 of file init.c.

◆ parse_ullong_limits()

static unsigned long long parse_ullong_limits ( const char *  str,
unsigned long long  low,
unsigned long long  high,
bool *  err_chk 
)
static

Parses a string into a unsigned long long value with bounds checks.

Parameters
strThe string to parse
lowThe minimum allowed value of the parsed value
highThe maximum allowed value of the parsed value
err_chkA valid pointer to a boolean, which gets set in case of errors
Returns
The parsed unsigned long long value or undefined in case of errors

Definition at line 72 of file init.c.

Variable Documentation

◆ ap_options

struct ap_option ap_options[]
static
Initial value:
= {
{"lp", OPT_NPRC, "VALUE", "Total number of Logical Processes being launched at simulation startup"},
{"log-level", OPT_LOG, "TYPE", "Logging level"},
{"time", OPT_SIMT, "VALUE", "Logical time at which the simulation will be considered completed"},
{"gvt-period", OPT_GVT, "VALUE", "Time between two GVT reductions (in milliseconds)"},
{"serial", OPT_SERIAL, NULL, "Runs a simulation with the serial runtime"},
{"wt", OPT_NP, "VALUE", "Number of total cores being used by the simulation"},
{"no-bind", OPT_BIND, NULL, "Disables thread to core binding"},
{"seed", OPT_SEED, "VALUE", "The seed value for the PRNG"},
{0}
}

The array of ROOT-Sim supported command line options.

Definition at line 44 of file init.c.

◆ ap_sects

struct ap_section ap_sects[]
Initial value:
= {
{"Model specific options", model_options, model_parse},
{0}
}

The struct ap_section containing ROOT-Sim internal parser and the model one.

Definition at line 196 of file init.c.

◆ ap_sets

struct ap_settings ap_sets
Initial value:
= {
"ROOT-Sim",
"debugging_version" ,
"rootsim@googlegroups.com",
}

The struct ap_settings with the ROOT-Sim command line parsing configuration.

Definition at line 203 of file init.c.

ap_sects
struct ap_section ap_sects[]
The struct ap_section containing ROOT-Sim internal parser and the model one.
Definition: init.c:196
parse_opt
static void parse_opt(int key, const char *arg)
Parses a single ROOT-Sim option, also handles parsing events.
Definition: init.c:105
ap_options
static struct ap_option ap_options[]
The array of ROOT-Sim supported command line options.
Definition: init.c:44