bool get_op(Op *op) { static UINT64 unique_count = 0; Trace_op trace_op; bool success = FALSE; // read trace // fill out op info // return FALSE if the end of trace //success = (gzread(g_stream, &trace_op, sizeof(Trace_op)) >0 ); success = (gzread(g_stream, &trace_op, sizeof(Trace_op)) == sizeof(Trace_op)); /* copy trace structure to op */ if (success) { if (KNOB(KNOB_PRINT_INST)->getValue()) dprint_trace(&trace_op); copy_trace_op(&trace_op, op); op->inst_id = unique_count++; op->valid = TRUE; last_inst_id = op->inst_id + 1; } else { if(unique_count == 0) { //cout << "Error in trace file" << endl; exit(0); } //last_inst_id = unique_count - 1; trace_over = true; } return success; }
bool get_op(Op *op) { static UINT64 unique_count = 0; Trace_op trace_op; bool success = FALSE; // read trace // fill out op info // return FALSE if the end of trace success = (gzread(g_stream, &trace_op, sizeof(Trace_op)) >0 ); if (KNOB(KNOB_PRINT_INST)->getValue()) dprint_trace(&trace_op); /* copy trace structure to op */ if (success) { copy_trace_op(&trace_op, op); op->inst_id = unique_count++; op->valid = TRUE; } return success; }
/* getOp */ bool get_op(Op *op, int fetch_id) { static UINT64 unique_count = 0; if(end_of_stream[fetch_id]) return false; Trace_op trace_op; bool success = false; // read trace // fill out op info // return FALSE if the end of trace int read_size; read_size = gzread(g_stream[fetch_id], &trace_op, sizeof(Trace_op)); success = read_size>0; if(read_size!=sizeof(Trace_op) && read_size>0) { printf( "ERROR!! gzread reads corrupted op! @cycle:%llu\n", cycle_count); success = false; } if (KNOB(KNOB_PRINT_INST)->getValue()) dprint_trace(&trace_op); /* copy trace structure to op */ if (success) { copy_trace_op(&trace_op, op); op->inst_id = unique_count++; op->valid = TRUE; op->thread_id = fetch_id; return success; // get op so return } else end_of_stream[fetch_id] = true; return success; }