Commit 59322599 authored by Philip Carns's avatar Philip Carns

glue together test method and shim layer

parent 67d30ee0
......@@ -85,10 +85,10 @@ int codes_workload_load(const char* type, const char* params, int rank);
* identifier returned by the init() function. The op argument is a pointer
* to a structure to be filled in with I/O operation information.
*/
void codes_workload_get_next(int wkld_id, struct codes_workload_op *op);
void codes_workload_get_next(int wkld_id, int rank, struct codes_workload_op *op);
/* Reverse of the above function. */
void codes_workload_get_next_rc(int wkld_id, const struct codes_workload_op *op);
void codes_workload_get_next_rc(int wkld_id, int rank, const struct codes_workload_op *op);
/* NOTE: there is deliberately no finalize function; we don't have any
* reliable way to tell when a workload is truly done and will not
......
......@@ -19,7 +19,7 @@ struct codes_workload_method
{
char *method_name; /* name of the generator */
int (*codes_workload_load)(const char* params, int rank);
void (*codes_workload_get_next)(int wkld_id, struct codes_workload_op *op);
void (*codes_workload_get_next)(int rank, struct codes_workload_op *op);
};
#endif /* CODES_WORKLOAD_METHOD_H */
......
......@@ -4,23 +4,53 @@
*
*/
#include <assert.h>
#include "ross.h"
#include "codes/codes-workload.h"
#include "codes-workload-method.h"
/* list of available methods. These are statically compiled for now, but we
* could make generators optional via autoconf tests etc. if needed
*/
extern struct codes_workload_method test_workload_method;
static struct codes_workload_method *method_array[] =
{&test_workload_method, NULL};
int codes_workload_load(const char* type, const char* params, int rank)
{
int i;
int ret;
for(i=0; method_array[i] != NULL; i++)
{
if(strcmp(method_array[i]->method_name, type) == 0)
{
ret = method_array[i]->codes_workload_load(params, rank);
if(ret < 0)
{
return(-1);
}
return(i);
}
}
fprintf(stderr, "Error: failed to find workload generator %s\n", type);
return(-1);
}
void codes_workload_get_next(int wkld_id, struct codes_workload_op *op)
void codes_workload_get_next(int wkld_id, int rank, struct codes_workload_op *op)
{
method_array[wkld_id]->codes_workload_get_next(rank, op);
return;
}
void codes_workload_get_next_rc(int wkld_id, const struct codes_workload_op *op)
void codes_workload_get_next_rc(int wkld_id, int rank, const struct codes_workload_op *op)
{
/* TODO: fill this in */
assert(0);
return;
}
......
......@@ -14,7 +14,7 @@
#include "codes-workload-method.h"
int test_workload_load(const char* params, int rank);
void test_workload_get_next(int wkld_id, struct codes_workload_op *op);
void test_workload_get_next(int rank, struct codes_workload_op *op);
struct codes_workload_method test_workload_method =
{
......@@ -25,14 +25,13 @@ struct codes_workload_method test_workload_method =
int test_workload_load(const char* params, int rank)
{
/* just use the rank of the caller as the identifier */
/* no params in this case; this example will work with any number of
* ranks
*/
return rank;
return(0);
}
void test_workload_get_next(int wkld_id, struct codes_workload_op *op)
void test_workload_get_next(int rank, struct codes_workload_op *op)
{
/* TODO: fill in a more complex example... */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment