Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Elsa Gonsiorowski
codes
Commits
1be1980f
Commit
1be1980f
authored
Jan 18, 2016
by
Jonathan Jenkins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add an explicit end time for sampling
parent
1122a3c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
src/networks/model-net/model-net-lp.c
src/networks/model-net/model-net-lp.c
+9
-5
No files found.
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
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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