28,32 → 28,57 |
|
} |
|
int line_reader(void *start_file, void *end_file, struct timespec *total, struct loader_task **start_loader_task) |
int line_reader(void *start_file, void *end_file, struct timespec *total, |
struct loader_task **start_loader_task, struct loader_contract **start_loader_contract) |
{ |
|
char *pbuf = start_file; |
int res,line_num,total_loader_task; |
struct loader_task *current = NULL; |
int res,line_num,total_loader_task,total_loader_contract; |
struct loader_task *current_t = NULL; |
struct loader_contract *current_c = NULL; |
|
NULL_TIMESPEC(total); |
|
line_num = 0; |
total_loader_task = 0; |
total_loader_contract = 0; |
|
while ((void *)(pbuf) < end_file) { |
|
line_num++; |
|
if (*start_loader_contract == NULL) |
res = line_parser_contract(&pbuf, line_num, total, ¤t_c); |
else |
res = line_parser_contract(&pbuf, line_num, total, ¤t_c->next); |
|
if (res == 2) { |
total_loader_contract++; |
if (*start_loader_contract == NULL) |
*start_loader_contract = current_c; |
else |
current_c = current_c->next; |
} |
|
if (res == 3) break; |
|
} |
|
while ((void *)(pbuf) < end_file) { |
|
line_num++; |
|
if (*start_loader_task == NULL) |
res = line_parser(&pbuf, line_num, total, ¤t); |
res = line_parser_task(&pbuf, line_num, ¤t_t); |
else |
res = line_parser(&pbuf, line_num, total, ¤t->next); |
res = line_parser_task(&pbuf, line_num, ¤t_t->next); |
|
if (res == 2) { |
total_loader_task++; |
if (*start_loader_task == NULL) |
*start_loader_task = current; |
*start_loader_task = current_t; |
else |
current = current->next; |
current_t = current_t->next; |
} |
|
if (res == 3) break; |
61,6 → 86,7 |
} |
|
printf("Total decoded lines %d\n",line_num); |
printf("Total loader contract %d\n",total_loader_contract); |
printf("Total loader task %d\n",total_loader_task); |
printf("Simulation time sec = %ld usec = %ld\n",total->tv_sec,total->tv_nsec/1000); |
|