2 % (c) The GRASP/AQUA Project, Glasgow University, 1995
4 %************************************************************************
6 \section{Macros and global declarations for GranSim}
8 %************************************************************************
13 # define IS_IDLE(proc) ((IdleProcs & PE_NUMBER((long)proc)) != 0l)
14 # define ANY_IDLE (Idlers > 0)
15 # define MAKE_IDLE(proc) do { if(!IS_IDLE(proc)) { ++Idlers; IdleProcs |= PE_NUMBER(proc); } } while(0)
16 # define MAKE_BUSY(proc) do { if(IS_IDLE(proc)) { --Idlers; IdleProcs &= ~PE_NUMBER(proc); } } while(0)
19 # define STARTTHREAD 0 /* Start a newly created thread */
20 # define CONTINUETHREAD 1 /* Continue running the first thread in the queue */
21 # define RESUMETHREAD 2 /* Resume a previously running thread */
22 # define MOVESPARK 3 /* Move a spark from one PE to another */
23 # define MOVETHREAD 4 /* Move a thread from one PE to another */
24 # define FINDWORK 5 /* Search for work */
25 # define FETCHNODE 6 /* Fetch a node */
26 # define FETCHREPLY 7 /* Receive a node */
28 # define EVENT_PROC(evt) (evt->proc)
29 # define EVENT_CREATOR(evt) (evt->creator)
30 # define EVENT_TIME(evt) (evt->time)
31 # define EVENT_TYPE(evt) (evt->evttype)
32 # define EVENT_TSO(evt) (evt->tso)
33 # define EVENT_NODE(evt) (evt->node)
34 # define EVENT_SPARK(evt) (evt->spark)
35 # define EVENT_NEXT(evt) (eventq)(evt->next)
39 #if defined(GRAN) || defined(PAR)
40 void DumpGranEvent PROTO((enum gran_event_types name, P_ tso));
41 void DumpSparkGranEvent PROTO((enum gran_event_types name, W_ id));
42 void DumpGranEventAndNode PROTO((enum gran_event_types name, P_ tso, P_ node, PROC proc));
43 void DumpRawGranEvent PROTO((PROC pe, enum gran_event_types name, W_ id));
44 void DumpGranInfo PROTO((PROC pe, P_ tso, rtsBool mandatory_thread));
45 void grterminate PROTO((TIME v));
48 I_ SaveSparkRoots PROTO((I_));
49 I_ SaveEventRoots PROTO((I_));
51 I_ RestoreSparkRoots PROTO((I_));
52 I_ RestoreEventRoots PROTO((I_));
54 IF_RTS(int init_gr_simulation PROTO((int, char **, int, char **));)
55 IF_RTS(void end_gr_simulation(STG_NO_ARGS);)
59 ullong msTime(STG_NO_ARGS);
60 # define CURRENT_TIME msTime()
62 # define CURRENT_PROC thisPE
66 # define CURRENT_TIME CurrentTime[CurrentProc]
67 # define CURRENT_PROC CurrentProc