Skip to content

Commit

Permalink
Adding Chris' periodic patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Jan 25, 2011
1 parent e4fddbc commit e2309b7
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ross/models/srw/srw.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ tw_petype srw_pes[] = {
(pe_init_f) 0,
(pe_init_f) rn_netdmf_init,
(pe_gvt_f) 0,
(pe_final_f) 0
(pe_final_f) 0,
(pe_periodic_f) 0
},
{0},
};
Expand Down
3 changes: 2 additions & 1 deletion ross/models/tlm/pm/pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ tw_petype my_pes[] =
(pe_init_f) pm_pe_init,
(pe_init_f) pm_pe_post_init,
(pe_gvt_f) pm_pe_gvt,
(pe_final_f) pm_pe_final
(pe_final_f) pm_pe_final,
(pe_periodic_f) 0
},
{0},
};
Expand Down
3 changes: 2 additions & 1 deletion ross/models/tlm/rm/rm-interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ tw_petype rm_pes[] = {
(pe_init_f) rm_pe_init,
(pe_init_f) rm_pe_post_init,
(pe_gvt_f) rm_pe_gvt,
(pe_final_f) rm_pe_final
(pe_final_f) rm_pe_final,
(pe_periodic_f) 0
},
{0},
};
Expand Down
2 changes: 2 additions & 0 deletions ross/ross-extern.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ extern size_t g_tw_event_msg_sz;
extern unsigned int g_tw_memory_nqueues;
extern size_t g_tw_memory_sz;

extern unsigned int g_tw_periodicity;

extern tw_stime g_tw_lookahead;

extern tw_peid g_tw_npe;
Expand Down
7 changes: 7 additions & 0 deletions ross/ross-global.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ unsigned int g_tw_memory_nqueues = 0;
size_t g_tw_memory_sz = 0;
size_t g_tw_event_msg_sz = 0;

/*
* Number of iterations in scheduler (invoked from tw_run)
* before calling application callout. Default is to call
* callout for each iteration.
*/
unsigned int g_tw_periodicity = 1;

/*
* Minimum lookahead for a model -- model defined when
* using the Simple Synchronization Protocol (conservative)
Expand Down
2 changes: 2 additions & 0 deletions ross/ross-types.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ typedef unsigned long long tw_stat;
typedef void (*pe_init_f) (tw_pe * pe);
typedef void (*pe_gvt_f) (tw_pe * pe);
typedef void (*pe_final_f) (tw_pe * pe);
typedef void (*pe_periodic_f) (tw_pe * pe);

/** tw_petype @brief Virtual Functions for per PE ops
*
Expand All @@ -70,6 +71,7 @@ struct tw_petype
pe_init_f post_lp_init; /**< @brief PE initialization routine, after LP init */
pe_gvt_f gvt; /**< @brief PE per GVT routine */
pe_final_f final; /**< @brief PE finilization routine */
pe_periodic_f periodic; /**< @brief Callout made for K loops of tw scheduler */
};

/*
Expand Down
1 change: 1 addition & 0 deletions ross/tw-pe.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ tw_pe_settype(tw_pe * pe, const tw_petype * type)
copy_pef(post_lp_init, dummy_pe_f);
copy_pef(gvt, dummy_pe_f);
copy_pef(final, dummy_pe_f);
copy_pef(periodic, dummy_pe_f);

#undef copy_pef
}
Expand Down
6 changes: 6 additions & 0 deletions ross/tw-sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ tw_scheduler_conservative(tw_pe * me)
{
tw_clock start;
unsigned int msg_i;
unsigned int round = 0;

tw_sched_init(me);
tw_wall_now(&me->start_time);
Expand Down Expand Up @@ -369,6 +370,11 @@ tw_scheduler_conservative(tw_pe * me)

tw_event_free(me, cev);
}

if(me->type.periodic && (++round % g_tw_periodicity))
{
(*me->type.periodic)(me);
}
}


Expand Down

0 comments on commit e2309b7

Please sign in to comment.