Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Elsa Gonsiorowski
codes
Commits
1be1980f
Commit
1be1980f
authored
Jan 18, 2016
by
Jonathan Jenkins
Browse files
add an explicit end time for sampling
parent
1122a3c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/networks/model-net/model-net-lp.c
View file @
1be1980f
...
...
@@ -37,6 +37,7 @@ static model_net_base_params all_params[CONFIGURATION_MAX_ANNOS];
static
tw_stime
mn_sample_interval
=
0
.
0
;
static
int
mn_sample_enabled
=
0
;
static
tw_stime
mn_sample_end
=
0
.
0
;
typedef
struct
model_net_base_state
{
int
net_id
;
...
...
@@ -115,9 +116,10 @@ tw_lptype model_net_base_lp = {
/**** BEGIN IMPLEMENTATIONS ****/
void
model_net_enable_sampling
(
tw_stime
interval
)
void
model_net_enable_sampling
(
tw_stime
interval
,
tw_stime
end
)
{
mn_sample_interval
=
interval
;
mn_sample_end
=
end
;
mn_sample_enabled
=
1
;
}
...
...
@@ -129,10 +131,12 @@ int model_net_sampling_enabled(void)
// schedule sample event - want to be precise, so no noise here
static
void
issue_sample_event
(
tw_lp
*
lp
)
{
tw_event
*
e
=
tw_event_new
(
lp
->
gid
,
mn_sample_interval
,
lp
);
model_net_wrap_msg
*
m
=
tw_event_data
(
e
);
msg_set_header
(
model_net_base_magic
,
MN_BASE_SAMPLE
,
lp
->
gid
,
&
m
->
h
);
tw_event_send
(
e
);
if
(
tw_now
(
lp
)
+
mn_sample_interval
<
mn_sample_end
+
0
.
0001
)
{
tw_event
*
e
=
tw_event_new
(
lp
->
gid
,
mn_sample_interval
,
lp
);
model_net_wrap_msg
*
m
=
tw_event_data
(
e
);
msg_set_header
(
model_net_base_magic
,
MN_BASE_SAMPLE
,
lp
->
gid
,
&
m
->
h
);
tw_event_send
(
e
);
}
}
void
model_net_base_register
(
int
*
do_config_nets
){
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment