Commit a5c9580c authored by mubarak's avatar mubarak

Updating codes_local_latency to generate events with time stamp > g_tw_lookahead

parent c68713b9
...@@ -30,13 +30,17 @@ static inline tw_event * codes_event_new( ...@@ -30,13 +30,17 @@ static inline tw_event * codes_event_new(
/* Modeled latency for communication between local software components and /* Modeled latency for communication between local software components and
* communication between daemons and hardware devices. Measured in * communication between daemons and hardware devices. Measured in
* nanoseconds. * nanoseconds.
* Modified Jul 7: We want to make sure that the event time stamp generated
is always greater than the default g_tw_lookahead value. Multiplying by 1.1
ensures that if tw_rand_exponential generates a zero time-stamped event, we
still have a timestamp that is greater than g_tw_lookahead.
*/ */
#define CODES_MEAN_LOCAL_LATENCY 0.01 #define CODES_MEAN_LOCAL_LATENCY 0.01
static inline tw_stime codes_local_latency(tw_lp *lp) static inline tw_stime codes_local_latency(tw_lp *lp)
{ {
tw_stime tmp; tw_stime tmp;
tmp = tw_rand_exponential(lp->rng, CODES_MEAN_LOCAL_LATENCY); tmp = (1.1 * g_tw_lookahead) + tw_rand_exponential(lp->rng, CODES_MEAN_LOCAL_LATENCY);
return(tmp); return(tmp);
} }
...@@ -47,7 +51,6 @@ static inline void codes_local_latency_reverse(tw_lp *lp) ...@@ -47,7 +51,6 @@ static inline void codes_local_latency_reverse(tw_lp *lp)
return; return;
} }
#endif /* CODES_H */ #endif /* CODES_H */
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment