Details
struct simul_data_t
typedef struct { /* simulation data for a process */
gint start_time; /* time of creation */
gint end_time; /* length of the process */
/* IO properties */
/* this list is never modified until process destruction */
simul_io_event_t *io_events; /* list of all io events */
simul_io_event_t *next_io_event; /* pointer to the next event */
simul_io_event_t *last_io_event; /* pointer to the last event */
/* MEM properties */
simul_mem_t *pages; /* list of memory accesses */
gint n_pages; /* number of memory accesses */
gint cur_access; /* index to the current access */
} simul_data_t; |
struct simul_io_event_t
typedef struct { /* data for an IO event */
gint block; /* block to read */
gint time; /* time to read @block */
} simul_io_event_t; |
struct simul_mem_t
typedef struct { /* data for a page access */
gint8 page; /* page to access */
gint8 write; /* is it a write access? */
} simul_mem_t; |
struct event_data_t
typedef struct { /* io event data known by all the code */
gint io_block; /* block to access */
} event_data_t; |
init_CPU_simulation ()
void init_CPU_simulation (void); |
Initializes the simulation code.
init_CPU_simulation_in_proc ()
void init_CPU_simulation_in_proc (proc_t *proc); |
prepares the data structures for simulation in process proc.
end_CPU_simulation_in_proc ()
void end_CPU_simulation_in_proc (proc_t *proc); |
cleans up simulation data in proc to prepare it for termination.
Note: currently does nothing.
cpy_CPU_simulation_data ()
Copies the contents of src into dest, allocating dynamic memory when
needed.
dup_CPU_simulation_data ()
Duplicates a simul_data_t structure.
free_CPU_simulation_data ()
Frees all dynamic memory asociated to data, including data itself.
free_CPU_proc_simulation_data ()
void free_CPU_proc_simulation_data (proc_t *proc); |
Free all simulation related dynamic memory from the proc structure.
next_CPU_simulation_in_proc ()
void next_CPU_simulation_in_proc (proc_t *proc); |
Once the process had an event it prepares the process for its next
event, making it a termination event if necesary.
CPU_proc_current_page ()
gint CPU_proc_current_page (proc_t *proc); |
CPU_proc_next_page ()
gint CPU_proc_next_page (proc_t *proc); |
Makes the process move to its next memory page and should be called once
for each "clock tick" that proc is running.
CPU_proc_current_page_is_write ()
gboolean CPU_proc_current_page_is_write (proc_t *proc); |
Checks if proc is writing to memory or only reading.
fix_simulation_in_proc ()
void fix_simulation_in_proc (proc_t *proc); |
Makes the simulation parameters of a process coherent, prevents: multiple
events at the same time, events after process termination, determines the
next event ...
IO_BLOCK()
#define IO_BLOCK(event) (((event_data_t *)(event.data))->io_block) |
Extracts the block from a IO event.