Commit 1a5213fa authored by Jonathan Jenkins's avatar Jonathan Jenkins Committed by Misbah Mubarak
Browse files

fix multiple lsm msg ordering in single event

uses the same approach as was employed in model-net (MN_START_SEQ/END_SEQ)
parent d510230d
...@@ -11,6 +11,21 @@ ...@@ -11,6 +11,21 @@
#define LSM_NAME "lsm" #define LSM_NAME "lsm"
/* HACK: problems arise when some LP sends multiple messages as part of an
* event and expects FCFS ordering. One could simply set a higher delay in
* delay, but that is hacky as well (and relies on knowing bounds on internal
* codes_local_latency bounds. Hence, expose explicit start-sequence and
* stop-sequence markers */
extern int in_sequence;
extern tw_stime lsm_msg_offset;
#define LSM_START_SEQ() do {\
in_sequence = 1; \
lsm_msg_offset = 0.0; \
} while (0)
#define LSM_END_SEQ() do {\
in_sequence = 0;\
} while (0)
/* /*
* lsm_event_t * lsm_event_t
* - events supported by the local storage model * - events supported by the local storage model
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#define CATEGORY_NAME_MAX 16 #define CATEGORY_NAME_MAX 16
#define CATEGORY_MAX 12 #define CATEGORY_MAX 12
int in_sequence = 0;
tw_stime mn_msg_offset = 0.0;
/* /*
* wrapped_event_t * wrapped_event_t
...@@ -294,6 +296,7 @@ tw_event* lsm_event_new(const char* category, ...@@ -294,6 +296,7 @@ tw_event* lsm_event_new(const char* category,
tw_event *e; tw_event *e;
lsm_message_t *m; lsm_message_t *m;
tw_lpid lsm_gid; tw_lpid lsm_gid;
tw_stime delta;
assert(strlen(category) < CATEGORY_NAME_MAX-1); assert(strlen(category) < CATEGORY_NAME_MAX-1);
assert(strlen(category) > 0); assert(strlen(category) > 0);
...@@ -303,7 +306,13 @@ tw_event* lsm_event_new(const char* category, ...@@ -303,7 +306,13 @@ tw_event* lsm_event_new(const char* category,
*/ */
lsm_gid = lsm_find_local_device(sender); lsm_gid = lsm_find_local_device(sender);
e = codes_event_new(lsm_gid, codes_local_latency(sender)+delay, sender); delta = codes_local_latency(sender) + delay;
if (in_sequence) {
tw_stime tmp = lsm_msg_offset;
lsm_msg_offset += delta;
delta += tmp;
}
e = codes_event_new(lsm_gid, delta, sender);
m = tw_event_data(e); m = tw_event_data(e);
m->magic = lsm_magic; m->magic = lsm_magic;
m->event = io_type; m->event = io_type;
......
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