Include dependency graph for rk_stub.c:
Defines | |
#define | max(x, y) ((x) > (y) ? (x) : (y)) |
Return the maximum of two values. | |
#define | min(x, y) ((x) < (y) ? (x) : (y)) |
Return the minimum of two values. | |
Functions | |
void | rk_cpu_reserve_tick (rk_resource_set_t rs, cpu_reserve_t cr, struct timespec *curr, struct timespec *next, struct timespec *new_compute) |
int | rk_name_valid (const char *name) |
Validate a user provided name value. | |
int | rk_reserve_mode_valid (rk_reserve_mode_t rm) |
Validate a user provided rk_reserve_mode_t value. | |
int | rk_reserve_param_valid (rk_reserve_param_t rp) |
Validate a user provided rk_reserve_param_t value. | |
int | rk_cpu_reserve_attr_valid (cpu_reserve_attr_t ra_in) |
Validate a user provided cpu_reserve_attr_t value. | |
int | cpu_reserve_valid (cpu_reserve_t cr) |
Validate a user provided cpu_reserve_t value. | |
int | rk_resource_set_valid (rk_resource_set_t rs) |
Validate a user provided rk_resource_set_t value. | |
char * | rk_reserve_mode_string (rk_reserve_mode_t rm) |
Get the string version of an rk_reserve_mode_t value. | |
char * | rk_reserve_param_string (rk_reserve_param_t rp) |
Get the string version of an rk_reserve_param_t value. | |
char * | cpu_reserve_attr_string (cpu_reserve_attr_t ra) |
Get the string version of a cpu_reserve_attr_t value. | |
char * | cpu_reserve_string (cpu_reserve_t cr) |
Get the string version of a cpu_reserve_t value. | |
char * | rk_resource_set_string (rk_resource_set_t rs) |
Get the string version of a rk_resource_set_t value. | |
char * | rk_stub_pcb_string (pid_t pid) |
Get the string version of a simulated pid_t value. | |
void | rk_inherit_mode (int dummy) |
Not implemented. | |
rk_resource_set_t | rk_resource_set_create (const char *name) |
Construct a mock resource set with the given name. | |
void | rk_resource_set_destroy (rk_resource_set_t rs) |
Destroy a resource set. | |
int | rk_resource_set_set_name (rk_resource_set_t rs, const char *name) |
Set the name of a resource set. | |
int | rk_resource_set_get_name (rk_resource_set_t rs, char *name_out) |
Get the name of a resource set. | |
rk_reserve_t | rk_resource_set_get_cpu_rsv (rk_resource_set_t rs) |
Get the CPU reserve from the given resource set. | |
int | rk_resource_set_attach_process (rk_resource_set_t rs, pid_t pid) |
Attach a process to the resource set so that its callbacks will be used when a data period is starting/ending. | |
int | rk_resource_set_detach_process (rk_resource_set_t rs, pid_t pid) |
Detach a process to the resource set. | |
rk_resource_set_t | rk_proc_get_rset (pid_t pid) |
Get the resource set attached to the given process. | |
int | rk_cpu_reserve_create (rk_resource_set_t rs, rk_reserve_t *r_out, cpu_reserve_attr_t ra_in) |
Create a CPU reserve for the given resource set. | |
void | rk_cpu_reserve_delete (rk_resource_set_t rs) |
Delete a CPU reserve held by a resource set. | |
int | rk_cpu_reserve_get_attr (rk_reserve_t cr, cpu_reserve_attr_t ra_out) |
Get the reservation parameters for a given CPU reserve. | |
int | rk_cpu_reserve_ctl (rk_resource_set_t rs, cpu_reserve_attr_t ra_in) |
Change a CPU reserve's scheduling parameters. | |
int | rk_clock_gettime (clockid_t clock_id, struct timespec *ts) |
Get the simulator's virtual time. | |
int | rk_clock_settime (clockid_t clock_id, struct timespec *ts) |
Set the simulator's virtual time. | |
int | rk_clock_getres (clockid_t clock_id, struct timespec *ts) |
Get the simulator's virtual clock resolution. | |
void | rk_stub_set_mode (rk_stub_mode_t mode) |
Initialize the stub code and set the desired mode. | |
void | rk_next_tick (struct timespec *next, struct timespec *curr, struct timespec *new_next) |
void | rk_stub_next_tick (void) |
Advance the simulated time. | |
pid_t | rk_stub_mk_pid (const char *name, void *data, rk_stub_precall_t precall, rk_stub_postcall_t postcall) |
Make a simulated process that will "consume" resources during its period. | |
void | rk_stub_getrusage (pid_t pid, struct rusage *ru) |
Get the CPU usage for the simulated process. | |
Variables | |
rk_stub_data | rk_stub_data |
Global data for the rk_stub functions. | |
char * | rk_cpu_trace_names [RK_CPU_TRACE_MAX] |
The string forms of the trace file enumeration. |
|
Get the string version of a cpu_reserve_attr_t value.
|
|
Get the string version of a cpu_reserve_t value.
|
|
Validate a user provided cpu_reserve_t value. Validation is done by checking the pointer against the internal list of resource sets.
|
|
Get the simulator's virtual clock resolution.
|
|
Get the simulator's virtual time.
|
|
Set the simulator's virtual time. This function should really only be used to set the time to a value _before_ the next event.
|
|
Validate a user provided cpu_reserve_attr_t value. A valid reserve must have the following attributes:
|
|
Create a CPU reserve for the given resource set. In order to simulate this reserve, a "times" file must be available in the current directory. The contents of the file should be a whitespace separated list of floats that specify the percentage of CPU time required by the process for a repeating sequence of periods. For example, the times file for a resource set named "steady_50" that required 50% of the CPU at every period would be named "steady_50_cpu_times" and contain only "50.0". Another, more complex example, would be a reserve that oscillated between 10% and 50% with 10% steps would contain "10.0 20.0 30.0 40.0 50.0 40.0 30.0 20.0 10.0". The output of CPU simulation is a set of files that can be fed into gnuplot. The contents of the file are two columns of numbers, a time value, and a CPU percentage or an arbitrary value that marks some event. The current list of files is:
|
|
Change a CPU reserve's scheduling parameters.
|
|
Delete a CPU reserve held by a resource set.
|
|
Get the reservation parameters for a given CPU reserve.
|
|
Validate a user provided name value. Currently, the only test is whether or not the name is printable.
|
|
Get the resource set attached to the given process.
|
|
Get the string version of an rk_reserve_mode_t value.
|
|
Validate a user provided rk_reserve_mode_t value. The only valid values are listed in the enumeration.
|
|
Get the string version of an rk_reserve_param_t value.
|
|
Validate a user provided rk_reserve_param_t value. A valid rk_reserve_param_t must have the following attributes:
|
|
Attach a process to the resource set so that its callbacks will be used when a data period is starting/ending. Note: The simulator only supports one process being attached at a time.
|
|
Construct a mock resource set with the given name. The name has special meaning in the simulator, it will be used as the base for any files that are produced or read by the stub code. For example, a file produced or read by the CPU reserve will use file names of the form: _cpu_<file-type>.
|
|
Destroy a resource set.
|
|
Detach a process to the resource set.
|
|
Get the CPU reserve from the given resource set.
|
|
Get the name of a resource set.
|
|
Set the name of a resource set. This is provided for compatibility and is otherwise unwise to use since the name has meaning in the simulation code.
|
|
Get the string version of a rk_resource_set_t value.
|
|
Validate a user provided rk_resource_set_t value. Validation is done by checking the pointer against the internal list of resource sets.
|
|
Get the CPU usage for the simulated process.
|
|
Make a simulated process that will "consume" resources during its period.
|
|
Advance the simulated time. Simulated time starts at zero and then continually advances to the next simulated event, such as a period end. |
|
Get the string version of a simulated pid_t value.
|
|
Initialize the stub code and set the desired mode.
|
|
Initial value: { "period", "deadline", "complete", "drop", "realtime", "success", "fail" }
|