INSEE 05.04.2011
Interconnection Nertworks Simulation and Evaluation Environment
Functions
C:/cygwin/home/Javier/insee/src/event.c File Reference

Event management functions used in trace-driven simulation. More...

#include "globals.h"
#include "misc.h"
#include "event.h"
#include <string.h>
Include dependency graph for event.c:

Functions

void init_event (event_q *q)
void ins_event (event_q *q, event i)
void do_event (event_q *q, event *i)
event head_event (event_q *q)
void rem_head_event (event_q *q)
bool_t event_empty (event_q *q)
void init_occur (event_l *l)
void ins_occur (event_l *l, event i)
bool_t occurred (event_l *l, event i)

Detailed Description

Event management functions used in trace-driven simulation.

Event: A task that must be done (not occurred yet). Occurred: A task that has been done (total or partially completed).

Author:
Javier Navaridas

FSIN Functional Simulator of Interconnection Networks Copyright (2003-2011) J. Miguel-Alonso, A. Gonzalez, J. Navaridas

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


Function Documentation

void do_event ( event_q *  q,
event *  i 
)

Uses the first event in the queue.

Takes an event an increases its packet count. When it reaches the length of the event, this is erased from the queue.

Parameters:
qA pointer to a queue.
iA pointer to the event to do.
bool_t event_empty ( event_q *  q)

Is a queue empty?.

Parameters:
qA pointer to the queue.
Returns:
TRUE if the queue is empty FALSE in other case.
event head_event ( event_q *  q)

Looks at the first event in a queue.

Parameters:
qA pointer to the queue.
Returns:
The first event in the queue (without using nor modifying it).
void init_event ( event_q *  q)

Initializes an event queue.

Parameters:
qa pointer to the queue to be initialized.
void init_occur ( event_l *  l)

Initializes all ocurred events lists.

There is only one list in each router.

Parameters:
lA pointer to the list to be initialized.
void ins_event ( event_q *  q,
event  i 
)

Adds an event to a queue.

Parameters:
qa pointer to a queue.
ithe event to be added to q.
void ins_occur ( event_l *  l,
event  i 
)

Inserts an event's occurrence in an event list.

If the event is in the list, then its count is increased. Otherwise a new event is created in the occurred event list.

Parameters:
lA pointer to a list.
iThe event to be added.
bool_t occurred ( event_l *  l,
event  i 
)

Has an event completely occurred?.

If it has totally occurred, this is, the event is in the list and its count is equal to its length, then it is deleted from the list.

Parameters:
la pointer to a list.
ithe event we are seeking for.
Returns:
TRUE if the event has been occurred, elseway FALSE
void rem_head_event ( event_q *  q)

Deletes the first event in a queue.

Parameters:
qA pointer to the queue.