Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

rk_stub.h File Reference


Detailed Description

The simulator specific structures and function.

See also:
rk.h

Definition in file rk_stub.h.

Include dependency graph for rk_stub.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

struct  cpu_reserve
struct  rk_resource_set
struct  rk_stub_data
struct  rk_stub_pcb

Defines

#define MAX_PCB   128
 The maximum number of simulated process control blocks.


Typedefs

typedef cpu_reserve * cpu_reserve_t
 Forward declaration of the CPU reservation structure.

typedef rk_stub_precall_retval_t(* rk_stub_precall_t )(void *data)
 Prototype for the pre-data-period process call back.

typedef void(* rk_stub_postcall_t )(void *data)
 Prototype for the post-data-period process call back.

typedef enum rk_stub_mode_t rk_stub_mode_t
 The rk_stub_mode_t type enumerates the set of modes the rk_stub code can support.


Enumerations

enum  rk_cpu_reserve_trace_t {
  RK_CPU_TRACE_PERIOD, RK_CPU_TRACE_DEADLINE, RK_CPU_TRACE_COMPLETE, RK_CPU_TRACE_DROP,
  RK_CPU_TRACE_REALTIME, RK_CPU_TRACE_COMPUTE_SUCCESS, RK_CPU_TRACE_COMPUTE_FAIL, RK_CPU_TRACE_MAX
}
 The rk_cpu_reserve_trace_t type enumerates the set of trace files generated by the stubs. More...

enum  { CRB_RUNNING }
enum  { CRF_RUNNING = (1L << CRB_RUNNING) }
enum  { PCBB_IN_USE }
enum  { PCBF_IN_USE = (1L << PCBB_IN_USE) }
enum  rk_stub_precall_retval_t { RKSP_OK, RKSP_DROP }
 The rk_stub_precall_retval_t type enumerates the possible return values for an rk_stub_precall_t call back. More...

enum  rk_stub_mode_t { RK_STUB_MIN, RK_STUB_LOG, RK_STUB_SIM, RK_STUB_MAX }
 The rk_stub_mode_t type enumerates the set of modes the rk_stub code can support. More...

enum  { SDB_IN_TICK }
enum  { SDF_IN_TICK = (1L << SDB_IN_TICK) }

Functions

void rk_stub_set_mode (rk_stub_mode_t mode)
 Initialize the stub code and set the desired mode.

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.


Typedef Documentation

typedef void(* rk_stub_postcall_t)(void *data)
 

Prototype for the post-data-period process call back.

These functions are called after a data period has been simulated.

Parameters:
data The process specific data.

Definition at line 186 of file rk_stub.h.

Referenced by rk_stub_mk_pid().

typedef rk_stub_precall_retval_t(* rk_stub_precall_t)(void *data)
 

Prototype for the pre-data-period process call back.

These functions are called before a new data period is simulated.

Parameters:
data The process specific data.
Returns:
An rk_stub_precall_retval_t value.

Definition at line 178 of file rk_stub.h.

Referenced by rk_cpu_reserve_tick(), and rk_stub_mk_pid().


Enumeration Type Documentation

enum rk_cpu_reserve_trace_t
 

The rk_cpu_reserve_trace_t type enumerates the set of trace files generated by the stubs.

NOTE: Update rk_cpu_trace_names in the source file if you make any changes.

Enumeration values:
RK_CPU_TRACE_PERIOD  Process period.
RK_CPU_TRACE_DEADLINE  Process deadline, relative to the period.
RK_CPU_TRACE_COMPLETE  Completion of data processing.
RK_CPU_TRACE_DROP  Data dropped before processing.
RK_CPU_TRACE_REALTIME  Exact CPU time required to meet the deadline.
RK_CPU_TRACE_COMPUTE_SUCCESS  Actual CPU time, for successful periods.
RK_CPU_TRACE_COMPUTE_FAIL  Actual CPU time, for failed periods.

Definition at line 64 of file rk_stub.h.

enum rk_stub_mode_t
 

The rk_stub_mode_t type enumerates the set of modes the rk_stub code can support.

Enumeration values:
RK_STUB_LOG  Log all rk_* function calls.
RK_STUB_SIM  Same as RK_STUB_LOG, plus the simulator.

Definition at line 214 of file rk_stub.h.

enum rk_stub_precall_retval_t
 

The rk_stub_precall_retval_t type enumerates the possible return values for an rk_stub_precall_t call back.

Enumeration values:
RKSP_OK  Simulation of the data period should continue as normal.
RKSP_DROP  The data has been dropped, move to the next period.

Definition at line 166 of file rk_stub.h.

Referenced by c1_pre(), cxx_delegate_precall(), ContractDelegate::precall(), and BasicDelegate::precall().


Function Documentation

void rk_stub_getrusage pid_t  pid,
struct rusage *  ru
 

Get the CPU usage for the simulated process.

Parameters:
pid The process(es) to query for usage information.
ru The rusage object to fill out.
Returns:
Zero if the query was successful, otherwise it returns -1 and sets errno appropriately.

Definition at line 1942 of file rk_stub.c.

References MAX_PCB, require, and rk_stub_data.

Referenced by BasicDelegate::postcall(), and BasicDelegate::precall().

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.

See also:
rk_resource_set_attach_process

rk_resource_set_detach_process

Parameters:
name The name of the process.
data Process specific data, if any.
precall Function to call before a data period begins, can be NUL.
postcall Function to call after a data period ends, can be NULL.
Returns:
The pid_t for the simulated process.

Definition at line 1909 of file rk_stub.c.

References MAX_PCB, require, rk_stub_data, rk_stub_postcall_t, and rk_stub_precall_t.

Referenced by BasicDelegate::BasicDelegate().

void rk_stub_next_tick void   ) 
 

Advance the simulated time.

Simulated time starts at zero and then continually advances to the next simulated event, such as a period end.

Definition at line 1878 of file rk_stub.c.

References ensure, require, rk_cpu_reserve_tick(), rk_resource_set_t, rk_stub_data, and timespec_to_microsec().

Here is the call graph for this function:

void rk_stub_set_mode rk_stub_mode_t  mode  ) 
 

Initialize the stub code and set the desired mode.

Parameters:
mode One of the values in rk_stub_mode_t.

Definition at line 1321 of file rk_stub.c.

References lnNewList(), require, rk_stub_data, and rk_stub_mode_t.

Here is the call graph for this function:


Generated on Mon Dec 1 16:30:08 2003 for CPU Broker by doxygen 1.3.4