static void flow_build_dags (flowgraph_t *graph) { int i; flownode_t *node; for (i = 0; i < graph->num_nodes; i++) { node = graph->nodes[i]; node->dag = dag_create (node); } if (options.block_dot.dags) dump_dot ("dags", graph, dump_dot_flow_dags); }
int main (void) { int test, result_idx; int result[101]; long result_total[101]; for (result_idx = 0; result_idx <= 100; result_idx++) { result_total[result_idx] = 0; } for (test = 0; test < NUMTEST; test ++) { for (result_idx = 0; result_idx <= 100; result_idx++) { result[result_idx] = 0; } printf("test %d started\n", test); node_t* p_node = testnode; /*节点指针 pointer to a vertex (node)*/ /*初始化阶段*/ /*Initialization stage*/ node_init (p_node); /*节点的初始化 Initialization on nodes*/ dag_init (); /*DAG图邻接矩阵的初始化 init on adjacent matrix of DAG*/ epower_init (); /*DAG图边权值矩阵的初始化 init on edges' power matrix of DAG*/ core_init (); /*处理器模型的初始化 init on the processor model */ /*随机数生成阶段*/ /*Stage of random number generation*/ p_node = testnode; empower_node (p_node);/*随机生成节点权值 Randomly generates the power of nodes*/ dag_create ();/*DAG图邻接矩阵的随机生成 Randomly generates the adjacent matrix of the DAG.*/ empower_epower ();/*DAG图边权值的随机生成 Randomly generates the power of edges.*/ dag_makeup (); /*将DAG补全成AOE网络 Convert the DAG to Activity-on-Edge network*/ //dag_print (); /*调度算法实施阶段*/ /*Stage of implementing scheduling algorithm.*/ for (var = 0; var <= 100; var++) { MIU = (float)var / 100.0; core_init (); node_recover (); list_init (); convert_dag (); /*DAG图权值的变换 Transfer the power from vertices to edges*/ createadjlist (); critical_path (); /*AOE关键路径的求解 Solving the critical path.*/ result[var] = algorithm (); result_total[var] += result[var]; } for (result_idx = 0; result_idx <= 100; result_idx++) { printf("MIU %d' total time is %d\n", result_idx, result_total[result_idx]); } } return 0; }
/* Returns a pointer to a new struct dag described by filename. Return NULL on * failure. */ struct dag *dag_from_file(const char *filename) { FILE *dagfile; struct dag *d = NULL; dagfile = fopen(filename, "r"); if(dagfile == NULL) debug(D_DEBUG, "makeflow: unable to open file %s: %s\n", filename, strerror(errno)); else { d = dag_create(); d->filename = xxstrdup(filename); if(!dag_parse(d, dagfile)) { free(d); d = NULL; } fclose(dagfile); } return d; }