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
38
Issues
38
List
Boards
Labels
Milestones
Merge Requests
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
codes
codes
Commits
34bbe5b8
Commit
34bbe5b8
authored
Sep 26, 2013
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add delay operation example
parent
9497a9c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
9 deletions
+59
-9
src/workload/test-workload-method.c
src/workload/test-workload-method.c
+33
-9
tests/workload/codes-workload-test-cn-lp.c
tests/workload/codes-workload-test-cn-lp.c
+26
-0
No files found.
src/workload/test-workload-method.c
View file @
34bbe5b8
...
...
@@ -52,14 +52,33 @@ static int test_workload_load(const char* params, int rank)
new
->
rank
=
rank
;
/* arbitrary synthetic workload for testing purposes */
new
->
op_array_len
=
2
;
new
->
op_array_index
=
0
;
new
->
op_array
[
0
].
op_type
=
CODES_WK_OPEN
;
new
->
op_array
[
0
].
u
.
open
.
file_id
=
3
;
new
->
op_array
[
0
].
u
.
open
.
create_flag
=
1
;
new
->
op_array
[
1
].
op_type
=
CODES_WK_BARRIER
;
new
->
op_array
[
1
].
u
.
barrier
.
root
=
0
;
new
->
op_array
[
1
].
u
.
barrier
.
count
=
-
1
;
/* all ranks */
/* rank 0 sleeps 43 seconds, then does open and barrier, while all other
* ranks immediately do open and barrier
*/
if
(
rank
==
0
)
{
new
->
op_array_len
=
3
;
new
->
op_array_index
=
0
;
new
->
op_array
[
0
].
op_type
=
CODES_WK_DELAY
;
new
->
op_array
[
0
].
u
.
delay
.
seconds
=
43
;
new
->
op_array
[
1
].
op_type
=
CODES_WK_OPEN
;
new
->
op_array
[
1
].
u
.
open
.
file_id
=
3
;
new
->
op_array
[
1
].
u
.
open
.
create_flag
=
1
;
new
->
op_array
[
2
].
op_type
=
CODES_WK_BARRIER
;
new
->
op_array
[
2
].
u
.
barrier
.
root
=
0
;
new
->
op_array
[
2
].
u
.
barrier
.
count
=
-
1
;
/* all ranks */
}
else
{
new
->
op_array_len
=
2
;
new
->
op_array_index
=
0
;
new
->
op_array
[
0
].
op_type
=
CODES_WK_OPEN
;
new
->
op_array
[
0
].
u
.
open
.
file_id
=
3
;
new
->
op_array
[
0
].
u
.
open
.
create_flag
=
1
;
new
->
op_array
[
1
].
op_type
=
CODES_WK_BARRIER
;
new
->
op_array
[
1
].
u
.
barrier
.
root
=
0
;
new
->
op_array
[
1
].
u
.
barrier
.
count
=
-
1
;
/* all ranks */
}
/* add to front of list of streams that we are tracking */
new
->
next
=
wkload_streams
;
...
...
@@ -82,7 +101,12 @@ static void test_workload_get_next(int rank, struct codes_workload_op *op)
tmp
=
tmp
->
next
;
}
assert
(
tmp
);
if
(
!
tmp
)
{
op
->
op_type
=
CODES_WK_END
;
return
;
}
assert
(
tmp
->
rank
==
rank
);
if
(
tmp
->
op_array_index
<
tmp
->
op_array_len
)
...
...
tests/workload/codes-workload-test-cn-lp.c
View file @
34bbe5b8
...
...
@@ -68,6 +68,7 @@ static void handle_client_op_barrier_event(
tw_lp
*
lp
);
static
void
cn_enter_barrier
(
tw_lp
*
lp
,
tw_lpid
gid
,
int
count
);
static
void
cn_enter_barrier_rc
(
tw_lp
*
lp
);
static
void
cn_delay
(
tw_lp
*
lp
,
double
seconds
);
static
void
client_init
(
client_state
*
ns
,
...
...
@@ -285,6 +286,7 @@ static void handle_client_op_loop_event(
if
(
m
->
event_type
==
CLIENT_KICKOFF
)
{
/* first operation; initialize the desired workload generator */
printf
(
"codes_workload_load on gid: %ld
\n
"
,
lp
->
gid
);
ns
->
wkld_id
=
codes_workload_load
(
"test"
,
NULL
,
ns
->
my_rank
);
assert
(
ns
->
wkld_id
>
-
1
);
}
...
...
@@ -302,6 +304,9 @@ static void handle_client_op_loop_event(
switch
(
m
->
op_rc
.
op_type
)
{
/* this first set of operation types are handled exclusively by the
* client
*/
case
CODES_WK_END
:
ns
->
completion_time
=
tw_now
(
lp
);
printf
(
"Client rank %d completed workload.
\n
"
,
ns
->
my_rank
);
...
...
@@ -313,6 +318,13 @@ static void handle_client_op_loop_event(
cn_enter_barrier
(
lp
,
m
->
op_rc
.
u
.
barrier
.
root
,
m
->
op_rc
.
u
.
barrier
.
count
);
return
;
break
;
case
CODES_WK_DELAY
:
printf
(
"Client rank %d will delay for %f seconds.
\n
"
,
ns
->
my_rank
,
m
->
op_rc
.
u
.
delay
.
seconds
);
cn_delay
(
lp
,
m
->
op_rc
.
u
.
delay
.
seconds
);
return
;
break
;
/* "normal" io operations: we just calculate the destination and
* then continue after the switch block to send the specified
* operation to a server.
...
...
@@ -337,6 +349,20 @@ static void cn_enter_barrier_rc(tw_lp *lp)
return
;
}
static
void
cn_delay
(
tw_lp
*
lp
,
double
seconds
)
{
tw_event
*
e
;
client_msg
*
m_out
;
/* message to self */
e
=
codes_event_new
(
lp
->
gid
,
seconds
,
lp
);
m_out
=
tw_event_data
(
e
);
m_out
->
event_type
=
CLIENT_OP_COMPLETE
;
tw_event_send
(
e
);
return
;
}
static
void
cn_enter_barrier
(
tw_lp
*
lp
,
tw_lpid
gid
,
int
count
)
{
tw_event
*
e
;
...
...
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