Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
margo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
17
Issues
17
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
sds
margo
Commits
969b53fc
Commit
969b53fc
authored
Apr 19, 2016
by
Shane Snyder
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dynamic progress timeout to margo
parent
eea77117
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
1 deletion
+63
-1
src/margo-timer.c
src/margo-timer.c
+29
-0
src/margo-timer.h
src/margo-timer.h
+11
-0
src/margo.c
src/margo.c
+23
-1
No files found.
src/margo-timer.c
View file @
969b53fc
...
...
@@ -177,6 +177,35 @@ void margo_check_timers(
return
;
}
/* returns 0 and sets 'next_timer_exp' if the timer instance
* has timers queued up, -1 otherwise
*/
int
margo_timer_get_next_expiration
(
margo_instance_id
mid
,
double
*
next_timer_exp
)
{
struct
margo_timer_instance
*
timer_inst
;
double
now
=
ABT_get_wtime
();
int
ret
;
timer_inst
=
margo_get_timer_instance
(
mid
);
assert
(
timer_inst
);
ABT_mutex_lock
(
timer_inst
->
mutex
);
if
(
timer_inst
->
queue_head
)
{
*
next_timer_exp
=
timer_inst
->
queue_head
->
expiration
-
now
;
ret
=
0
;
}
else
{
ret
=
-
1
;
}
ABT_mutex_unlock
(
timer_inst
->
mutex
);
return
(
ret
);
}
static
struct
margo_timer_instance
*
margo_get_timer_instance
(
margo_instance_id
mid
)
{
...
...
src/margo-timer.h
View file @
969b53fc
...
...
@@ -69,6 +69,17 @@ void margo_timer_destroy(
void
margo_check_timers
(
margo_instance_id
mid
);
/**
* Determines the amount of time (in seconds) until the next timer
* is set to expire
* @param [in] mid Margo instance
* @param [out] time until next timer expiration
* @returns 0 when there is a queued timer which will expire, -1 otherwise
*/
int
margo_timer_get_next_expiration
(
margo_instance_id
mid
,
double
*
next_timer_exp
);
#ifdef __cplusplus
}
#endif
...
...
src/margo.c
View file @
969b53fc
...
...
@@ -22,6 +22,8 @@
*/
#include <mercury_core.h>
#define MERCURY_PROGRESS_TIMEOUT_UB 100
/* 100 milliseconds */
struct
margo_instance
{
/* provided by caller */
...
...
@@ -189,6 +191,8 @@ static void hg_progress_fn(void* foo)
unsigned
int
actual_count
;
struct
margo_instance
*
mid
=
(
struct
margo_instance
*
)
foo
;
size_t
size
;
unsigned
int
hg_progress_timeout
=
MERCURY_PROGRESS_TIMEOUT_UB
;
double
next_timer_exp
;
while
(
!
mid
->
hg_progress_shutdown_flag
)
{
...
...
@@ -215,7 +219,25 @@ static void hg_progress_fn(void* foo)
else
{
ABT_mutex_unlock
(
mid
->
finalize_mutex
);
HG_Progress
(
mid
->
hg_context
,
100
);
ret
=
margo_timer_get_next_expiration
(
mid
,
&
next_timer_exp
);
if
(
ret
==
0
)
{
/* there is a queued timer, don't block long enough
* to keep this timer waiting
*/
if
(
next_timer_exp
>=
0
.
0
)
{
next_timer_exp
*=
1000
;
/* convert to milliseconds */
if
(
next_timer_exp
<
MERCURY_PROGRESS_TIMEOUT_UB
)
hg_progress_timeout
=
(
unsigned
int
)
next_timer_exp
;
}
else
{
hg_progress_timeout
=
0
;
}
}
HG_Progress
(
mid
->
hg_context
,
hg_progress_timeout
);
}
}
...
...
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