ROSS
ross-gvt-internal.h
Go to the documentation of this file.
1#ifndef INC_ross_gvt_h
2#define INC_ross_gvt_h
3
4#include "ross-types.h"
5#include "tw-opts.h"
6#include "stdbool.h"
7
8/*
9 * Initialize the GVT library and parse options.
10 */
11
12/* setup the GVT library (config cmd line args, etc) */
13extern const tw_optdef *tw_gvt_setup(void);
14
15/* start the GVT library (init vars, etc) */
16extern void tw_gvt_start(void);
17extern void tw_gvt_finish(void);
18
19/*
20 * GVT computation is broken into two stages:
21 * stage 1: determine if GVT computation should be started
22 * stage 2: compute GVT
23 */
24extern void tw_gvt_step1(tw_pe *);
25extern void tw_gvt_step1_realtime(tw_pe *);
26extern void tw_gvt_step2(tw_pe *);
27
28/*
29 * Provide a mechanism to force a GVT computation outside of the
30 * GVT interval (optional)
31 */
32extern void tw_gvt_force_update(void);
33extern void tw_gvt_force_update_realtime(void);
34
35/* Set the PE GVT value */
36extern int tw_gvt_set(tw_pe * pe, tw_stime LVT);
37
38/* Returns true if GVT in progress, false otherwise */
39static inline int tw_gvt_inprogress(tw_pe * pe);
40
41/* Statistics collection and printing function */
42extern void tw_gvt_stats(FILE * F);
43
44/* Function to be injected/executed at every GVT. The function receives the current PE and a boolean indicating if the simulation has no more events to process in the queue */
45extern void (*g_tw_gvt_hook) (tw_pe * pe, bool is_queue_empty);
46/* Trigger `g_tw_gvt_hook` at a specific time (it even works in Sequential
47 * mode). This function should only be called before tw_run or inside
48 * g_tw_gvt_hook. It's behaviour is undefined if called anywhere else,
49 * specially during event processing. */
51#ifdef USE_RAND_TIEBREAKER
53#endif
54/* Trigger GVT hook every N GVT comptutations. Like `tw_trigger_gvt_hook_at`,
55 * this function has to be called at before `tw_run` or inside the GVT hook
56 * function. Calling this function will disable `tw_trigger_gvt_hook_at`
57 */
58void tw_trigger_gvt_hook_every(int num_gvt_calls);
59
65
66// Holds one timestamp at which to trigger the arbitrary function
69 union {
70 // GVT_HOOK_TYPE_timestamp
71 struct {
72#ifdef USE_RAND_TIEBREAKER
74#else
76#endif
77 };
78 // GVT_HOOK_TYPE_every_n_gvt
79 struct {
81 int nums;
83 };
84};
85
87
88#endif
tw_pe * pe
Definition avl_tree.c:10
double tw_stime
Definition ross-base.h:39
void tw_trigger_gvt_hook_at_event_sig(tw_event_sig time)
void tw_gvt_start(void)
GVT_HOOK_STATUS
@ GVT_HOOK_STATUS_disabled
@ GVT_HOOK_STATUS_timestamp
@ GVT_HOOK_STATUS_every_n_gvt
void tw_gvt_step2(tw_pe *)
struct gvt_hook_trigger g_tw_gvt_hook_trigger
void tw_gvt_force_update(void)
void tw_gvt_finish(void)
void tw_trigger_gvt_hook_at(tw_stime time)
static int tw_gvt_inprogress(tw_pe *pe)
void tw_gvt_force_update_realtime(void)
void tw_trigger_gvt_hook_every(int num_gvt_calls)
void tw_gvt_stats(FILE *F)
int tw_gvt_set(tw_pe *pe, tw_stime LVT)
void(* g_tw_gvt_hook)(tw_pe *pe, bool is_queue_empty)
void tw_gvt_step1(tw_pe *)
const tw_optdef * tw_gvt_setup(void)
void tw_gvt_step1_realtime(tw_pe *)
Definition of ROSS basic types.
GVT_HOOK_STATUS
enum GVT_HOOK_STATUS status
struct gvt_hook_trigger::@377021027272141330026060276165107160176224344221::@372056273241073034047236247155006051243204004030 every_n_gvt
Holds the entire PE state.
Definition ross-types.h:416