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
3322359d
Commit
3322359d
authored
Sep 17, 2013
by
Philip Carns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
infrastructure to emit more event types
parent
d71bd87a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
3 deletions
+78
-3
codes/codes-workload.h
codes/codes-workload.h
+1
-1
src/workload/test-workload-method.c
src/workload/test-workload-method.c
+77
-2
No files found.
codes/codes-workload.h
View file @
3322359d
...
...
@@ -65,7 +65,7 @@ struct codes_workload_op
struct
{
int
file_id
;
/* file to operate on */
}
close
;
};
}
u
;
};
/* load and initialize workload of of type "type" with parameters specified by
...
...
src/workload/test-workload-method.c
View file @
3322359d
...
...
@@ -9,6 +9,8 @@
* testing/validation purposes.
*/
#include <assert.h>
#include "ross.h"
#include "codes/codes-workload.h"
#include "codes-workload-method.h"
...
...
@@ -16,6 +18,18 @@
int
test_workload_load
(
const
char
*
params
,
int
rank
);
void
test_workload_get_next
(
int
rank
,
struct
codes_workload_op
*
op
);
/* state information for each rank that is retrieving requests */
struct
wkload_stream_state
{
int
rank
;
struct
wkload_stream_state
*
next
;
struct
codes_workload_op
op_array
[
16
];
int
op_array_len
;
int
op_array_index
;
};
struct
wkload_stream_state
*
wkload_streams
=
NULL
;
struct
codes_workload_method
test_workload_method
=
{
.
method_name
=
"test"
,
...
...
@@ -28,14 +42,75 @@ int test_workload_load(const char* params, int rank)
/* no params in this case; this example will work with any number of
* ranks
*/
struct
wkload_stream_state
*
new
;
new
=
malloc
(
sizeof
(
*
new
));
if
(
!
new
)
return
(
-
1
);
new
->
rank
=
rank
;
/* synthetic workload, just open file for now */
new
->
op_array_len
=
1
;
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
;
/* add to front of list of streams that we are tracking */
new
->
next
=
wkload_streams
;
wkload_streams
=
new
;
return
(
0
);
}
void
test_workload_get_next
(
int
rank
,
struct
codes_workload_op
*
op
)
{
/* TODO: fill in a more complex example... */
struct
wkload_stream_state
*
tmp
=
wkload_streams
;
struct
wkload_stream_state
*
tmp2
=
wkload_streams
;
/* find stream associated with this rank */
while
(
tmp
)
{
if
(
tmp
->
rank
==
rank
)
break
;
tmp
=
tmp
->
next
;
}
assert
(
tmp
);
assert
(
tmp
->
rank
==
rank
);
if
(
tmp
->
op_array_index
<
tmp
->
op_array_len
)
{
*
op
=
tmp
->
op_array
[
tmp
->
op_array_index
];
tmp
->
op_array_index
++
;
}
else
{
/* no more operations */
op
->
op_type
=
CODES_WK_END
;
/* destroy this instance */
if
(
wkload_streams
==
tmp
)
{
wkload_streams
=
tmp
->
next
;
}
else
{
while
(
tmp2
)
{
if
(
tmp2
->
next
==
tmp
)
{
tmp2
->
next
=
tmp
->
next
;
break
;
}
tmp2
=
tmp2
->
next
;
}
}
free
(
tmp
);
}
op
->
op_type
=
CODES_WK_END
;
return
;
}
...
...
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