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

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
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

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
}
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 }
enum  rk_stub_mode_t { RK_STUB_MIN, RK_STUB_LOG, RK_STUB_SIM, RK_STUB_MAX }
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.

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.


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.

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.

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.

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.


Generated on Mon Dec 1 16:22:27 2003 for CPUBroker by doxygen 1.3.4