Commit db1ab1d2 authored by Jonathan Jenkins's avatar Jonathan Jenkins

workload op printing functionality

parent 59bbab26
......@@ -120,6 +120,9 @@ void codes_workload_get_next_rc(int wkld_id, int rank, const struct codes_worklo
/* get related information for the codes workload (specifically for the BG/P model) */
void* codes_workload_get_info(int wkld_id, int rank);
/* for debugging/logging: print an individual operation to the specified file */
void codes_workload_print_op(FILE *f, struct codes_workload_op *op, int rank);
/* 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
* participate in further reverse computation. The underlying generators
......
......@@ -160,6 +160,42 @@ void* codes_workload_get_info(int wkld_id, int rank)
return method_array[wkld_id]->codes_workload_get_info(rank);
}
void codes_workload_print_op(FILE *f, struct codes_workload_op *op, int rank){
switch(op->op_type){
case CODES_WK_END:
fprintf(f, "op: rank:%d, type:end\n", rank);
break;
case CODES_WK_DELAY:
fprintf(f, "op: rank:%d, type:delay, seconds:%lf\n",
rank, op->u.delay.seconds);
break;
case CODES_WK_BARRIER:
fprintf(f, "op: rank:%d, type:barrier, count:%d, root:%d\n",
rank, op->u.barrier.count, op->u.barrier.root);
break;
case CODES_WK_OPEN:
fprintf(f, "op: rank:%d, type:open, file_id:%lu, flag:%d\n",
rank, op->u.open.file_id, op->u.open.create_flag);
break;
case CODES_WK_CLOSE:
fprintf(f, "op: rank:%d, type:close, file_id:%lu\n",
rank, op->u.close.file_id);
break;
case CODES_WK_WRITE:
fprintf(f, "op: rank:%d, type:write, "
"file_id:%lu, off:%lu, size:%lu\n",
rank, op->u.write.file_id, op->u.write.offset,
op->u.write.size);
break;
case CODES_WK_READ:
fprintf(f, "op: rank:%d, type:read, "
"file_id:%lu, off:%lu, size:%lu\n",
rank, op->u.read.file_id, op->u.read.offset,
op->u.read.size);
break;
}
}
/*
* Local variables:
* c-indent-level: 4
......
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