# To unbundle, sh this file echo active.c 1>&2 cat >active.c <<'End of active.c' #include "sched.trace.h" #include "sundecs.h" plot_active() { window_set(histogram_frame,WIN_SHOW,TRUE,0); scrollbar_scroll_to(v_bar,300,0); scrollbar_scroll_to(h_bar,500,0); plot_active2(); } plot_active2() { int i,hw,op,v,max_x; char index_str[3]; clearscreen(pw2,XSVAL2,YSVAL2); op = PIX_SRC; hw = 10; v = 5; pw_vector(pw2,545,0,545,360,op,1); /* y-axis */ /*pw_vector(pw2,45,200 - hw*5,40,200 - hw*5,op,1); */ /*pw_text(pw2,502,340,PIX_SCR,0,"Procs"); */ /*pw_text(pw2,60,220,PIX_SCR,0,"Events"); */ sprintf(index_str,"%d",10); pw_text(pw2,515,360 - v*10,PIX_SCR,0,index_str); sprintf(index_str,"%d",20); pw_text(pw2,515,360 - v*20,PIX_SCR,0,index_str); sprintf(index_str,"%d",30); pw_text(pw2,515,360 - v*30,PIX_SCR,0,index_str); sprintf(index_str,"%d",40); pw_text(pw2,515,360 - v*40,PIX_SCR,0,index_str); /*max_x = 45 + 4*total_events; */ pw_vector(pw2,0,360,1000,360,op,1); /* x-axis */ i = 10; while (i < 950) { if (i % 20) pw_vector(pw2,45 + (i - 10),360 - v*10,45 + i,360 - v*10,op,1); if (i % 20) pw_vector(pw2,45 + (i - 10),360 - v*20,45 + i,360 - v*20,op,1); if (i % 20) pw_vector(pw2,45 + (i - 10),360 - v*30,45 + i,360 - v*30,op,1); if (i % 20) pw_vector(pw2,45 + (i - 10),360 - v*40,45 + i,360 - v*40,op,1); i = i + 10; }; if ( pt_count ) { if ( pts[pt_count].x*3 + histo_adj > 400 ) histo_adj = histo_adj - 100; for (i=0;i 400) { plot_active2(); return; } i = pt_count; pw_put(pw2, 3*pts[i].x + 400 + histo_adj, 360 - v*pts[i].y, 1); if (pt_count) pw_vector(pw2, 3*pts[i].x + 400 + histo_adj, 360 - v*pts[i].y, 3*pts[i-1].x + 400 + histo_adj, 360 - v*pts[i-1].y, op, 1); if (i%10 == 0) { pw_vector(pw2, 3*pts[i].x + 400 + histo_adj, 360, 3*pts[i].x + 400 + histo_adj, 365, op, 1); sprintf(index_str, "%d", pts[i].x); pw_text(pw2, 3*pts[i].x + 400 + histo_adj, 380, PIX_SCR, 0, index_str); } } pt_count++; panel_set(cw_slider, PANEL_VALUE, cw, 0); } End of active.c echo all_else.c 1>&2 cat >all_else.c <<'End of all_else.c' #include "sched.trace.h" #include "sundecs.h" draw_subtree() { int nix,current_lvl,yincr,lv,a,yvalue,xincr,len; int flag,FLAG,i; /* assign levels relative current node and number of parents */ nix = 0; current_lvl = NODE[0][CURRENT_NODE][LVIX] + 1; while ( nix < HINOD ) { if ( PATH(nix,CURRENT_NODE,&len) == -1 ) { NODE[DEPTH][nix][NPNT] = -1; NODE[DEPTH][nix][LVIX] = -1; NODE[DEPTH][nix][NCH] = -1; } else { NODE[DEPTH][nix][LVIX] = NODE[0][nix][LVIX]; NODE[DEPTH][nix][NPNT] = NODE[0][nix][NPNT]; NODE[DEPTH][nix][NCH] = NODE[0][nix][NCH]; }; nix++; }; NODE[DEPTH][CURRENT_NODE][LVIX] = current_lvl - 1; NODE[DEPTH][CURRENT_NODE][NPNT] = 0; NODE[DEPTH][CURRENT_NODE][NCH] = NODE[0][CURRENT_NODE][NCH]; /* prepare to assign x and y coordinates to subtree */ lv = 0; while (lv < HILVL) { LVLS[DEPTH][lv] = 0; lv++; }; nix = 0; while ( nix < HINOD ) { if ( NODE[DEPTH][nix][LVIX] != -1 ) LVLS[DEPTH][NODE[DEPTH][nix][LVIX]]++; nix++; }; assign_xy(current_lvl); /* draw levels of subtree */ for (i=0;i<2;i++) { FLAG = 1; while ( FLAG ) { if ( i ) clearscreen(pw,XSVAL,YSVAL); FLAG = 0; lv = 0; while (lv <= current_lvl) { if (flag = draw_level(lv,i)) FLAG = 1; lv++; }; }; } } prepath() { int j,m; char str[40]; for (j=0;j m) m = NODE[0][j][8]; sprintf(str,"Length of Critical Path = %d \n",m); display_path(str); C_LEN = m; C_NODE = 0; C_TABLE = 1; C_FLAG = 1; C_DONE = 0; } get_path() { int j,m,l,k,k2,i,m2,m3,level,sub,x,c; int p[MAXNODES]; char str[40]; redraw_all(); sprintf(str,"Length of Critical Path = %d \n",C_LEN); display_path(str); if ( C_DONE ) { display_path ("No other C-paths"); return; }; printf("Critical Path\n"); if ( ((j=C_NODE) 0 ) { c = 0; while ( A[i+1][PARENT[l][k][1]][c++] != -1 ); A[i+1][PARENT[l][k][1]][--c] = l; k++; }; }; } else { C_DONE = 1; display_path ("No other C-paths"); return; }; }; /* Trace a path */ i = C_INDEX; if ( C_FLAG ) { while ( (A[C_LEN-1][++i][0] == -1) && (i 1 ) { pw_vector(pw,NODE[DEPTH][b][XNODE]+1, NODE[DEPTH][b][YNODE],NODE[DEPTH][c][XNODE]+1, NODE[DEPTH][c][YNODE],PIX_SCR,1); pw_vector(pw,NODE[DEPTH][b][XNODE]+2, NODE[DEPTH][b][YNODE],NODE[DEPTH][c][XNODE]+2, NODE[DEPTH][c][YNODE],PIX_SCR,1); }; if ( slope > 4 ) { pw_vector(pw,NODE[DEPTH][b][XNODE]+3, NODE[DEPTH][b][YNODE],NODE[DEPTH][c][XNODE]+3, NODE[DEPTH][c][YNODE],PIX_SCR,1); }; } } PATH(n,c,len) int n,c; int *len; /* to establish a path from n (index in NODE array of node in question) to c (index in NODE array of current node) we need to trace ancestory of n */ { int a[MAXLVLS][MAXNODES]; int i,j,gen,k,sum; sum = 0; for (i=0;i 0 ) { for (i=0;i < gen;i++) for (j=0;j HINOD) return(-1) ; } DYNSRCH(nix,did) int nix,did; { int i,j; j = DYNNODE[nix][0][0]; i = 1; while (i < j) { if ( DYNNODE[nix][i][0] == did ) return(i); i++; }; return (-1); } DRAWNODE(nix) int nix; { int fill,color; color = 1; drawcircle(NODE[DEPTH][nix][XNODE],NODE[DEPTH][nix][YNODE],C_RADIUS,color,0,NODE[0][nix][RUNNING],nix); } DRAWDYN(nix) int nix; { int px, py, color, num, dynzone, i, j; int xmin, xincr, ymin, xsize, value; px = NODE[DEPTH][nix][XNODE]; py = NODE[DEPTH][nix][YNODE]; dynzone = 60 ; xmin = px - dynzone/2; xincr = 8; xsize = 4; ymin = py + DYNDOWN; j = DYNNODE[nix][0][0]; for (i = 1; i < j; i++) { color = DYNNODE[nix][i][1]; if (!nodraw && color != -1) { BOX(xmin, ymin, xmin+xsize, ymin + 10, color, 0); pw_vector(pw,xmin+xsize/2,ymin,px,py+C_RADIUS,PIX_SCR,1); } xmin = xmin + xincr; } } DRAW1DYN(nix,dix) int nix,dix; { int px, py, color, xpos, value; int num, xmin, xincr, ymin, xsize, dynzone; px = NODE[DEPTH][nix][XNODE]; py = NODE[DEPTH][nix][YNODE]; dynzone = 60; xmin = px - dynzone/2; xincr = 8; xsize = 4; ymin = py + DYNDOWN; xpos = xmin + xincr*(dix - 1); color = DYNNODE[nix][dix][1]; BOX(xpos, ymin, xpos+xsize, ymin+10, color, 0); if (!nodraw) { if (color == -1) value = 0; else value = 1; pw_vector(pw,xpos+xsize/2,ymin,px,py+C_RADIUS,PIX_SCR,value); } } BOX(x1, y1, x2, y2, p1, p2) int x1, y1, x2, y2, p1, p2; { int i, x, y, w, h, step; if (nodraw) return(1); if (!forward) { /* Erase the box. */ if (x1 < x2) { x = x1; w = x2 - x1; } else { x = x2; w = x1 - x2; } if (y1 < y2) { y = y1; h = y2 - y1; } else { y = y2; h = y1 - y2; } pw_writebackground(pw, x, y, w, h, PIX_CLR); pw_vector(pw, x1, y1, x1, y2, PIX_SCR, 0); /* Left */ pw_vector(pw, x1, y1, x2, y1, PIX_SCR, 0); /* Top */ pw_vector(pw, x2, y1, x2, y2, PIX_SCR, 0); /* Right */ pw_vector(pw, x1, y2, x2, y2, PIX_SCR, 0); /* Bottom */ } if (p1 != -1) { /* First draw the box. */ pw_vector(pw, x1, y1, x1, y2, PIX_SCR, 1); /* Left */ pw_vector(pw, x1, y1, x2, y1, PIX_SCR, 1); /* Top */ pw_vector(pw, x2, y1, x2, y2, PIX_SCR, 1); /* Right */ pw_vector(pw, x1, y2, x2, y2, PIX_SCR, 1); /* Bottom */ switch (p1) { case 0 : return; case 1 : step = 2; break; /* Draw two lines. */ case 2 : step = 1; break; /* Draw four lines. */ } for (i = 0; i < 4; i += step) pw_vector(pw,x1+i,y1,x1+i,y2,PIX_SCR,1); /* vertical bar */ } } CONNECT(nix, i) int nix, i; { int a, b, c, flag, FLAG, offset; if (nodraw) return(1); a = NODE[DEPTH][nix][NPNT]; if ((a == 0) && DEPTH) pw_vector(pw, NODE[DEPTH][nix][XNODE], NODE[DEPTH][nix][YNODE], 0, 0, PIX_SCR, 1); b = 0; FLAG = 0; while ((b < a) && (FLAG == 0)) { c = PARENT[nix][b][1]; if ((c != -1)) { flag = chk(NODE[DEPTH][c][XNODE],NODE[DEPTH][nix][YNODE], NODE[DEPTH][c][YNODE]); if (flag) FLAG = 1; offset = 10; if (NODE[DEPTH][c][LVIX] % 2) offset = -10; NODE[DEPTH][c][XNODE] = NODE[DEPTH][c][XNODE] + offset*flag; if ((FLAG == 0) && i) pw_vector(pw, NODE[DEPTH][nix][XNODE], NODE[DEPTH][nix][YNODE], NODE[DEPTH][c][XNODE], NODE[DEPTH][c][YNODE], PIX_SCR, 1); }; b++; } return(FLAG); } chk(x,y1,y0) int x,y1,y0; { int nix; for (nix=0;nixindex = index; if (NODE[0][index][NPNT] == 0) { *time = TIMES[index]; path->parent = NULL_PTR; } else { max_time = -1; parent_path = NULL_PTR; for (i = 0; i < NODE[0][index][NPNT]; i++) { new_time = 0; new_path = find_critical_path(PARENT[index][i][1], &new_time); if (new_time > max_time) { max_time = new_time; free_path(parent_path); parent_path = new_path; } else { free_path(new_path); } } *time = max_time + TIMES[index]; path->parent = parent_path; } return (path); } free_path(path) struct path_node *path; { struct path_node *ptr, *temp_ptr; ptr = path; while (ptr != NULL_PTR) { temp_ptr = ptr->parent; free((char *) ptr); ptr = temp_ptr; } } End of all_else.c echo assign_xy.c 1>&2 cat >assign_xy.c <<'End of assign_xy.c' #include "sched.trace.h" assign_xy(max_level) int max_level; { int i, xinc, yinc, level, node_index, a, y_value; for (i = 0; i < MAXNODES; i++) { NODE[DEPTH][i][XNODE] = 0; NODE[DEPTH][i][YNODE] = 0; }; yinc = (YS*size_factor - 2*YOFFSET)/max_level; DYNDOWN = yinc/3; for (level = 0; level < max_level; level++) { xinc = (XS*size_factor - XOFFSET)/LVLS[DEPTH][level]; node_index = 0; a = 0; y_value = YS*size_factor - yinc*level - YOFFSET; while ((node_index = ATLEVEL(node_index, level)) != -1) { NODE[DEPTH][node_index][XNODE] = XOFFSET + a*xinc + xinc/2; NODE[DEPTH][node_index][YNODE] = y_value; node_index++; a++; }; }; } End of assign_xy.c echo atlevel.c 1>&2 cat >atlevel.c <<'End of atlevel.c' #include "sched.trace.h" ATLEVEL(nix, level) int nix, level; { for (; (nix < HINOD) && (NODE[DEPTH][nix][LVIX] != level); nix++); if (nix != HINOD) return(nix); else return(-1); } End of atlevel.c echo build_levels.c 1>&2 cat >build_levels.c <<'End of build_levels.c' #include "sched.trace.h" /* We start at level 0. Since all leaf nodes have no children, they do not have their levels set to 1. All other nodes have their levels set to 1 because they have children; i.e. by statement NODE[0][PARENT[nix][pix][1]][LVIX]= current_level + 1; Now we go to level 1. However, we only look at nodes at that level. Thus, nodes that have only leaf nodes as children do not have their levels set to 2, and of course, all others do. We then continue as such until only the root node is left, who, of course, has no parents and we finally exit the while loop. */ build_levels() { int parents, current_level; int nix, pix, level; current_level = 0; parents = TRUE; while (parents) { parents = FALSE; for (nix = 0; (nix = ATLEVEL(nix, current_level)) != -1; nix++) for (pix = 0; pix < NODE[0][nix][NPNT]; pix++) if (PARENT[nix][pix][1] != -1) { parents = TRUE; NODE[0][PARENT[nix][pix][1]][LVIX]= current_level + 1; } current_level++; } HILVL = current_level; for (level = 0; level < HILVL; level++) LVLS[DEPTH][level] = 0; for (nix = 0; nix < HINOD; nix++) LVLS[DEPTH][NODE[0][nix][LVIX]]++; } End of build_levels.c echo c_time.c 1>&2 cat >c_time.c <<'End of c_time.c' #include "sched.trace.h" #include "sundecs.h" c_time(event) Event *event; { int i, leaf_node, path_number; struct path_node *path; struct critical_path *cp_ptr, *temp_ptr; if (find_paths) { int first_node = TRUE; find_paths = FALSE; for (i = 0; i < HINOD; i++) if (NODE[0][i][PNCH] == 0) /* Check all leaf nodes. */ { temp_ptr = (struct critical_path *) malloc(sizeof(struct critical_path)); temp_ptr->time = 0; temp_ptr->path = find_critical_path(i, &temp_ptr->time); if (first_node == TRUE) /* First time through. */ { first_node = FALSE; c_path = temp_ptr; c_path->next_path = NULL_PTR; } else /* Insert temp_ptr in decending time order. */ { if (temp_ptr->time > c_path->time) { temp_ptr->next_path = c_path; c_path = temp_ptr; } else /* Do insertion sort. */ { struct critical_path *ptr1, *ptr2; ptr1 = c_path; ptr2 = c_path->next_path; while (ptr2 != NULL_PTR && ptr2->time > temp_ptr->time) { ptr1 = ptr2; ptr2 = ptr1->next_path; } ptr1->next_path = temp_ptr; temp_ptr->next_path = ptr2; } } } } /* Create the path popup menu. */ i = 0; path_menu = menu_create(0); cp_ptr = c_path; while (cp_ptr != NULL_PTR) { char *string; string = (char *) malloc(80); sprintf (string, "Time = %f, Leaf node = %d.", cp_ptr->time, NODE[0][cp_ptr->path->index][ID]); /* path = cp_ptr->path; while (path != NULL_PTR) { path = path->parent; } */ menu_set(path_menu, MENU_STRING_ITEM, string, ++i, 0); cp_ptr = cp_ptr->next_path; } path_number = menu_show(path_menu, panel, event, 0); if (path_number) { int p[MAXNODES]; cp_ptr = c_path; for (i = 1; i != path_number; i++) cp_ptr = cp_ptr->next_path; i = 0; for (path = cp_ptr->path; path != NULL_PTR; path = path->parent) p[++i] = path->index; redraw_all(); draw_path(p,i); } } End of c_time.c echo constants.h 1>&2 cat >constants.h <<'End of constants.h' /* Constants for the sched.trace program. */ #define PIX_SCR (0xC << 1) #define MAXNODES 100 #define MAXDYNODES 51 #define MAXPARENTS 20 #define MAXDEPTH 10 #define MAXLVLS 50 /* Maximum number of levels. */ #define MAXLVL 20 /* Maximum number of nodes at each level. */ #define MAXPROCESSORS 20 /* Maximum number of processors. */ #define C_RADIUS 10 /* Size of the nodes. */ #define SYS -1 /* Top nodes's parent. */ /* Indices for the node array. */ #define ID 0 #define NCH 1 #define NPNT 2 #define PNCH 3 #define XNODE 4 #define YNODE 5 #define LVIX 6 #define RUNNING 7 #define PATHLENGTH 8 #define PROC_ID 9 /* Event types. */ #define STATICNODE 0 #define STARTSTATIC 1 #define STOPSTATIC 2 #define DYNAMICNODE 3 #define STARTDYN 4 #define STOPDYN 5 #define XSVAL pw->pw_prretained->pr_size.x #define YSVAL pw->pw_prretained->pr_size.y #define XSVAL2 pw2->pw_prretained->pr_size.x #define YSVAL2 pw2->pw_prretained->pr_size.y #define XSVAL3 pw_processor->pw_prretained->pr_size.x #define YSVAL3 pw_processor->pw_prretained->pr_size.y #define XSVAL4 pw_legend->pw_prretained->pr_size.x #define YSVAL4 pw_legend->pw_prretained->pr_size.y #define HOLLOW 0 #define SOLID 1 #define PLOP 0 #define XOR 1 #define WHITE 0 #define BLACK 1 #define NULL_PTR 0 End of constants.h echo draw_level.c 1>&2 cat >draw_level.c <<'End of draw_level.c' #include "sched.trace.h" draw_level(level, i) int level, i; { int nix, flag, FLAG; FLAG = 0; nix = 0; while ( ((nix = ATLEVEL(nix, level)) != -1) && (FLAG == 0) ) { if ((FLAG == 0) && i) DRAWNODE(nix); flag = CONNECT(nix,i); if (flag) FLAG = 1; if ((FLAG == 0) && i) DRAWDYN(nix); nix++; }; return(FLAG); } End of draw_level.c echo drawing.c 1>&2 cat >drawing.c <<'End of drawing.c' #include "sched.trace.h" #include "sundecs.h" drawcircle(x, y, radius, color, xormode, fill, index) int x, y, radius, color, xormode, fill, index; /* fill : 0 => hollow circle 1 => hashed 2 => solid xormode : 0 => replace 1 => xor it */ { int xdisp, ydisp, radsqr, ydsqr, xdsqr, i,fil; char index_str[3]; sprintf(index_str,"%d",NODE[0][index][ID]); if ( nodraw ) return(1); if ( x == 0 ) return(1); if (radius <= 0) return(-1); fil = fill; if (fill == 1) fil = 0; /* begin with known point: (xdisp,ydisp)=(0,radius) */ if (!forward) { xdisp = 0; ydisp = radius; radsqr = radius * radius; /* speedup suggested by irv */ ydsqr = radsqr; do /* Scan until crossing 45 degree line (xdisp = ydisp) */ { do /* Scan right until off circle by pythagorean theorem */ { reflect_fill(x, y, ydisp, xdisp, 0, xormode); xdisp++; /* move right */ } while (radius > ((xdisp * xdisp + ydsqr) - radsqr)); if (xdisp-1 != ydisp) reflect_fill(x, y, xdisp-1, ydisp, 0, xormode); ydisp--; /* move down one pixel */ ydsqr = ydisp * ydisp; } while (xdisp <= ydisp); } xdisp = 0; ydisp = radius; radsqr = radius * radius; /* speedup suggested by irv */ ydsqr = radsqr; do /* Scan until crossing 45 degree line (xdisp = ydisp) */ { do /* Scan right until off circle by pythagorean theorem */ { if (fil == 0) creflect(x, y, xdisp, ydisp, color, xormode); else reflect_fill(x, y, ydisp, xdisp, color, xormode); xdisp++; /* move right */ } while (radius > ((xdisp * xdisp + ydsqr) - radsqr)); if (fil == 2 && xdisp-1 != ydisp) reflect_fill(x, y, xdisp-1, ydisp, color, xormode); ydisp--; /* move down one pixel */ ydsqr = ydisp * ydisp; } while (xdisp <= ydisp); if ( fill == 1) { xdisp = 0; ydisp = radius - 1; radsqr = (radius - 1) * (radius - 1); ydsqr = radsqr; do /* Scan until crossing 45 degree line (xdisp = ydisp) */ { do /* Scan right until off circle by pythagorean theorem */ { reflect_fill(x, y, ydisp, xdisp, color, xormode); xdisp++; /* move right */ xdisp++; /* move right */ /* color = ++color % 2; */ } while (radius - 1 > (xdisp * xdisp + ydsqr) - radsqr); if (xdisp-1 != ydisp) reflect_fill(x, y, xdisp-1, ydisp, color, xormode); ydisp--; /* move down one pixel */ ydisp--; /* move down one pixel */ /* color = ++color % 2; */ ydsqr = ydisp * ydisp; } while (xdisp <= ydisp); } if (NODE[0][index][NCH] == 0) { ydisp = 0; xdisp = radius - 1; radsqr = (radius -1) * (radius -1); xdsqr = radsqr; do /* Scan until crossing 45 degree line (xdisp = ydisp) */ { do /* Scan right until off circle by pythagorean theorem */ { reflect_up(x, y, ydisp, xdisp, color, xormode); ydisp++; /* move down */ ydisp++; /* move down */ ydisp++; /* move down */ /* color = ++color % 2; */ } while (radius - 1 > (ydisp * ydisp + xdsqr) - radsqr); if (ydisp-1 != xdisp) reflect_up(x, y, xdisp, ydisp-1, color, xormode); xdisp--; /* move left one pixel */ xdisp--; /* move left one pixel */ xdisp--; /* move left one pixel */ /* color = ++color % 2; */ xdsqr = xdisp * xdisp; } while (ydisp <= xdisp); } pw_text(pw,x+C_RADIUS+1,y+C_RADIUS+1,PIX_SCR,0,index_str); } /* * Routine CREFLECT takes advantage of the 8-fold symmetry in a circle. * It could also be used like the reflect function of Deluxe Paint, * since it will make 8 reflections of distance (xdisp,ydisp) from (x,y). * creflect(x1,y1,(x2-x1),(y2-y1)) will reflect (x2,y2) about (x1,y1). */ creflect(x, y, xdisp, ydisp, color, xormode) int x, y, xdisp, ydisp, color, xormode; { point(x+xdisp, y+ydisp, color, xormode); point(x+xdisp, y-ydisp, color, xormode); if (xdisp != 0) { point(x-xdisp, y+ydisp, color, xormode); point(x-xdisp, y-ydisp, color, xormode); } if (xdisp != ydisp) { point(x+ydisp, y+xdisp, color, xormode); point(x-ydisp, y+xdisp, color, xormode); if (xdisp != 0) { point(x+ydisp, y-xdisp, color, xormode); point(x-ydisp, y-xdisp, color, xormode); } } } /* * REFLECT_FILL takes advantage of te same 8-fold symmetry that CREFLECT does, * except it draws horizontal and vertical stripes instead of only points. Notice that * the end points are the same as the pixels in CREFLECT. */ reflect_fill(x, y, xdisp, ydisp, color, xormode) int x, y, xdisp, ydisp, color, xormode; { horline(x-xdisp, y+ydisp, xdisp<<1, color, xormode); if (ydisp) horline(x-xdisp, y-ydisp, xdisp<<1, color, xormode); } reflect_up(x, y, xdisp, ydisp, color, xormode) int x, y, xdisp, ydisp, color, xormode; { verline(x-xdisp, y-ydisp, ydisp<<1, color, xormode); if(xdisp) verline(x+xdisp, y-ydisp, ydisp<<1, color, xormode); } point(x, y, color, xormode) int x, y, color, xormode; { int op; if (xormode == XOR) pw_rop(pw, x, y, 1, 1, PIX_SRC ^ PIX_DST | PIX_COLOR(color), NULL, 0, 0); else pw_put(pw, x, y, color); } verline(x, y, ydistance, color, xormode) int x, y, ydistance, color, xormode; { int op; op = PIX_SRC; if (xormode == XOR) op ^= PIX_DST; pw_vector(pw, x, y, x, y+ydistance, op, color); } horline(x, y, xdistance, color, xormode) int x, y, xdistance, color, xormode; { int op; op = PIX_SRC; if (xormode == XOR) op ^= PIX_DST; pw_vector(pw, x, y, x+xdistance, y, op, color); } clearscreen(p, x, y) Pixwin *p; int x,y; { /* clear screen */ pw_writebackground(p, 0, 0, x, y, PIX_CLR); } End of drawing.c echo dumps.c 1>&2 cat >dumps.c <<'End of dumps.c' #include "sched.trace.h" prdata() /* print data structures */ { /* dump_pts_array(); dump_parent_array(); dump_dynnode_array(); dump_node_array(); dump_events(); */ } dump_pts_array() { int i,j; printf("PTS array:\n"); printf("i\tx\ty\n"); for (i = 0; i < event_count; i++) printf("%d %d %d\n",i,pts[i].x,pts[i].y); } dump_node_array() { int i, j, k; printf("NODE ARRAY at DEPTH %d\n",DEPTH); printf("[0]\t[1]\t[2]\t[3]\t[4]\t[5]\t[6]\t[7]\t[8]\n"); for (i = 0; i < HINOD; i++) { for (k = (100-e_speed) * 5000; k > 0; k--); /* wait */ printf("Index = %d\n", i); for (j = 0; j < 9; j++) printf("%d\t",NODE[DEPTH][i][j]); printf("\n"); }; } dump_dynnode_array() { int i,j,k; printf("DYNNODE ARRAY\n"); printf("[1]\t[2]\t[3]\t[4]\t[5]\t[6]\t[7]\t[8]\t[9]\t[10]\t"); printf("\n"); for (i = 0; i < HINOD; i++) { for (k = (100-e_speed) * 5000; k > 0; k--); /* wait */ printf("Node index = %d\n", i); for (j = 0; j < 10; j++) printf("%d\t", DYNNODE[i][j][0]); printf("\n"); for (j = 0; j < 10; j++) printf("%d\t", DYNNODE[i][j][1]); printf("\n"); printf("\n"); }; } dump_parent_array() { int i,j,k; printf("PARENTS ARRAY\n"); printf("[1]\t[2]\t[3]\t[4]\t[5]\t[6]\t[7]\t[8]\t[9]\t[10]\t"); printf("\n"); for ( i=0;i 0; k--); /* wait */ printf("i=%d\n",i); for (j=0;j<9;j++) printf("%d\t",PARENT[i][j][0]); printf("\n"); for (j=0;j<9;j++) printf("%d\t",PARENT[i][j][1]); printf("\n"); printf("\n"); }; } dump_events() { int k; struct event *event_ptr; printf ("Events.\n"); for (event_ptr = event_list->next_event; event_ptr != trailer_event; event_ptr = event_ptr->next_event) { for (k = (100-e_speed) * 5000; k > 0; k--); /* wait */ printf("%d\t%d\t%d\n", event_ptr->type, event_ptr->node_id, event_ptr->dynode_id); } } End of dumps.c echo events.c 1>&2 cat >events.c <<'End of events.c' #include "sched.trace.h" #include "sundecs.h" proc_event() /* This function processes one event from the event list. */ { int i; /* Event speed regulator */ for (i = 5000 * (100 - e_speed); i > 0; i--); if (nodraw && (event_count == start_draw_mark)) { nodraw = FALSE; go = FALSE; redraw_all(); display_message("Select GO to continue."); panel_set(count_slider, PANEL_VALUE, event_count, 0); } if (forward) { if (current_event->next_event == trailer_event) { go = FALSE; display_message("End of execution."); return(0); } else { current_event = current_event->next_event; ETYPE = current_event->type; ++event_count; } } else /* Going backward. */ { if (current_event->previous_event == event_list) { go = FALSE; display_message("At the beginning."); return(0); } else { current_event = current_event->previous_event; ETYPE = current_event->type; --event_count; } } panel_set(count_slider, PANEL_VALUE, event_count, 0); switch (ETYPE) { case STARTSTATIC : DOSTARTSTATIC(); break; case STOPSTATIC : DOSTOPSTATIC(); break; case DYNAMICNODE : DODYNNODE(); break; case STARTDYN : DOSTARTDYN(); break; case STOPDYN : DOSTOPDYN(); break; default : printf("I don't know this type, # %d, in event # %d.\n", ETYPE, event_count); return(0); break; }; return(ETYPE); } DOSTARTSTATIC() { int node_id, node_index; node_id = current_event->node_id; node_index = search(node_id); plot_processors(current_event->time); if (forward) { PROCESSORS[current_event->processor] = 1; NODE[0][node_index][PROC_ID] = current_event->processor; NODE[0][node_index][RUNNING] = 1; ACTIVEPROCS++; } else /* Going backwards. */ { NODE[0][node_index][RUNNING] = 0; ACTIVEPROCS--; } drawcircle(NODE[DEPTH][node_index][XNODE], NODE[DEPTH][node_index][YNODE], C_RADIUS, 1, 0, NODE[0][node_index][RUNNING], node_index); show_active(ACTIVEPROCS); } DOSTOPSTATIC() { int i, node_id, node_index, parent_index, x, y, a, t; float timing; node_id = current_event->node_id; node_index = search(node_id); plot_processors(current_event->time); /* if (time_flag) { timing = time_factor* (TIMES[node_index][0][1]-TIMES[node_index][0][0]); if (timing_flag) { while ((timing < 1000) && (timing > 0)) { timing_flag = 0; timing = timing * 10; time_factor = time_factor * 10; } } timing = (100 - t_speed)*timing; while (timing > 0) timing = timing - 1; } */ if (forward) { PROCESSORS[NODE[0][node_index][PROC_ID]] = 0; NODE[0][node_index][PROC_ID] = 0; NODE[0][node_index][RUNNING] = 2; ACTIVEPROCS-- ; } else /* Going backwards. */ { NODE[0][node_index][RUNNING] = 1; ACTIVEPROCS++ ; } a = -1; while (PARENT[node_index][++a][0]) if (PARENT[node_index][a][1] != -1) { int draw_parent = FALSE; if (forward) { --NODE[0][PARENT[node_index][a][1]][NCH]; if (DEPTH) --NODE[DEPTH][PARENT[node_index][a][1]][NCH]; if (NODE[DEPTH][PARENT[node_index][a][1]][NCH] == 0) draw_parent = TRUE; } else { ++NODE[0][PARENT[node_index][a][1]][NCH]; if (DEPTH) ++NODE[DEPTH][PARENT[node_index][a][1]][NCH]; if (NODE[DEPTH][PARENT[node_index][a][1]][NCH] != 0) draw_parent = TRUE; } if (draw_parent) drawcircle(NODE[DEPTH][PARENT[node_index][a][1]][XNODE], NODE[DEPTH][PARENT[node_index][a][1]][YNODE], C_RADIUS, 1, 0, NODE[0][PARENT[node_index][a][1]][RUNNING], PARENT[node_index][a][1]); } drawcircle(NODE[DEPTH][node_index][XNODE], NODE[DEPTH][node_index][YNODE], C_RADIUS, 1, 0, NODE[0][node_index][RUNNING], node_index); show_active(ACTIVEPROCS); } DODYNNODE() { int node_id, node_index, dynode_id, dynode_index; node_id = current_event->node_id; dynode_id = current_event->dynode_id; node_index = search(node_id); dynode_index = DYNSRCH(node_index, dynode_id); if (forward) { DYNNODE[node_index][dynode_index][1] = 0; } else /* Going backwards. */ { DYNNODE[node_index][dynode_index][1] = -1; } DRAW1DYN(node_index,dynode_index); } DOSTARTDYN() { int node_id, node_index, dynode_id, dynode_index, sum, i; node_id = current_event->node_id; dynode_id = current_event->dynode_id; node_index = search(node_id); dynode_index = DYNSRCH(node_index, dynode_id); plot_processors(current_event->time); sum = 0; if (forward) { PROCESSORS[current_event->processor] = 1; DYNNODE[node_index][dynode_index][2] = current_event->processor; DYNNODE[node_index][dynode_index][1] = 1; for (i = 1; i < MAXDYNODES; i++) if (DYNNODE[node_index][i][1] == 1) sum++; if (sum != 1) ACTIVEPROCS++; else { PROCESSORS[NODE[0][node_index][PROC_ID]] = 0; NODE[0][node_index][PROC_ID] = 0; } } else /* Going backwards. */ { DYNNODE[node_index][dynode_index][1] = 0; for (i = 1; i < MAXDYNODES; i++) if (DYNNODE[node_index][i][1] == 1) sum++; if (sum) ACTIVEPROCS--; } DRAW1DYN(node_index, dynode_index); show_active(ACTIVEPROCS); } DOSTOPDYN() { int node_id, node_index, dynode_id, dynode_index, sum, i, t; float timing; node_id = current_event->node_id; dynode_id = current_event->dynode_id; node_index = search(node_id); dynode_index = DYNSRCH(node_index, dynode_id); plot_processors(current_event->time); /* if (time_flag) { timing = time_factor * (TIMES[node_index][dynode_index][1] - TIMES[node_index][dynode_index][0]); if (timing_flag) while ((timing < 1000) && (timing > 0)) { timing_flag = 0; timing = timing * 10; time_factor = time_factor * 10; } timing = (100 - t_speed)*timing; while (timing > 0) timing = timing - 1; } */ if (forward) { PROCESSORS[DYNNODE[node_index][dynode_index][2]] = 0; DYNNODE[node_index][dynode_index][2] = 0; DYNNODE[node_index][dynode_index][1] = 2; ACTIVEPROCS--; } else /* Going backwards. */ { DYNNODE[node_index][dynode_index][1] = 1; ACTIVEPROCS++; } DRAW1DYN(node_index, dynode_index); show_active(ACTIVEPROCS); } plot_processors(time) float time; { int i, x1, x2, y, distance; float x_ratio, y_ratio; static float previous_time; distance = (int) window_get(processor_canvas, CANVAS_HEIGHT); y_ratio = (distance - 10.0) / number_of_processors; distance = (int) window_get(processor_canvas, CANVAS_WIDTH); x_ratio = (distance - 10.0) / (last_time - first_time); if (event_count != 1) for (i = 1; i <= number_of_processors; i++) if (PROCESSORS[i]) { x1 = 5 + x_ratio*(previous_time - first_time); x2 = 5 + x_ratio*(time - first_time); y = 5 + y_ratio*(i - 1); pw_vector(pw_processor, x1, y, x2, y, PIX_SRC, 1); } previous_time = time; } End of events.c echo find_parents.c 1>&2 cat >find_parents.c <<'End of find_parents.c' #include "sched.trace.h" find_parents() { /* For each node, find the node indices of all parent nodes. */ int node_index, parent_index; node_index = 0; while (node_index < HINOD) { parent_index = 0; while (parent_index < NODE[0][node_index][NPNT]) { PARENT[node_index][parent_index][1] = search(PARENT[node_index][parent_index][0]); parent_index++; } node_index++; } } End of find_parents.c echo load.c 1>&2 cat >load.c <<'End of load.c' #include #include #include #include "sched.trace.h" #include "sundecs.h" load_tables() { load_directory_table(); load_file_table("."); } load_directory_table() { extern void directory_notify_proc(); struct direct *d; DIR *dp; int i; struct stat stbuf; static char current_dir[150]; if ((dp = opendir(".")) == NULL) { printf("Cannot open directory .\n"); exit(); } i = 0; while (directory_table[i] != NULL) free(directory_table[i++]); i = 0; while ((d = readdir(dp)) != NULL && i < 127) { if (stat(d->d_name,&stbuf) == -1) { printf("Stat failed on %s.\n",d->d_name); exit(); } if ((stbuf.st_mode & S_IFMT) == S_IFDIR) { directory_table[i] = (char *) malloc(d->d_namlen+1); if (directory_table[i] == NULL) { printf("No memory for directory.\n"); exit(); } strcpy(directory_table[i++],d->d_name); } } closedir(dp); if (i == 127) printf("Too many directory entries.\n"); directory_table[i] = NULL; panel_set(directory_choice, PANEL_CHOICE_STRINGS, "", 0, 0); for (i = 0; directory_table[i] != NULL; i++) panel_set(directory_choice, PANEL_CHOICE_STRING, i, directory_table[i], 0); panel_set(directory_choice, PANEL_CHOICE_STRING, i, "Enter new directory.", 0); /* enter_new_directory = i; */ strcpy(current_dir,"Directory: "); getwd(current_dir + 11); panel_set(directory_choice, PANEL_LABEL_STRING, current_dir, 0); } load_file_table(s) char *s; { extern void file_notify_proc(); struct direct *d; static char current_file[150]; DIR *dp; int i; if ((dp = opendir(s)) == NULL) { printf("Cannot open directory.\n"); exit(); } i = 0; while (file_table[i] != NULL) free(file_table[i++]); i = 0; while ((d = readdir(dp)) != NULL && i < 127) { if (d->d_namlen > 4 && d->d_name[0] == 't' && d->d_name[1] == 'r' && d->d_name[2] == 'a' && d->d_name[3] == 'c' && d->d_name[4] == 'e') { file_table[i] = (char *) malloc(d->d_namlen+1); if (file_table[i] == NULL) { printf("No memory for directory.\n"); exit(); } strcpy(file_table[i++], d->d_name); } } closedir(dp); if (i == 127) printf("Too many file entries.\n"); file_table[i] = NULL; panel_set(file_choice,PANEL_CHOICE_STRINGS, "", 0, 0); for (i = 0; file_table[i] != NULL; i++) panel_set(file_choice, PANEL_CHOICE_STRING, i, file_table[i], 0); ft_index = 0; strcpy(current_file, "Trace file: "); strcpy(current_file + 12, file_table[ft_index]); panel_set(file_choice,PANEL_LABEL_STRING, current_file, 0); } End of load.c echo main.c 1>&2 cat >main.c <<'End of main.c' #include "scheddefs.h" main(argc,argv) int argc; char **argv; { if (argc == 1) { printf("Sun graphics.\n"); window_init(); program_init(); sunloop(); } else { printf("No graphics.\n"); exit(1); } } program_init() { event_list = (struct event *) malloc(sizeof(struct event)); trailer_event = (struct event *) malloc(sizeof(struct event)); event_list->previous_event = NULL_PTR; event_list->next_event = trailer_event; trailer_event->previous_event = event_list; trailer_event->next_event = NULL_PTR; file_table[0] = NULL; directory_table[0] = NULL; load_tables(); } sunloop() { pw_text(pw, 15, 150, PIX_SCR, 0, "Hello, this is a graphics tool to trace the execution of programs that used SCHEDULE."); pw_text(pw, 15, 170, PIX_SCR, 0, "Select your file, click LOAD, and then click GO or STEP."); pw_text(pw, 15, 190, PIX_SCR, 0, "If you choose GO, you may stop execution at any time by clicking STOP or STEP."); pw_text(pw, 15, 210, PIX_SCR, 0, "You may then step through the execution by using STEP or continue execution by clicking GO."); window_main_loop(frame); } End of main.c echo makefile 1>&2 cat >makefile <<'End of makefile' # CFLAGS = -g -v LDFLAGS = -lsuntool -lsunwindow -lpixrect # OBJ = main.o window_init.o load.o procs.o open_tracefile.o new_tree.o \ rebuild.o find_parents.o search.o build_levels.o atlevel.o assign_xy.o \ draw_level.o events.o names.o c_time.o active.o dumps.o all_else.o drawing.o sched.trace: $(OBJ) cc ${CFLAGS} -o sched.trace $(OBJ) ${LDFLAGS} #bld: bld.graph.o # cc -o bld bld.graph.o -lsuntool -lsunwindow -lpixrect #main: main.o # cc -o otb main.o libtrace.a -lsuntool -lsunwindow -lpixrect #.c.o: $*.c # cc -c -g $*.c End of makefile echo names.c 1>&2 cat >names.c <<'End of names.c' #include "sched.trace.h" #include "sundecs.h" names(event) Event *event; { int i, j; Menu name_menu, dyname_menus[MAXNODES]; name_menu = menu_create(0); for (i = 0; i < HINOD; i++) { char *string; string = (char *) malloc(80); sprintf (string, "Node # %d = %s.", NODE[0][i][ID], &NAMES[i][0][0]); menu_set(name_menu, MENU_STRING_ITEM, string, i+1, 0); if (DYNNODE[i][0][0] > 1) { dyname_menus[i] = menu_create(0); menu_set(menu_get(name_menu, MENU_NTH_ITEM, i+1), MENU_PULLRIGHT, dyname_menus[i], 0); for (j = 1; j < DYNNODE[i][0][0]; j++) { string = (char *) malloc(80); sprintf (string, "Dynamic node # %d = %s.", DYNNODE[i][j][ID], &NAMES[i][j][0]); menu_set(dyname_menus[i], MENU_STRING_ITEM, string, j, 0); } } } menu_show(name_menu, panel, event, 0); } End of names.c echo new_tree.c 1>&2 cat >new_tree.c <<'End of new_tree.c' #include "sched.trace.h" #include "sundecs.h" new_tree() /* Initialize a new tree. */ { int i, j, k; char *str; struct event *event_ptr; NOSKIP = TRUE; ACTIVEPROCS = 0; CURRENT_NODE = 0; DEPTH = 0; HINOD = 0; HILVL = 0; HW = 0; for (i = 0; i < MAXNODES; i++) { TIMES[i] = -1; for (j = 0; j < MAXDEPTH; j++) for (k = 0; k < 10; k++) NODE[j][i][k] = 0; for (j = 0; j < MAXPARENTS; j++) for (k = 0; k < 2; k++) PARENT[i][j][k] = 0; for (j = 0; j < MAXDYNODES; j++) { DYNNODE[i][j][0] = 0; DYNNODE[i][j][1] = -1; DYNNODE[i][j][2] = 0; } DYNNODE[i][0][0] = 1; } for (i = 1; i <= number_of_processors; i++) PROCESSORS[i] = 0; XS = 500; YS = 500; pt_count = 0; event_count = 0; size_factor = 1; time_factor = 1; time_flag = TRUE; timing_flag = TRUE; e_speed = 100; t_speed = 100; pending = 0; nodraw = FALSE; start_draw_mark = 0; /* normal start */ forward = TRUE; event_ptr = event_list->next_event; while (event_ptr != trailer_event) { struct event *temp_ptr; temp_ptr = event_ptr->next_event; free((char *) event_ptr); event_ptr = temp_ptr; } event_list->next_event = trailer_event; trailer_event->previous_event = event_list; current_event = event_list; find_paths = TRUE; panel_set(directiontext,PANEL_LABEL_STRING, "Direction : forward", 0); panel_set(direction_button, PANEL_LABEL_IMAGE, panel_button_image(panel, "Forward ", 0, NULL), 0); clearscreen(pw,XSVAL,YSVAL); clearscreen(pw_processor,XSVAL3,YSVAL3); panel_set(cw_slider, PANEL_VALUE, pending, 0); panel_set(t_speed_slider, PANEL_VALUE, t_speed, 0); panel_set(e_speed_slider, PANEL_VALUE, e_speed, 0); str = "Current node "; display_node(str); str = "Length of Critical Path "; display_path(str); if (HISTOGRAM) { clearscreen(pw2,XSVAL2,YSVAL2); plot_active(); } histo_adj = 0; } End of new_tree.c echo open_tracefile.c 1>&2 cat >open_tracefile.c <<'End of open_tracefile.c' #include "sched.trace.h" #include "sundecs.h" char string[80]; FILE *trace_file; open_tracefile(file_name) char *file_name; { if ((trace_file = fopen(file_name, "r")) == NULL) { sprintf (string, "Couldn't open file %s.", file_name); display_message(string); } else { sprintf (string, "Loading %s.", file_name); display_message(string); new_tree(); fscanf(trace_file, "%d", &number_of_processors); total_events = 0; first_node_to_start = TRUE; while (fscanf(trace_file, "%d", &ETYPE) != EOF) { if (ETYPE != STATICNODE) ++total_events; switch (ETYPE) { case STATICNODE : READSTATIC(); break; case STARTSTATIC : READSTARTSTATIC(); break; case STOPSTATIC : READSTOPSTATIC(); break; case DYNAMICNODE : READDYNNODE(); break; case STARTDYN : READSTARTDYN(); break; case STOPDYN : READSTOPDYN(); break; default : printf("I don't know this type, # %d, in event # %d.\n", ETYPE, total_events); exit(1); break; } } fclose(trace_file); file_loaded = TRUE; current_event = event_list; panel_set(count_slider, PANEL_MAX_VALUE, total_events, PANEL_VALUE, 0, 0); REBUILD(); display_message("Select GO to begin execution."); } } READSTATIC() { int i, node_id, number_of_children, number_of_parents, parent; if (HINOD == MAXNODES) { printf("*********OUT OF SPACE************\n"); return(-1); }; fscanf(trace_file, "%d %d %d", &node_id, &number_of_children, &number_of_parents); NODE[0][HINOD][ID] = node_id; NODE[0][HINOD][NCH] = number_of_children; NODE[0][HINOD][PNCH] = number_of_children; NODE[0][HINOD][NPNT] = number_of_parents; NODE[0][HINOD][LVIX] = 0; NODE[0][HINOD][RUNNING] = 0; i = 0; while (i < number_of_parents) { fscanf(trace_file, "%d", &parent); PARENT[HINOD][i][0] = parent; PARENT[HINOD][i][1] = -1; i++; } fscanf(trace_file, "%s", &NAMES[HINOD][0][0]); HINOD++; return(1); } READSTARTSTATIC() { int node_id, node_index, processor; float time; fscanf(trace_file, "%d", &node_id); if ((node_index = search(node_id)) == -1) { printf("READSTARTSTATIC - Can not find node %d.\n", node_id); printf("Event number = %d.\n", total_events); exit(3); }; fscanf(trace_file, "%f", &time); fscanf(trace_file, "%d", &processor); fscanf(trace_file, "%s", string); new_node(ETYPE, node_id, 0, processor, time); if (first_node_to_start) { first_node_to_start = FALSE; first_time = time; } if (TIMES[node_index] < 0) TIMES[node_index] = time; } READSTOPSTATIC() { int node_id, node_index; float time; fscanf(trace_file, "%d", &node_id); if ((node_index = search(node_id)) == -1) { printf("READSTOPSTATIC: Cannot find node %d.\n", node_id); printf("Event number = %d.\n", total_events); exit(1); } fscanf(trace_file, "%f", &time); fscanf(trace_file, "%s", string); new_node(ETYPE, node_id, 0, 0, time); last_time = time; TIMES[node_index] = time - TIMES[node_index]; } READDYNNODE() { int node_id, node_index, dynode_id, dynode_index; fscanf(trace_file, "%d %d", &node_id, &dynode_id); if ((node_index = search(node_id)) == -1) { printf("READDYNODE: Cannot find node %d.\n", node_id); printf("Event number = %d.\n", total_events); exit(1); }; if ((dynode_index = DYNNODE[node_index][0][0]) == MAXDYNODES) { printf("READDYNNODE: No room for dynamic node %d in %d.\n", dynode_id, node_id); printf("Event number = %d.\n", total_events); exit(1); }; fscanf(trace_file, "%s", &NAMES[node_index][dynode_index][0]); DYNNODE[node_index][dynode_index][0] = dynode_id; DYNNODE[node_index][dynode_index][1] = -1; DYNNODE[node_index][0][0] = dynode_index + 1; new_node(ETYPE, node_id, dynode_id, 0, 0); } READSTARTDYN() { int node_id, node_index, dynode_id, dynode_index, processor; float time; fscanf(trace_file,"%d %d", &node_id, &dynode_id); if ((node_index = search(node_id)) == -1) { printf("READSTARTDYN: Cannot find node %d.\n", node_id); printf("Event number = %d.\n", total_events); exit(1); }; if ((dynode_index = DYNSRCH(node_index, dynode_id)) == -1) { printf("READSTARTDYN:Cannot find dynamic node %d in %d.\n", node_id, dynode_id); printf("Event number = %d.\n", total_events); exit(1); }; fscanf(trace_file, "%f", &time); fscanf(trace_file, "%d", &processor); fscanf(trace_file, "%s", string); new_node(ETYPE, node_id, dynode_id, processor, time); } READSTOPDYN() { int node_id, node_index, dynode_id, dynode_index; float time; fscanf(trace_file, "%d %d", &node_id, &dynode_id); if ((node_index = search(node_id)) == -1) { printf("READSTOPDYN: Cannot find node %d.\n", node_id); printf("Event number = %d.\n", total_events); exit(1); } if ((dynode_index = DYNSRCH(node_index,dynode_id)) == -1) { printf("READSTOPDYN: Cannot find dyn node %d in %d.\n", node_id, dynode_id); printf("Event number = %d.\n", total_events); exit(1); } fscanf(trace_file, "%f", &time); fscanf(trace_file, "%s", string); new_node(ETYPE, node_id, dynode_id, 0, time); } new_node (type, node_id, dynode_id, processor, time) int type, node_id, dynode_id, processor; float time; { struct event *event_ptr; event_ptr = (struct event *) malloc(sizeof(struct event)); event_ptr->previous_event = current_event; current_event->next_event = event_ptr; current_event = event_ptr; current_event->type = type; current_event->node_id = node_id; current_event->dynode_id = dynode_id; current_event->processor = processor; current_event->time = time; current_event->next_event = trailer_event; trailer_event->previous_event = current_event; } End of open_tracefile.c echo procs.c 1>&2 cat >procs.c <<'End of procs.c' #include "sched.trace.h" #include "sundecs.h" extern Notify_error notify_dispatch(); extern int errno; void load_notify_proc(item,event) Panel_item item; Event *event; { open_tracefile(file_table[ft_index]); } void go_notify_proc(item,event) Panel_item item; Event *event; { char msg[50]; if (file_loaded) if (nodraw) { sprintf(msg, "Skipping forward to %d.",start_draw_mark); display_message(msg); } else { display_message("Processing events."); go = TRUE; while (go) { proc_event(); if (button_hit()) go = FALSE; } } else display_message("You have to select a file first."); } button_hit() { return ((int) window_get(panel, WIN_EVENT_STATE, MS_LEFT)); } void stop_notify_proc(item,event) Panel_item item; Event *event; { go = FALSE; } void step_notify_proc(item,event) Panel_item item; Event *event; { if (file_loaded) { go = FALSE; display_message("Stepping through one event."); proc_event(); } else display_message("You have to select a file first."); } void quit_notify_proc(item,event) Panel_item item; Event *event; { window_set(frame, FRAME_NO_CONFIRM, FALSE, 0); done = window_destroy(frame); if (!done) window_return(NOTIFY_DONE); } void direction_notify_proc(item,event) Panel_item item; Event *event; { if (forward) { forward = FALSE; panel_set(direction_button, PANEL_LABEL_IMAGE, panel_button_image(panel, "Backward", 0, NULL), 0); panel_set(directiontext, PANEL_LABEL_STRING, "Direction : backward", 0); current_event = current_event->next_event; } else { forward = TRUE; panel_set(direction_button, PANEL_LABEL_IMAGE, panel_button_image(panel, "Forward ", 0, NULL), 0); panel_set(directiontext, PANEL_LABEL_STRING, "Direction : forward", 0); current_event = current_event->previous_event; } } void full_notify_proc(item,event) Panel_item item; Event *event; { size_factor = 1 + size_factor; if ( size_factor > 2 ) size_factor = 1; proc_event(); } void timing_notify_proc(item,event) Panel_item item; Event *event; { time_flag = TRUE; proc_event(); } void subtree_notify_proc(item,event) Panel_item item; Event *event; { if (file_loaded) { if (CURRENT_NODE != -1) { ++DEPTH; draw_subtree(); } } else display_message("You have to select a file first."); } void path_notify_proc(item,event) Panel_item item; Event *event; { if (file_loaded) get_path(); else display_message("You have to select a file first."); } void prepath_notify_proc(item,event) Panel_item item; Event *event; { if (file_loaded) prepath(); else display_message("You have to select a file first."); } void c_time_notify_proc(item,event) Panel_item item; Event *event; { if (file_loaded) c_time(event); else display_message("You have to select a file first."); } void name_notify_proc(item,event) Panel_item item; Event *event; { if (file_loaded) names(event); else display_message("You have to select a file first."); } void contrast_notify_proc(item,event) Panel_item item; Event *event; { if (screen_toggle) { screen_toggle = FALSE; pw_blackonwhite (pw, 0, 1); } else { screen_toggle = TRUE; pw_whiteonblack (pw, 0, 1); } if (file_loaded) redraw_all(); } void redraw_notify_proc(item,event) Panel_item item; Event *event; { if (file_loaded) redraw_all(); else display_message("You have to select a file first."); } void t_speed_notify_proc(item,value,event) Panel_item item; int value; Event *event; { t_speed = value; } void e_speed_notify_proc(item,value,event) Panel_item item; int value; Event *event; { e_speed = value; } void count_notify_proc(item,value,event) Panel_item item; int value; Event *event; { /* if (value < event_count) { display_message("can't go backwards yet"); } else { nodraw = 1; start_draw_mark = value; } */ } void file_notify_proc(item,value,event) Panel_item item; int value; Event *event; { static char current_file[150]; ft_index = value; strcpy(current_file, "Trace file: "); strcpy(current_file + 12, file_table[ft_index]); panel_set(file_choice,PANEL_LABEL_STRING, current_file, 0); } void directory_notify_proc(item,value,event) Panel_item item; int value; Event *event; { /* if (value < enter_new_directory) { chdir(directory_table[value]); load_tables(); } else { Frame popup_frame; popup_frame = window_create(frame, FRAME, WIN_ROWS, 1, WIN_COLUMNS, 80, 0); window_fit(popup_frame); popup_panel = window_create(popup_frame, PANEL, 0); panel_text = panel_create_item(popup_panel, PANEL_TEXT, PANEL_LABEL_STRING, "New directory: ", 0); panel_button = panel_create_item(popup_frame, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(popup_panel, "Ready", 0, NULL); PANEL_NOTIFY_PROC, ready_notify_proc, 0); window_set(popup_frame, WIN_SHOW, TRUE, 0); } if (chdir(directory_table[value]) == -1) printf("chdir failed with error number %d\n", errno); else */ } void histogram_notify_proc() { if (HISTOGRAM) { HISTOGRAM = FALSE; window_set(histogram_frame, WIN_SHOW, FALSE, 0); } else { HISTOGRAM = TRUE; plot_active(); } } void processor_notify_proc() { show_processor = !((int) window_get(processor_frame, WIN_SHOW)); window_set(processor_frame, WIN_SHOW, show_processor, 0); } void legend_notify_proc() { show_legend = !((int) window_get(legend_frame, WIN_SHOW)); window_set(legend_frame, WIN_SHOW, show_legend, 0); } void handle_event(canvas, event, arg) Canvas canvas; Event *event; caddr_t arg; { int x, y; char str[20]; x = event_x(event); y = event_y(event); switch (event_id(event)) { case MS_LEFT : /* printf("Left mouse x %d y %d \n",x,y); */ if ( (CURRENT_NODE = NODESEARCH(x,y)) != -1 ) { sprintf(str,"Current node is %d", NODE[0][CURRENT_NODE][ID]); display_node(str); }; break; case MS_MIDDLE : /* printf("Middle mouse x %d y %d \n",x,y); */ if ( (CURRENT_NODE = NODESEARCH(x,y)) != -1 ) { sprintf(str,"Current node is %d", NODE[0][CURRENT_NODE][ID]); display_node(str); }; break; case MS_RIGHT : /* printf("Right mouse x %d y %d \n",x,y); */ if ( (CURRENT_NODE = NODESEARCH(x,y)) != -1 ) { sprintf(str,"Current node is %d", NODE[0][CURRENT_NODE][ID]); display_node(str); }; if (event_is_down(event)) prdata(); break; default : break; } } End of procs.c echo rebuild.c 1>&2 cat >rebuild.c <<'End of rebuild.c' #include "sched.trace.h" #include "sundecs.h" redraw_all() { REBUILD(); } REBUILD() { int i, level, flag; DEPTH = 0; find_parents(); /* For each node, find node indices of parents. */ build_levels(); /* Assign a level to each node. */ assign_xy(HILVL); /* Assign x and y coordinates to each node. */ for (i = 0; i < 2; i++) { flag = TRUE; while (flag) { if (i) clearscreen(pw, XSVAL, YSVAL); flag = FALSE; for (level = 0; (level < HILVL) && (flag == FALSE); level++) if (draw_level(level, i)) flag = TRUE; } } } End of rebuild.c echo sched.trace.c 1>&2 cat >sched.trace.c <<'End of sched.trace.c' #include #include #include #include #include #include #include #include #include #include #include "sched.trace.h" extern Notify_error notify_dispatch(); extern int errno; void load_notify_proc(), go_notify_proc(), step_notify_proc(), stop_notify_proc(), quit_notify_proc(), full_notify_proc(), timing_notify_proc(), subtree_notify_proc(), prepath_notify_proc(), path_notify_proc(), redraw_notify_proc(), histogram_notify_proc(), e_speed_notify_proc(), t_speed_notify_proc(), count_notify_proc(), directory_notify_proc(), file_notify_proc(), handle_event(); int x_pos = 0; int y_pos = 0; int popup_width; Frame frame, popup_frame; Panel panel; Canvas canvas, pop_canvas; Scrollbar h_bar, v_bar; Textsw textsw; Tty ttysw; Panel_item title, popup_title, filetext, msgtext, nodetext, pathtext, load_button, go_button, stop_button, step_button, quit_button, subtree_button, full_button, path, path_button, prepath_button, redraw_button, histogram_button, timing_button, file_choice, directory_choice, e_speed_slider, t_speed_slider, cw_slider, count_slider; Pixwin *pw, *pw2; main(argc,argv) int argc; char **argv; { if (argc == 1) { printf("Sun graphics\n"); window_init(); file_table[0] = NULL; directory_table[0] = NULL; load_directory_table(); sunloop(); } else { printf("No graphics\n"); exit(1); } } sunloop() /* This is the main loop of the program. It processes one event *\ |* from the trace file (in proc_event()) and then calls the sunview *| \* supplied notify_dispatch() to process any sunview events. */ { int rc = 0; done = 0; go = 0; window_set(frame, WIN_SHOW, TRUE, 0); pw_text(pw, 15, 150, PIX_SCR, 0, "Hello, this is a graphics tool to trace the execution of programs that used SCHEDULE."); pw_text(pw, 15, 170, PIX_SCR, 0, "Select your file, click LOAD, and then click GO or STEP."); pw_text(pw, 15, 190, PIX_SCR, 0, "If you choose GO, you may stop execution at any time by clicking STOP or STEP."); pw_text(pw, 15, 210, PIX_SCR, 0, "You may then step through the execution by using STEP or continue execution by clicking GO."); while (!done) { if (go && (rc != -1)) rc = proc_event(); notify_dispatch(); } } window_init() { struct pixfont *title_font; frame = window_create(NULL,FRAME, WIN_ROWS, 45, WIN_COLUMNS, 95, 0); panel = window_create(frame,PANEL, WIN_PERCENT_HEIGHT, 30, 0); popup_frame = window_create(frame,FRAME, WIN_ROWS, 8, WIN_COLUMNS, 60, 0); window_fit(popup_frame); title_font = pf_open("/usr/lib/fonts/fixedwidthfonts/gallant.r.19"); title = panel_create_item(panel, PANEL_MESSAGE, PANEL_ITEM_X, ATTR_COL(31), PANEL_ITEM_Y, ATTR_ROW(0), PANEL_LABEL_STRING, "Schedule Tracing Facility", PANEL_LABEL_FONT, title_font, 0); directory_choice = panel_create_item(panel, PANEL_CHOICE, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(1), PANEL_LABEL_STRING, "Directory: ", PANEL_DISPLAY_LEVEL, PANEL_NONE, PANEL_NOTIFY_PROC, directory_notify_proc, 0); file_choice = panel_create_item(panel, PANEL_CHOICE, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(2), PANEL_LABEL_STRING, "Trace file: ", PANEL_DISPLAY_LEVEL, PANEL_CURRENT, PANEL_NOTIFY_PROC, file_notify_proc, 0); nodetext = panel_create_item(panel, PANEL_TEXT, PANEL_ITEM_X, ATTR_COL(50), PANEL_ITEM_Y, ATTR_ROW(9), PANEL_LABEL_STRING, "Current node ", PANEL_LABEL_DISPLAY_LENGTH, 20, 0); pathtext = panel_create_item(panel, PANEL_TEXT, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(9), PANEL_LABEL_STRING, " ", PANEL_LABEL_DISPLAY_LENGTH, 40, 0); msgtext = panel_create_item(panel, PANEL_TEXT, PANEL_ITEM_X, ATTR_COL(60), PANEL_ITEM_Y, ATTR_ROW(1), PANEL_LABEL_STRING, "No active file", PANEL_LABEL_DISPLAY_LENGTH, 35, 0); count_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(3), PANEL_VALUE, 100, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 100, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, TRUE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "Events ", PANEL_NOTIFY_PROC, count_notify_proc, 0); cw_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(4), PANEL_VALUE, 0, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 100, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, FALSE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "Active Processes", 0); /* hw_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(5), PANEL_VALUE, 0, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 25, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, FALSE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "High Water Mark ", 0); */ t_speed_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(5), PANEL_VALUE, 100, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 100, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, TRUE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "Timing Speed", PANEL_NOTIFY_PROC, t_speed_notify_proc, 0); e_speed_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(6), PANEL_VALUE, 100, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 100, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, TRUE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "Event Speed", PANEL_NOTIFY_PROC, e_speed_notify_proc, 0); load_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Load",0,NULL), PANEL_NOTIFY_PROC, load_notify_proc, 0); go_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(7), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Go",0,NULL), PANEL_NOTIFY_PROC, go_notify_proc, 0); stop_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(11), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Stop",0,NULL), PANEL_NOTIFY_PROC, stop_notify_proc, 0); step_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(17), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Step",0,NULL), PANEL_NOTIFY_PROC, step_notify_proc, 0); quit_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(23), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Quit",0,NULL), PANEL_NOTIFY_PROC, quit_notify_proc, 0); full_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(29), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Full",0,NULL), PANEL_NOTIFY_PROC, full_notify_proc, 0); path_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(35), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Path",0,NULL), PANEL_NOTIFY_PROC, path_notify_proc, 0); prepath_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(41), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Cprep",0,NULL), PANEL_NOTIFY_PROC, prepath_notify_proc, 0); /* timing_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(48), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Timing",0,NULL), PANEL_NOTIFY_PROC, timing_notify_proc, 0); */ subtree_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(48), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Subtree",0,NULL), PANEL_NOTIFY_PROC, subtree_notify_proc, 0); redraw_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(57), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Redraw",0,NULL), PANEL_NOTIFY_PROC, redraw_notify_proc, 0); histogram_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(65), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Histogram",0,NULL), PANEL_NOTIFY_PROC, histogram_notify_proc, 0); /* window_fit(panel); */ canvas = window_create(frame,CANVAS, CANVAS_WIDTH, 1000, CANVAS_HEIGHT, 1000, WIN_PERCENT_HEIGHT, 70, CANVAS_AUTO_SHRINK, FALSE, WIN_VERTICAL_SCROLLBAR, scrollbar_create(0), WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0), WIN_EVENT_PROC, handle_event, 0); pw = canvas_pixwin(canvas); pop_canvas = window_create(popup_frame,CANVAS, CANVAS_WIDTH, 1000, CANVAS_HEIGHT, 400, CANVAS_AUTO_SHRINK, FALSE, WIN_VERTICAL_SCROLLBAR, v_bar=scrollbar_create(0), WIN_HORIZONTAL_SCROLLBAR, h_bar=scrollbar_create(0), 0); pw2 = canvas_pixwin(pop_canvas); /* ttysw = window_create(frame,TTY, WIN_PERCENT_HEIGHT, 10, 0); window_fit(frame); */ } void handle_event(canvas, event, arg) Canvas canvas; Event *event; caddr_t arg; { int x,y; char str[20]; x = event_x(event); y = event_y(event); switch (event_id(event)) { case MS_LEFT: /* printf("Left mouse x %d y %d \n",x,y); */ if ( (CURRENT_NODE = NODESEARCH(x,y)) != -1 ) { sprintf(str,"Current node is %d", NODE[0][CURRENT_NODE][ID]); display_node(str); }; break; case MS_MIDDLE: /* printf("Middle mouse x %d y %d \n",x,y); */ if ( (CURRENT_NODE = NODESEARCH(x,y)) != -1 ) { sprintf(str,"Current node is %d", NODE[0][CURRENT_NODE][ID]); display_node(str); }; break; case MS_RIGHT: /* printf("Right mouse x %d y %d \n",x,y); */ if ( (CURRENT_NODE = NODESEARCH(x,y)) != -1 ) { sprintf(str,"Current node is %d", NODE[0][CURRENT_NODE][ID]); display_node(str); }; prdata(); break; default: break; } } load_file_table(s) char *s; { struct direct *d; DIR *dp; int i; i=0; while (file_table[i] != NULL) free(file_table[i++]); i = 0; if ((dp = opendir(s)) == NULL) { printf("Cannot open directory .\n"); exit(); } while ((d = readdir(dp)) != NULL && i < 127) { if (d->d_namlen > 4 && d->d_name[0] == 't' && d->d_name[1] == 'r' && d->d_name[2] == 'a' && d->d_name[3] == 'c' && d->d_name[4] == 'e') { file_table[i] = (char *) malloc(d->d_namlen+1); if (file_table[i] == NULL) { printf("No memory for directory\n"); exit(); } strcpy(file_table[i++],d->d_name); } } closedir(dp); if (i == 127) { printf("Too many file entries\n"); } file_table[i] = NULL; panel_set(file_choice,PANEL_CHOICE_STRINGS, "", 0, 0); panel_free(file_choice); file_choice = panel_create_item(panel, PANEL_CHOICE, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(2), PANEL_LABEL_STRING, "Trace file: ", PANEL_DISPLAY_LEVEL, PANEL_CURRENT, PANEL_NOTIFY_PROC, file_notify_proc, 0); for ( i=0; file_table[i] != NULL;i++) panel_set(file_choice,PANEL_CHOICE_STRING, i,file_table[i], 0); } load_directory_table() { struct direct *d; DIR *dp; int i; struct stat stbuf; static char current_dir[150]; i = 0; while (directory_table[i] != NULL) free(directory_table[i++]); i = 0; if ((dp = opendir(".")) == NULL) { printf("Cannot open directory .\n"); exit(); } while ((d = readdir(dp)) != NULL && i < 127) { if (stat(d->d_name,&stbuf) == -1) { printf("Stat failed on %s\n",d->d_name); exit(); } if ((stbuf.st_mode & S_IFMT) == S_IFDIR) { directory_table[i] = (char *) malloc(d->d_namlen+1); if (directory_table[i] == NULL) { printf("No memory for directory\n"); exit(); } strcpy(directory_table[i++],d->d_name); } } closedir(dp); if (i == 127) { printf("Too many directory entries\n"); } directory_table[i] = NULL; panel_set(directory_choice,PANEL_CHOICE_STRINGS, "", 0, 0); panel_free(directory_choice); strcpy(current_dir,"Directory: "); getwd(current_dir + 11); directory_choice = panel_create_item(panel, PANEL_CHOICE, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(1), PANEL_LABEL_STRING, current_dir, PANEL_DISPLAY_LEVEL, PANEL_NONE, PANEL_NOTIFY_PROC, directory_notify_proc, 0); for ( i=0; directory_table[i] != NULL;i++) panel_set(directory_choice,PANEL_CHOICE_STRING, i,directory_table[i], 0); load_file_table("."); open_tracefile(file_table[0]); } newt_init() /* Initialize a new tree */ { int i, j, k; char *str; NOSKIP = 1; SEEBUILD = 0; ACTIVEPROCS = 0; CURRENT_NODE = 0; DEPTH = 0; HINOD = 0; HILVL = 0; HW = 0; for (i = 0; i < MAXNODES; i++) { for (j = 0; j < MAXDEPTH; j++) for (k = 0; k < 9; k++) NODE[j][i][k] = 0; for (j = 0; j < MAXPARENTS; j++) for (k = 0; k < 2; k++) PARENT[i][j][k] = 0; for (j = 0; j < MAXDYNODES; j++) { TIMES[i][j][0] = TIMES[i][j][1] = 0; DYNNODE[i][j][0] = DYNNODE[i][j][1] = 0; } DYNNODE[i][0][0] = 1; } XS = 500; YS = 500; pt_count = 0; linecount = 0; size_factor = 1; time_factor = 1; time_flag = 1; timing_flag = 1; e_speed = 100; t_speed = 100; pending = 0; nodraw = 0; /* false, no nodraw */ start_draw_mark = 0; /* normal start */ clearscreen(pw,XSVAL,YSVAL); /* panel_set(hw_slider, PANEL_VALUE, 0, 0); */ panel_set(cw_slider, PANEL_VALUE, pending, 0); panel_set(t_speed_slider, PANEL_VALUE, t_speed, 0); panel_set(e_speed_slider, PANEL_VALUE, e_speed, 0); str = "Current node "; display_node(str); str = "Length of Critical Path "; display_path(str); if (HISTOGRAM) { /* window_set(popup_frame,WIN_SHOW,FALSE,0); */ clearscreen(pw2,XSVAL2,YSVAL2); plot_active(); } histo_adj = 0; } void load_notify_proc(item,event) Panel_item item; Event *event; { open_tracefile(file_table[ft_index]); } void go_notify_proc(item,event) Panel_item item; Event *event; { char msg[50]; go = TRUE; if (nodraw) { sprintf(msg,"skipping forward to %d",start_draw_mark); display_message(msg); } else { display_message("processing events"); } } void stop_notify_proc(item,event) Panel_item item; Event *event; { go = FALSE; } void step_notify_proc(item,event) Panel_item item; Event *event; { go = FALSE; proc_event(); } void quit_notify_proc(item,event) Panel_item item; Event *event; { window_set(frame, FRAME_NO_CONFIRM, FALSE, 0); done = window_destroy(frame); } void full_notify_proc(item,event) Panel_item item; Event *event; { size_factor = 1 + size_factor; if ( size_factor > 2 ) size_factor = 1; proc_event(); } void timing_notify_proc(item,event) Panel_item item; Event *event; { time_flag = TRUE; proc_event(); } void subtree_notify_proc(item,event) Panel_item item; Event *event; { if ( CURRENT_NODE != -1 ) { ++DEPTH; draw_subtree(); }; } void path_notify_proc(item,event) Panel_item item; Event *event; { get_path(); } void prepath_notify_proc(item,event) Panel_item item; Event *event; { prepath(); } void redraw_notify_proc(item,event) Panel_item item; Event *event; { redraw_all(); } void t_speed_notify_proc(item,value,event) Panel_item item; int value; Event *event; { t_speed = value; } void e_speed_notify_proc(item,value,event) Panel_item item; int value; Event *event; { e_speed = value; } void count_notify_proc(item,value,event) Panel_item item; int value; Event *event; { /* if (value < linecount) { display_message("can't go backwards yet"); } else { nodraw = 1; start_draw_mark = value; } */ } void file_notify_proc(item,value,event) Panel_item item; int value; Event *event; { ft_index = value; } void directory_notify_proc(item,value,event) Panel_item item; int value; Event *event; { if (chdir(directory_table[value]) == -1) printf("chdir failed with error number %d\n", errno); else load_directory_table(); } void histogram_notify_proc() { if (HISTOGRAM) { HISTOGRAM = FALSE; window_set(popup_frame,WIN_SHOW,FALSE,0); } else { HISTOGRAM = TRUE; plot_active(); } } plot_active() { int i,hw,op,v,max_x; char index_str[3]; window_set(popup_frame,WIN_SHOW,TRUE,0); scrollbar_scroll_to(v_bar,300,0); scrollbar_scroll_to(h_bar,500,0); plot_active2(); } plot_active2() { int i,hw,op,v,max_x; char index_str[3]; clearscreen(pw2,XSVAL2,YSVAL2); op = PIX_SRC; hw = 10; v = 5; pw_vector(pw2,545,0,545,360,op,1); /* y-axis */ /* pw_vector(pw2,45,200 - hw*5,40,200 - hw*5,op,1); */ /* pw_text(pw2,502,340,PIX_SCR,0,"Procs"); */ /* pw_text(pw2,60,220,PIX_SCR,0,"Events"); */ sprintf(index_str,"%d",10); pw_text(pw2,515,360 - v*10,PIX_SCR,0,index_str); sprintf(index_str,"%d",20); pw_text(pw2,515,360 - v*20,PIX_SCR,0,index_str); sprintf(index_str,"%d",30); pw_text(pw2,515,360 - v*30,PIX_SCR,0,index_str); sprintf(index_str,"%d",40); pw_text(pw2,515,360 - v*40,PIX_SCR,0,index_str); /* max_x = 45 + 4*total_events; */ pw_vector(pw2,0,360,1000,360,op,1); /* x-axis */ i = 10; while ( i < 950) { if ( i % 20) pw_vector(pw2,45 + (i - 10),360 - v*10,45 + i,360 - v*10,op,1); if ( i % 20) pw_vector(pw2,45 + (i - 10),360 - v*20,45 + i,360 - v*20,op,1); if ( i % 20) pw_vector(pw2,45 + (i - 10),360 - v*30,45 + i,360 - v*30,op,1); if ( i % 20) pw_vector(pw2,45 + (i - 10),360 - v*40,45 + i,360 - v*40,op,1); i = i + 10; }; if ( pt_count ) { if ( pts[pt_count].x*3 + histo_adj > 400 ) histo_adj = histo_adj - 100; for (i=0;i 400 ) { plot_active2(); return; }; i = pt_count; pw_put(pw2,pts[i].x*3 + 400 + histo_adj,360 - pts[i].y*v,1); if ( pt_count ) pw_vector(pw2,pts[i].x*3 + 400 + histo_adj,360 - pts[i].y*v, pts[i-1].x*3 + 400 + histo_adj,360 - pts[i-1].y*v,op,1); if ( (i % 10) == 0 ) { pw_vector(pw2,pts[i].x*3 + 400 + histo_adj,360, pts[i].x*3 + 400 + histo_adj,365,op,1); sprintf(index_str,"%d",pts[i].x); pw_text(pw2,pts[i].x*3+400 + histo_adj,380,PIX_SCR,0,index_str); } } pt_count++; panel_set(cw_slider, PANEL_VALUE, cw, 0); /* hw = (int) panel_get_value(hw_slider); if (cw > hw) { panel_set(hw_slider, PANEL_VALUE, cw,0); HW = cw; } */ } proc_event() { int i; for ( i = (100-e_speed) * 5000; i > 0; i--); /* wait */ if (nodraw && (linecount == start_draw_mark)) { nodraw = 0; go = 0; redraw_all(); display_message("select Go to continue"); panel_set(count_slider, PANEL_VALUE, linecount, 0); }; if ( (NOSKIP) && (fscanf(fp,"%d",&ETYPE) == EOF) ) { display_message("end of tracefile"); fclose(fp); go = 0; return(0); } else { NOSKIP = 1; if ((++linecount % scale) == 0) panel_set(count_slider,PANEL_VALUE,linecount,0); /* printf("proc_event got value etype %d\n",ETYPE); */ if (ETYPE == STATICNODE) DOSTATIC(); else if (ETYPE == STARTSTATIC) DOSTARTSTATIC(); else if (ETYPE == STOPSTATIC) DOSTOPSTATIC(); else if (ETYPE == DYNAMICNODE) DODYNNODE(); else if (ETYPE == STARTDYN) DOSTARTDYN(); else if (ETYPE == STOPDYN) DOSTOPDYN(); else { printf("I don't know this type %d\n",ETYPE); return(0); }; }; return(ETYPE); } redraw_all() { REBUILD(); } draw_subtree() { int nix,current_lvl,yincr,lv,a,yvalue,xincr,len; int flag,FLAG,i; /* assign levels relative current node and number of parents */ nix = 0; current_lvl = NODE[0][CURRENT_NODE][LVIX] + 1; while ( nix < HINOD ) { if ( PATH(nix,CURRENT_NODE,&len) == -1 ) { NODE[DEPTH][nix][NPNT] = -1; NODE[DEPTH][nix][LVIX] = -1; NODE[DEPTH][nix][NCH] = -1; } else { NODE[DEPTH][nix][LVIX] = NODE[0][nix][LVIX]; NODE[DEPTH][nix][NPNT] = NODE[0][nix][NPNT]; NODE[DEPTH][nix][NCH] = NODE[0][nix][NCH]; }; nix++; }; NODE[DEPTH][CURRENT_NODE][LVIX] = current_lvl - 1; NODE[DEPTH][CURRENT_NODE][NPNT] = 0; NODE[DEPTH][CURRENT_NODE][NCH] = NODE[0][CURRENT_NODE][NCH]; /* prepare to assign x and y coordinates to subtree */ lv = 0; while (lv < HILVL) { LVLS[DEPTH][lv] = 0; lv++; }; nix = 0; while ( nix < HINOD ) { if ( NODE[DEPTH][nix][LVIX] != -1 ) LVLS[DEPTH][NODE[DEPTH][nix][LVIX]]++; nix++; }; ASSIGNXY(current_lvl); /* draw levels of subtree */ for (i=0;i<2;i++) { FLAG = 1; while ( FLAG ) { if ( i ) clearscreen(pw,XSVAL,YSVAL); FLAG = 0; lv = 0; while (lv <= current_lvl) { if ( flag = DRAWLEVEL(lv,i) ) FLAG = 1; lv++; }; }; } } prepath() { int j,m; char str[40]; for (j=0;j m) m = NODE[0][j][8]; sprintf(str,"Length of Critical Path = %d \n",m); display_path(str); C_LEN = m; C_NODE = 0; C_TABLE = 1; C_FLAG = 1; C_DONE = 0; } get_path() { int j,m,l,k,k2,i,m2,m3,level,sub,x,c; int p[MAXNODES]; char str[40]; redraw_all(); sprintf(str,"Length of Critical Path = %d \n",C_LEN); display_path(str); if ( C_DONE ) { display_path ("No other C-paths"); return; }; printf("Critical Path\n"); if ( ((j=C_NODE) 0 ) { c = 0; while ( A[i+1][PARENT[l][k][1]][c++] != -1 ); A[i+1][PARENT[l][k][1]][--c] = l; k++; }; }; } else { C_DONE = 1; display_path ("No other C-paths"); return; }; }; /* Trace a path */ i = C_INDEX; if ( C_FLAG ) { while ( (A[C_LEN-1][++i][0] == -1) && (i 1 ) { pw_vector(pw,NODE[DEPTH][b][XNODE]+1, NODE[DEPTH][b][YNODE],NODE[DEPTH][c][XNODE]+1, NODE[DEPTH][c][YNODE],PIX_SCR,1); pw_vector(pw,NODE[DEPTH][b][XNODE]+2, NODE[DEPTH][b][YNODE],NODE[DEPTH][c][XNODE]+2, NODE[DEPTH][c][YNODE],PIX_SCR,1); }; if ( slope > 4 ) { pw_vector(pw,NODE[DEPTH][b][XNODE]+3, NODE[DEPTH][b][YNODE],NODE[DEPTH][c][XNODE]+3, NODE[DEPTH][c][YNODE],PIX_SCR,1); }; } } PATH(n,c,len) int n,c; int *len; /* to establish a path from n (index in NODE array of node in question) to c (index in NODE array of current node) we need to trace ancestory of n */ { int a[MAXLVLS][MAXNODES]; int i,j,gen,k,sum; sum = 0; for (i=0;i 0 ) { for (i=0;i < gen;i++) for (j=0;j (xdisp * xdisp + ydsqr) - radsqr); if(fil == 2 && xdisp-1!=ydisp) reflect_fill(x,y,xdisp-1,ydisp,color,xormode); ydisp--; /* move down one pixel */ ydsqr = ydisp * ydisp; } while (xdisp <= ydisp); if ( fill == 1) { xdisp = 0; ydisp = radius - 1; radsqr = (radius - 1) * (radius - 1); /* speedup suggested by irv */ ydsqr = radsqr; /* scan until crossing 45 degree line (xdisp=ydisp) */ do { /* Scan right until off circle by pythagorean theorem */ do { reflect_fill(x,y,ydisp,xdisp,color,xormode); xdisp++; /* move right */ xdisp++; /* move right */ /* color = ++color % 2; */ } while (radius - 1 > (xdisp * xdisp + ydsqr) - radsqr); if( xdisp-1!=ydisp) reflect_fill(x,y,xdisp-1,ydisp,color,xormode); ydisp--; /* move down one pixel */ ydisp--; /* move down one pixel */ /* color = ++color % 2; */ ydsqr = ydisp * ydisp; } while (xdisp <= ydisp); } if ( NODE[0][index][NCH] == 0) { ydisp = 0; xdisp = radius - 1; radsqr = (radius -1) * (radius -1); /* speedup suggested by irv */ xdsqr = radsqr; /* scan until crossing 45 degree line (xdisp=ydisp) */ do { /* Scan right until off circle by pythagorean theorem */ do { reflect_up(x,y,ydisp,xdisp,color,xormode); ydisp++; /* move down */ ydisp++; /* move down */ ydisp++; /* move down */ /* color = ++color % 2; */ } while (radius - 1 > (ydisp * ydisp + xdsqr) - radsqr); if( ydisp-1!=xdisp) reflect_up(x,y,xdisp,ydisp-1,color,xormode); xdisp--; /* move left one pixel */ xdisp--; /* move left one pixel */ xdisp--; /* move left one pixel */ /* color = ++color % 2; */ xdsqr = xdisp * xdisp; } while (ydisp <= xdisp); } pw_text(pw,x+C_RADIUS+1,y+C_RADIUS+1,PIX_SCR,0,index_str); } /* * Routine CREFLECT takes advantage of the 8-fold symmetry in a circle. * It could also be used like the reflect function of Deluxe Paint, * since it will make 8 reflections of distance (xdisp,ydisp) from (x,y). * creflect(x1,y1,(x2-x1),(y2-y1)) will reflect (x2,y2) about (x1,y1). */ creflect(x, y, xdisp, ydisp,color,xormode) int x, y, xdisp, ydisp,color,xormode; { point(x+xdisp, y+ydisp, color, xormode); point(x+xdisp, y-ydisp, color, xormode); if(xdisp!=0) { point(x-xdisp, y+ydisp, color, xormode); point(x-xdisp, y-ydisp, color, xormode); } if(xdisp!=ydisp) { point(x+ydisp, y+xdisp, color, xormode); point(x-ydisp, y+xdisp, color, xormode); if(xdisp!=0) { point(x+ydisp, y-xdisp, color, xormode); point(x-ydisp, y-xdisp, color, xormode); } } } /* * REFLECT_FILL takes advantage of te same 8-fold symmetry that CREFLECT does, * except it draws horizontal and vertical stripes instead of only points. Notice that * the end points are the same as the pixels in CREFLECT. */ reflect_fill(x, y, xdisp, ydisp,color,xormode) int x, y, xdisp, ydisp,color,xormode; { horline(x-xdisp,y+ydisp,xdisp<<1,color,xormode); /* change for each graphics board */ if(ydisp) horline(x-xdisp,y-ydisp,xdisp<<1,color,xormode); } reflect_up(x, y, xdisp, ydisp,color,xormode) int x, y, xdisp, ydisp,color,xormode; { verline(x-xdisp,y-ydisp,ydisp<<1,color,xormode); /* change for each graphics board */ if(xdisp) verline(x+xdisp,y-ydisp,ydisp<<1,color,xormode); } point(x,y,color,xormode) int x,y,color,xormode; { int op; if (xormode == XOR) pw_rop(pw,x,y,1,1, PIX_SRC ^ PIX_DST | PIX_COLOR(color), NULL,0,0); /* write a pixel */ else pw_put(pw,x,y,color); } verline(x,y,ydistance,color,xormode) int x,y,ydistance,color,xormode; { int op; op = PIX_SRC; if (xormode == XOR) op ^= PIX_DST; pw_vector(pw,x,y,x,y+ydistance,op,color); } horline(x,y,xdistance,color,xormode) int x,y,xdistance,color,xormode; { int op; op = PIX_SRC; if (xormode == XOR) op ^= PIX_DST; pw_vector(pw,x,y,x+xdistance,y,op,color); } clearscreen(p,x,y) Pixwin *p; int x,y; { /* clear screen */ pw_writebackground(p,0,0, x, y, PIX_CLR); } prdata() /* print data structures */ { /* dump_dynnode_array(); dump_pts_array(); */ dump_node_array(); dump_parent_array(); } dump_pts_array() { int i,j; printf("PTS array\n"); printf("i\tx\ty\n"); for ( i=0;i 0; k--); /* wait */ printf("i=%d\t",i); for (j=0;j<8;j++) printf("%d\t",NODE[DEPTH][i][j]); printf("\n"); }; } dump_dynnode_array() { int i,j,k; printf("DYNNODE ARRAY\n"); printf("[1]\t[2]\t[3]\t[4]\t[5]\t[6]\t[7]\t[8]\t[9]\t[10]\t"); printf("\n"); for ( i=0;i 0; k--); /* wait */ printf("i=%d\t",i); for (j=0;j<9;j++) printf("%d\t",DYNNODE[i][j][0]); printf("\n"); for (j=0;j<9;j++) printf("%d\t",DYNNODE[i][j][1]); printf("\n"); printf("\n"); }; } dump_parent_array() { int i,j,k; printf("PARENTS ARRAY\n"); printf("[1]\t[2]\t[3]\t[4]\t[5]\t[6]\t[7]\t[8]\t[9]\t[10]\t"); printf("\n"); for ( i=0;i 0; k--); /* wait */ printf("i=%d\n",i); for (j=0;j<9;j++) printf("%d\t",PARENT[i][j][0]); printf("\n"); for (j=0;j<9;j++) printf("%d\t",PARENT[i][j][1]); printf("\n"); printf("\n"); }; } display_node(text) char *text; { panel_set(nodetext, PANEL_LABEL_STRING, text, 0); } display_path(text) char *text; { panel_set(pathtext, PANEL_LABEL_STRING, text, 0); } display_message(text) char *text; { panel_set(msgtext, PANEL_LABEL_STRING, text, 0); } open_tracefile(filename) char *filename; { int c; if ((fp = fopen(filename,"r")) == NULL) { display_message(strcat("couldn't open file ",filename)); } else { display_message("loading..."); /* Count the lines in the file for the event slider. */ total_events = 0; while((c=getc(fp)) != EOF) if (c == '\n') total_events++; rewind(fp); panel_set(count_slider, PANEL_MAX_VALUE, total_events, PANEL_VALUE, 0, 0); scale = total_events/100; if ( scale == 0 ) scale = 1; display_message("select Go to begin"); newt_init(); } } FINDPNTS() { int nix,pix; /* printf("FINDPNTS \n"); */ nix = 0; while ( nix < HINOD ) { pix = 0; while ( pix < NODE[0][nix][NPNT] ) { PARENT[nix][pix][1] = SEARCH(PARENT[nix][pix][0]); pix++; }; nix++; }; } BLDLEVELS() { int parents,currlevel; int nix,pix,lvl; /* */ parents = 1; currlevel = 0; while ( parents ) { parents = 0; nix = 0; /* printf("Working on level %d \n",currlevel); */ while ( (nix = ATLEVEL(nix,currlevel)) != -1 ) { pix = 0; while ( pix < NODE[0][nix][NPNT]) { if (PARENT[nix][pix][1] != -1) { parents = 1; NODE[0][PARENT[nix][pix][1]][LVIX]= currlevel + 1; }; pix++; }; nix++; }; currlevel++; }; HILVL = currlevel; lvl = 0; while (lvl < HILVL) { LVLS[DEPTH][lvl] = 0; lvl++; }; nix = 0; while ( nix < HINOD ) { LVLS[DEPTH][NODE[0][nix][LVIX]]++; nix++; }; } ZEROLEVELS() { /* printf("ZEROLEVELS \n"); */ } ATLEVEL(nix,level) int nix,level; { /* printf("ATLEVEL \n"); */ while ( nix < HINOD ) { if (NODE[DEPTH][nix][LVIX] == level) return(nix); nix++; }; return(-1); } NODESEARCH(x,y) int x,y; { int r,nix; r = C_RADIUS*C_RADIUS; nix = -1; while (nix++ <= HINOD) if ( ((NODE[DEPTH][nix][XNODE] - x)*(NODE[DEPTH][nix][XNODE] - x) < r) && ((NODE[DEPTH][nix][YNODE] - y)*(NODE[DEPTH][nix][YNODE] - y) < r) ) return(nix); if (nix > HINOD) return(-1) ; } SEARCH(id) int id; { int nix; for (nix=0;(nix != HINOD) && (NODE[0][nix][ID] != id);nix++); if (nix == HINOD) return(-1) ; return(nix); } DYNSRCH(nix,did) int nix,did; { int i,j; j = DYNNODE[nix][0][0]; i = 1; while (i < j) { if ( DYNNODE[nix][i][0] == did ) return(i); i++; }; return (-1); } REBUILD() { int i,lv,flag,FLAG; /* printf("REBUILD \n"); */ DEPTH = 0; FINDPNTS(); BLDLEVELS(); ASSIGNXY(HILVL); for ( i=0;i<2;i++) { FLAG = 1; while ( FLAG ) { if ( i ) clearscreen(pw,XSVAL,YSVAL); FLAG = 0; lv = 0; while ( (lv < HILVL) && (FLAG == 0) ) { if ( flag = DRAWLEVEL(lv,i) ) FLAG = 1; lv++; }; }; } } ASSIGNXY(max_lvl) int max_lvl; { int i,yincr,lvl,nix,a,yvalue,xincr; /* printf("ASSIGNXY %d\n",max_lvl); */ for (i=0;i0 && ETYPE<6 ) { /* misread tracefile */ ETYPE = TIMES[id][0][0]; NOSKIP = 0; time_flag = 0; }; }; NODE[0][ix][RUNNING] = 1; /* printf("DOSTARTSTATIC time %f\n",TIMES[id][0][0]);*/ drawcircle(x=NODE[DEPTH][ix][XNODE],y=NODE[DEPTH][ix][YNODE],C_RADIUS,1,0,NODE[0][ix][RUNNING],ix); /* TEXT(x-5,y+3,1,0,NODE[0][ix][ID]) */ ACTIVEPROCS++; DISPLAYACTIVE(); return(1); } DOSTOPSTATIC() { int i,id,ix,x,y,a,t; float timing; fscanf(fp,"%d",&id); /* printf("DOSTOPSTATIC id %d\n",id);*/ if ( (ix = SEARCH(id)) == -1) { printf("STOPSTATIC: cannot find node %d\n",id); exit(1); }; if ( NODE[0][ix][RUNNING] != 1) { printf("STOPSTATIC: node %d is not running\n",id); fscanf(fp,"%f",&TIMES[id][0][1]); /* printf("DOSTOPSTATIC time %f\n",TIMES[id][0][1]); */ return(-1); }; fscanf(fp,"%f",&TIMES[id][0][1]); /* printf("DOSTOPSTATIC time %f\n",TIMES[id][0][1]);*/ if ( time_flag ) { timing = (TIMES[id][0][1] - TIMES[id][0][0]) * time_factor; if ( timing_flag ) { while ( (timing < 1000) && (timing > 0) ) { timing_flag = 0; timing = timing * 10; time_factor = time_factor * 10; }; }; timing = (100 - t_speed)*timing; printf(" timing %f\n",timing); while ( timing > 0 ) timing = timing - 1; /* wait */ }; /* TEXT(x-5,y+3,1,4,NODE(ix,ID)) */ NODE[0][ix][RUNNING] = 2; a = -1; while ( PARENT[ix][++a][0] ) if ( PARENT[ix][a][1] != -1 ) { --NODE[0][PARENT[ix][a][1]][NCH]; if ( DEPTH ) --NODE[DEPTH][PARENT[ix][a][1]][NCH]; if ( NODE[DEPTH][PARENT[ix][a][1]][NCH] == 0 ) drawcircle(x=NODE[DEPTH][PARENT[ix][a][1]][XNODE], y=NODE[DEPTH][PARENT[ix][a][1]][YNODE], C_RADIUS,1,0, NODE[0][PARENT[ix][a][1]][RUNNING], PARENT[ix][a][1]); }; drawcircle(x=NODE[DEPTH][ix][XNODE],y=NODE[DEPTH][ix][YNODE], C_RADIUS,1,0,NODE[0][ix][RUNNING],ix); ACTIVEPROCS-- ; DISPLAYACTIVE(); return(1); } DODYNNODE() { int nix,nid,did,dix; fscanf(fp,"%d %d",&nid,&did); /* printf("DODYNODE nid %d did %d\n",nid,did); */ if ( (nix = SEARCH(nid)) == -1) { printf("DODYNODE: cannot find node %d\n",nid); exit(1); }; if ( (dix = DYNNODE[nix][0][0]) == MAXDYNODES) { printf("DODYNNODE: no room for dyn node %d in %d \n",did,nid); exit(1); }; DYNNODE[nix][dix][0] = did; DYNNODE[nix][dix][1] = 0; DYNNODE[nix][0][0] = dix + 1; DRAW1DYN(nix,dix); } DOSTARTDYN() { int nid,did,dix,nix,sum,i; fscanf(fp,"%d %d",&nid,&did); /* printf("DOSTARTDYN nid %d did %d\n",nid,did);*/ if ( (nix = SEARCH(nid)) == -1) { printf("DOSTARTDYN: cannot find node %d\n",nid); exit(1); }; if ( (dix = DYNSRCH(nix,did)) == -1) { printf("DOSTARTDYN: cannot find dyn node %d in %d \n",nid,did); exit(1); }; if ( time_flag ) fscanf(fp,"%f",&TIMES[nix][dix][0]); /* printf("DOSTARTDYN time %f\n",TIMES[nix][dix][0]);*/ DYNNODE[nix][dix][1] = 1; sum = 0; for (i=1;i 0) ) { timing_flag = 0; timing = timing * 10; time_factor = time_factor * 10; }; timing = (100 - t_speed)*timing; printf(" timing %f\n",timing); while ( timing > 0 ) timing = timing - 1; /* wait */ }; DYNNODE[nix][dix][1] = 2; sum = 0; for (i=1;i&2 cat >sched.trace.h <<'End of sched.trace.h' #include #include #include #include "constants.h" #include "structures.h" /* Global variables. */ extern int XOFFSET; extern int YOFFSET; extern int XS,YS; extern int fd; extern int NODRAW; extern int HISTOGRAM; extern int HW; extern int HINOD; extern int HILVL; extern int XSIZE; extern int YSIZE; extern int NOSKIP; extern int ETYPE; extern int CURRENT_NODE; extern int C_LEN,C_INDEX,C_DONE,C_NODE,C_TABLE,C_FLAG; extern int DEPTH; extern int DYNZONE; extern int DYNDOWN; extern int ACTIVEPROCS; extern int MOSTPROCS; /* Arrays. */ extern int NODE[MAXDEPTH][MAXNODES][10]; extern int DYNNODE[MAXNODES][MAXDYNODES][3]; extern int LVLS[MAXDEPTH][MAXLVLS]; extern int PARENT[MAXNODES][10][3]; extern int A[MAXLVLS][MAXNODES][10]; extern float TIMES[MAXNODES]; extern char NAMES[MAXNODES][MAXDYNODES][50]; extern int PROCESSORS[MAXPROCESSORS]; extern struct x_y_pt { int x; int y; } pts[1000]; /* Used to create histogram of parallelism. */ extern int pt_count; /* count of pts to be plotted */ extern int histo_adj; /* shifts x-coordinates on histogram */ extern int event_count; /* count of events processed */ extern int total_events; /* total number of lines in file*/ extern int size_factor; /* allows one to expand or contract graph */ extern int time_factor; /* allows one to expand or contract graph */ extern int time_flag; /* determines whether timing is on or off */ extern int timing_flag; /* determines whether timing scale is set*/ extern int nodraw; /* do not draw, do everything else */ extern int start_draw_mark; /* start drawing when linecount gets here */ extern int done; extern int go; extern int sunny; extern int e_speed; extern int t_speed; extern int pending; extern int dt_index; /* directory_table index */ extern int ft_index; /* file_table index */ extern char *directory_table[128]; extern char *file_table[128]; extern FILE *fp; /* Pointer to the trace file */ extern int forward; extern int find_paths; extern struct critical_path *c_path; extern struct event *event_list, *trailer_event, *current_event; extern int number_of_processors; extern int screen_toggle; extern int show_processor; extern int show_legend; extern int file_loaded; extern int first_node_to_start; extern float first_time, last_time; End of sched.trace.h echo sched.trace.icon 1>&2 cat >sched.trace.icon <<'End of sched.trace.icon' /* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16 */ 0xFFFF,0xFFFF,0xFFFF,0xFFFF,0x8000,0x0000,0x0000,0x0001, 0x8000,0x0000,0x0000,0x0001,0x80F3,0xC93C,0xE248,0x3C01, 0x8082,0x0920,0x9248,0x2001,0x80F2,0x0F38,0x9248,0x3801, 0x8012,0x0920,0x9248,0x2001,0x80F3,0xC93C,0xE3CF,0x3C01, 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001, 0x8000,0x0000,0x0000,0x0001,0x81F3,0x821E,0x489E,0x0001, 0x8042,0x4510,0x4C90,0x0001,0x8043,0x8890,0x4A96,0x0001, 0x8042,0x8F90,0x4992,0x0001,0x8042,0x489E,0x489E,0x0001, 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001, 0x8000,0x0000,0x0000,0x0001,0x80F0,0x8792,0x09F2,0x2001, 0x8081,0x4412,0x0841,0x4001,0x80E2,0x2412,0x0840,0x8001, 0x8083,0xE412,0x0840,0x8001,0x8082,0x2793,0xC840,0x8001, 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001, 0x8000,0x0000,0x0000,0x0001,0x80FF,0xFFFF,0xFFFF,0xE001, 0x8000,0x0000,0x0000,0x0001,0x8000,0x0000,0x0000,0x0001, 0x8000,0x0000,0x0000,0x0001,0x8000,0x0001,0x8000,0x0001, 0x8000,0x0001,0x8000,0x0001,0x8000,0x0002,0x4000,0x0001, 0x8000,0x0004,0x2000,0x0001,0x8000,0x0008,0x1000,0x0001, 0x8000,0x0010,0x0800,0x0001,0x8000,0x0020,0x0400,0x0001, 0x8000,0x0040,0x0200,0x0001,0x8000,0x0080,0x0100,0x0001, 0x8000,0x0100,0x0080,0x0001,0x8000,0x0200,0x0040,0x0001, 0x8000,0x0C00,0x0030,0x0001,0x8000,0x0C00,0x0030,0x0001, 0x8000,0x1200,0x0048,0x0001,0x8000,0x1200,0x0048,0x0001, 0x8000,0x2100,0x0084,0x0001,0x8000,0x2100,0x0084,0x0001, 0x8000,0x4080,0x0102,0x0001,0x8000,0x4080,0x0102,0x0001, 0x8000,0x8040,0x0201,0x0001,0x8000,0x8040,0x0201,0x0001, 0x8003,0x0030,0x0C00,0xC001,0x8003,0x0030,0x0C00,0xC001, 0x8004,0x8048,0x1201,0x2001,0x8004,0x8048,0x1201,0x2001, 0x8004,0x8048,0x1201,0x2001,0x8008,0x4084,0x2102,0x1001, 0x8008,0x4084,0x2102,0x1001,0x8008,0x4084,0x2102,0x1001, 0x8018,0x6186,0x6186,0x1801,0x8018,0x6186,0x6186,0x1801, 0x8000,0x0000,0x0000,0x0001,0xFFFF,0xFFFF,0xFFFF,0xFFFF End of sched.trace.icon echo scheddefs.h 1>&2 cat >scheddefs.h <<'End of scheddefs.h' #include #include #include #include #include #include #include #include #include #include "constants.h" #include "structures.h" /* Global variables. */ int XOFFSET = 20; int YOFFSET = 50; int XS,YS; int fd; int NODRAW = FALSE; int HISTOGRAM = FALSE; int HW = 10; int HINOD = 0; int HILVL = 0; int XSIZE = 40; int YSIZE = 20; int NOSKIP; int ETYPE; int CURRENT_NODE; int C_LEN,C_INDEX,C_DONE,C_NODE,C_TABLE,C_FLAG; int DEPTH; int DYNZONE = 60; int DYNDOWN = 0; int ACTIVEPROCS =0; int MOSTPROCS = 0; /* Arrays. */ int NODE[MAXDEPTH][MAXNODES][10]; float CTIMES[MAXNODES]; int DYNNODE[MAXNODES][MAXDYNODES][3]; int LVLS[MAXDEPTH][MAXLVLS]; int PARENT[MAXNODES][MAXPARENTS][3]; int A[MAXLVLS][MAXNODES][10]; float TIMES[MAXNODES]; char NAMES[MAXNODES][MAXDYNODES][50]; int PROCESSORS[MAXPROCESSORS]; struct x_y_pt { int x; int y; } pts[1000]; /* Used to create histogram of parallelism. */ int pt_count; /* count of pts to be plotted */ int histo_adj; /* shifts x-coordinates on histogram */ int event_count; /* count of events processed */ int total_events; /* total number of lines in file*/ int size_factor; /* allows one to expand or contract graph */ int time_factor; /* allows one to expand or contract graph */ int time_flag; /* determines whether timing is on or off */ int timing_flag; /* determines whether timing scale is set*/ int nodraw; /* do not draw, do everything else */ int start_draw_mark; /* start drawing when linecount gets here */ int done = FALSE; int go = FALSE; int sunny; int e_speed; int t_speed; int pending; int dt_index; /* directory_table index */ int ft_index; /* file_table index */ char *directory_table[128]; char *file_table[128]; FILE *fp; /* Pointer to the trace file */ int forward = TRUE; int find_paths; struct critical_path *c_path; struct event *event_list, *trailer_event, *current_event; int number_of_processors; int screen_toggle = FALSE; int show_processor = FALSE; int show_legend = FALSE; int file_loaded = FALSE; int first_node_to_start; float first_time, last_time; int x_pos = 0; int y_pos = 0; Frame frame, histogram_frame, processor_frame, legend_frame; Panel panel; Canvas canvas, histogram_canvas, processor_canvas, legend_canvas; Scrollbar h_bar, v_bar; Textsw textsw; Tty ttysw; Panel_item title, popup_title, filetext, msgtext, directiontext, nodetext, pathtext, load_button, go_button, stop_button, step_button, quit_button, direction_button, subtree_button, full_button, path, path_button, prepath_button, redraw_button, histogram_button, timing_button, c_time_button, name_button, processor_button, contrast_button, legend_button, file_choice, directory_choice, e_speed_slider, t_speed_slider, cw_slider, count_slider; Pixwin *pw, *pw2, *pw_processor, *pw_legend; Menu path_menu; End of scheddefs.h echo search.c 1>&2 cat >search.c <<'End of search.c' #include "sched.trace.h" search(id) /* Find and return the index into the node array of a node, */ int id; /* given its node id. */ { int index; for (index = 0; (index != HINOD) && (NODE[0][index][ID] != id); index++); if (index != HINOD) return(index); else return(-1) ; } End of search.c echo structures.h 1>&2 cat >structures.h <<'End of structures.h' struct path_node { int index; struct path_node *parent; }; struct critical_path { float time; struct path_node *path; struct critical_path *next_path; }; struct event { int type; int node_id; int dynode_id; int processor; float time; struct event *next_event; struct event *previous_event; }; End of structures.h echo sundecs.h 1>&2 cat >sundecs.h <<'End of sundecs.h' #include #include #include #include #include #include extern int x_pos; extern int y_pos; extern Frame frame, histogram_frame, processor_frame, legend_frame; extern Panel panel; extern Canvas canvas, histogram_canvas, processor_canvas, legend_canvas; extern Scrollbar h_bar, v_bar; extern Textsw textsw; extern Tty ttysw; extern Panel_item title, popup_title, filetext, msgtext, directiontext, nodetext, pathtext, load_button, go_button, stop_button, step_button, quit_button, direction_button,subtree_button, full_button, path, path_button, prepath_button, redraw_button, histogram_button, timing_button, c_time_button, name_button, processor_button, contrast_button, legend_button, file_choice, directory_choice, e_speed_slider, t_speed_slider, cw_slider, count_slider; extern Pixwin *pw, *pw2, *pw_processor, *pw_legend; extern Menu path_menu; End of sundecs.h echo trace.100 1>&2 cat >trace.100 <<'End of trace.100' 8 0 3 1 1 2 aaa 0 2 1 1 1 aaa 0 5 1 1 4 aaa 0 4 1 1 1 aaa 0 7 1 1 6 aaa 0 6 1 1 1 aaa 0 9 1 1 8 aaa 0 8 1 1 1 aaa 0 11 1 1 10 aaa 0 10 1 1 1 aaa 0 1 5 0 xxx 0 12 0 5 3 5 7 9 11 zzz 1 12 7.90000021E-01 1 zzz 2 12 7.90000021E-01 zzz 1 3 7.90000021E-01 1 aaa 1 5 7.90000021E-01 2 aaa 1 7 7.90000021E-01 3 aaa 1 9 7.90000021E-01 4 aaa 1 11 7.90000021E-01 5 aaa 2 7 1.38999999E+00 aaa 1 6 1.38999999E+00 3 aaa 2 6 1.40999997E+00 aaa 2 11 1.41999996E+00 aaa 1 10 1.41999996E+00 3 aaa 2 9 1.41999996E+00 aaa 1 8 1.41999996E+00 4 aaa 2 10 1.44000006E+00 aaa 2 3 1.44000006E+00 aaa 2 8 1.44000006E+00 aaa 1 2 1.44000006E+00 3 aaa 2 2 1.47000003E+00 aaa 2 5 1.47000003E+00 aaa 1 4 1.47000003E+00 2 aaa 2 4 1.49000001E+00 aaa 1 1 1.49000001E+00 2 xxx 2 1 1.50000000E+00 xxx End of trace.100 echo trace.dc2new 1>&2 cat >trace.dc2new <<'End of trace.dc2new' 8 0 1 2 0 evdrv 0 2 2 1 1 evdrv 0 3 2 1 1 evdrv 0 4 2 1 2 evdrv 0 5 2 1 2 evdrv 0 6 2 1 3 evdrv 0 7 2 1 3 evdrv 0 8 0 1 4 tql2 0 9 0 1 4 tql2 0 10 0 1 5 tql2 0 11 0 1 5 tql2 0 12 0 1 6 tql2 0 13 0 1 6 tql2 0 14 0 1 7 tql2 0 15 0 1 7 tql2 1 9 2.70548010E+00 2 tql2 1 10 2.70564008E+00 3 tql2 1 11 2.70571995E+00 4 tql2 1 12 2.70599008E+00 5 tql2 1 13 2.70599008E+00 6 tql2 1 15 2.70599008E+00 8 tql2 1 14 2.70599008E+00 7 tql2 1 8 2.70599008E+00 1 tql2 2 10 2.70599008E+00 tql2 2 12 2.72403002E+00 tql2 2 14 2.72403002E+00 tql2 2 8 2.72403002E+00 tql2 2 9 2.72403002E+00 tql2 2 11 2.72403002E+00 tql2 1 4 2.73040009E+00 5 evdrv 2 13 2.72403002E+00 tql2 1 6 2.73040009E+00 2 evdrv 2 15 2.73040009E+00 tql2 1 5 2.73040009E+00 7 evdrv 1 7 2.73063993E+00 3 evdrv 3 6 17 evdrv 3 5 18 evdrv 3 4 19 evdrv 3 7 20 evdrv 4 4 19 2.73671007E+00 8 evdrv 4 6 17 2.73671007E+00 4 evdrv 3 6 21 evdrv 3 5 22 evdrv 3 4 23 evdrv 4 5 18 2.73671007E+00 6 evdrv 3 7 24 evdrv 3 6 25 evdrv 4 7 20 2.73671007E+00 1 evdrv 3 5 26 evdrv 3 4 27 evdrv 3 7 28 evdrv 3 6 29 evdrv 3 4 30 evdrv 3 5 31 evdrv 3 7 32 evdrv 3 4 33 evdrv 4 6 25 2.75013995E+00 2 evdrv 5 7 20 2.75013995E+00 evdrv 5 6 17 2.75219989E+00 evdrv 4 7 24 2.75243998E+00 1 evdrv 4 5 26 2.75252008E+00 3 evdrv 4 4 27 2.75259995E+00 4 evdrv 5 5 18 2.75300002E+00 evdrv 4 7 28 2.75290990E+00 5 evdrv 4 6 21 2.75318003E+00 6 evdrv 4 5 22 2.75356007E+00 7 evdrv 5 4 19 2.75391006E+00 evdrv 4 4 23 2.75450993E+00 8 evdrv 5 6 25 2.75843000E+00 evdrv 5 4 27 2.75852990E+00 evdrv 4 4 33 2.75881004E+00 2 evdrv 4 6 29 2.75889993E+00 4 evdrv 5 7 28 2.76626992E+00 evdrv 4 4 30 2.76653004E+00 5 evdrv 5 7 24 2.76700997E+00 evdrv 5 4 33 2.76810002E+00 evdrv 4 7 32 2.76810002E+00 1 evdrv 4 5 31 2.77007008E+00 2 evdrv 5 5 26 2.76997995E+00 evdrv 5 6 29 2.77031994E+00 evdrv 5 6 21 2.77063990E+00 evdrv 1 6 2.77089000E+00 3 evdrv 5 5 22 2.77115011E+00 evdrv 5 4 23 2.77134991E+00 evdrv 2 6 2.77205992E+00 evdrv 5 7 32 2.77532005E+00 evdrv 1 7 2.77723002E+00 6 evdrv 5 4 30 2.77723002E+00 evdrv 1 4 2.77723002E+00 3 evdrv 5 5 31 2.77926993E+00 evdrv 2 4 2.77926993E+00 evdrv 1 5 2.77926993E+00 1 evdrv 2 7 2.77926993E+00 evdrv 1 3 2.78259993E+00 2 evdrv 2 5 2.78468990E+00 evdrv 1 2 2.78468990E+00 7 evdrv 3 3 34 evdrv 4 3 34 2.78468990E+00 6 evdrv 3 3 35 evdrv 3 3 36 evdrv 4 3 35 2.79702997E+00 8 evdrv 4 3 36 2.79702997E+00 1 evdrv 3 3 37 evdrv 3 3 38 evdrv 4 3 37 2.79702997E+00 5 evdrv 4 3 38 2.79702997E+00 4 evdrv 3 3 39 evdrv 3 3 40 evdrv 4 3 39 2.79702997E+00 3 evdrv 3 3 41 evdrv 3 3 42 evdrv 3 3 43 evdrv 3 2 44 evdrv 3 2 45 evdrv 3 2 46 evdrv 3 2 47 evdrv 3 2 48 evdrv 3 2 49 evdrv 3 2 50 evdrv 3 2 51 evdrv 3 2 52 evdrv 3 2 53 evdrv 5 3 39 2.80342007E+00 evdrv 4 3 42 2.80342007E+00 3 evdrv 5 3 36 2.80342007E+00 evdrv 5 3 37 2.80342007E+00 evdrv 5 3 34 2.83034992E+00 evdrv 4 3 41 2.80342007E+00 2 evdrv 4 3 40 2.80342007E+00 1 evdrv 5 3 38 2.83034992E+00 evdrv 5 3 35 2.83034992E+00 evdrv 4 2 44 2.83034992E+00 5 evdrv 4 3 43 2.83034992E+00 4 evdrv 4 2 45 2.83058000E+00 6 evdrv 4 2 47 2.83076000E+00 8 evdrv 4 2 46 2.83076000E+00 7 evdrv 5 3 41 2.83076000E+00 evdrv 5 3 40 2.83076000E+00 evdrv 4 2 49 2.83076000E+00 2 evdrv 4 2 48 2.83076000E+00 1 evdrv 5 3 43 2.83076000E+00 evdrv 4 2 51 2.83076000E+00 4 evdrv 5 2 44 2.83076000E+00 evdrv 5 3 42 2.83076000E+00 evdrv 4 2 52 2.83076000E+00 5 evdrv 4 2 50 2.83076000E+00 3 evdrv 5 2 45 2.83076000E+00 evdrv 5 2 47 2.86201000E+00 evdrv 4 2 53 2.86201000E+00 6 evdrv 5 2 46 2.86222005E+00 evdrv 1 3 2.86251998E+00 8 evdrv 2 3 2.86640000E+00 evdrv 5 2 49 2.86661005E+00 evdrv 5 2 48 2.86661005E+00 evdrv 5 2 51 2.87714005E+00 evdrv 5 2 50 2.87714005E+00 evdrv 5 2 53 2.87714005E+00 evdrv 5 2 52 2.87714005E+00 evdrv 1 2 2.89314008E+00 8 evdrv 2 2 2.89651990E+00 evdrv 1 1 2.89674997E+00 4 evdrv 3 1 54 evdrv 4 1 54 2.89674997E+00 1 evdrv 3 1 55 evdrv 3 1 56 evdrv 4 1 55 2.94768000E+00 8 evdrv 4 1 56 2.94768000E+00 7 evdrv 3 1 57 evdrv 3 1 58 evdrv 4 1 57 2.94768000E+00 3 evdrv 4 1 58 2.94768000E+00 5 evdrv 3 1 59 evdrv 3 1 60 evdrv 4 1 59 2.95273995E+00 2 evdrv 4 1 60 2.95273995E+00 6 evdrv 3 1 61 evdrv 3 1 62 evdrv 3 1 63 evdrv 5 1 59 2.95273995E+00 evdrv 4 1 61 2.95273995E+00 2 evdrv 5 1 54 2.95273995E+00 evdrv 5 1 57 2.95273995E+00 evdrv 5 1 60 2.95273995E+00 evdrv 4 1 62 2.95273995E+00 1 evdrv 4 1 63 2.95273995E+00 3 evdrv 5 1 58 2.95273995E+00 evdrv 5 1 56 2.95273995E+00 evdrv 5 1 55 2.99871993E+00 evdrv 5 1 61 3.02235007E+00 evdrv 5 1 62 3.02235007E+00 evdrv 5 1 63 3.02235007E+00 evdrv 1 1 3.02235007E+00 7 evdrv 2 1 3.02235007E+00 evdrv End of trace.dc2new echo trace.dcnew 1>&2 cat >trace.dcnew <<'End of trace.dcnew' 8 0 1 2 0 evdrv 0 2 2 1 1 evdrv 0 3 2 1 1 evdrv 0 4 2 1 2 evdrv 0 5 2 1 2 evdrv 0 6 2 1 3 evdrv 0 7 2 1 3 evdrv 0 8 0 1 4 tql2 0 9 0 1 4 tql2 0 10 0 1 5 tql2 0 11 0 1 5 tql2 0 12 0 1 6 tql2 0 13 0 1 6 tql2 0 14 0 1 7 tql2 0 15 0 1 7 tql2 1 9 2.70548010E+00 2 tql2 1 10 2.70564008E+00 3 tql2 1 11 2.70571995E+00 4 tql2 1 12 2.70599008E+00 5 tql2 1 13 2.70599008E+00 6 tql2 1 15 2.70599008E+00 8 tql2 1 14 2.70599008E+00 7 tql2 1 8 2.70599008E+00 1 tql2 2 10 2.70599008E+00 tql2 2 12 2.72403002E+00 tql2 2 14 2.72403002E+00 tql2 2 8 2.72403002E+00 tql2 2 9 2.72403002E+00 tql2 2 11 2.72403002E+00 tql2 1 4 2.73040009E+00 5 evdrv 2 13 2.72403002E+00 tql2 1 6 2.73040009E+00 2 evdrv 2 15 2.73040009E+00 tql2 1 5 2.73040009E+00 7 evdrv 1 7 2.73063993E+00 3 evdrv 3 6 17 evdrv 3 5 18 evdrv 3 4 19 evdrv 3 7 20 evdrv 4 4 19 2.73671007E+00 8 evdrv 4 6 17 2.73671007E+00 4 evdrv 3 6 21 evdrv 3 5 22 evdrv 3 4 23 evdrv 4 5 18 2.73671007E+00 6 evdrv 3 7 24 evdrv 3 6 25 evdrv 4 7 20 2.73671007E+00 1 evdrv 3 5 26 evdrv 3 4 27 evdrv 3 7 28 evdrv 3 6 29 evdrv 3 4 30 evdrv 3 5 31 evdrv 3 7 32 evdrv 3 4 33 evdrv 4 6 25 2.75013995E+00 2 evdrv 5 7 20 2.75013995E+00 evdrv 5 6 17 2.75219989E+00 evdrv 4 7 24 2.75243998E+00 1 evdrv 4 5 26 2.75252008E+00 3 evdrv 4 4 27 2.75259995E+00 4 evdrv 5 5 18 2.75300002E+00 evdrv 4 7 28 2.75290990E+00 5 evdrv 4 6 21 2.75318003E+00 6 evdrv 4 5 22 2.75356007E+00 7 evdrv 5 4 19 2.75391006E+00 evdrv 4 4 23 2.75450993E+00 8 evdrv 5 6 25 2.75843000E+00 evdrv 5 4 27 2.75852990E+00 evdrv 4 4 33 2.75881004E+00 2 evdrv 4 6 29 2.75889993E+00 4 evdrv 5 7 28 2.76626992E+00 evdrv 4 4 30 2.76653004E+00 5 evdrv 5 7 24 2.76700997E+00 evdrv 5 4 33 2.76810002E+00 evdrv 4 7 32 2.76810002E+00 1 evdrv 4 5 31 2.77007008E+00 2 evdrv 5 5 26 2.76997995E+00 evdrv 5 6 29 2.77031994E+00 evdrv 5 6 21 2.77063990E+00 evdrv 1 6 2.77089000E+00 3 evdrv 5 5 22 2.77115011E+00 evdrv 5 4 23 2.77134991E+00 evdrv 2 6 2.77205992E+00 evdrv 5 7 32 2.77532005E+00 evdrv 1 7 2.77723002E+00 6 evdrv 5 4 30 2.77723002E+00 evdrv 1 4 2.77723002E+00 3 evdrv 5 5 31 2.77926993E+00 evdrv 2 4 2.77926993E+00 evdrv 1 5 2.77926993E+00 1 evdrv 2 7 2.77926993E+00 evdrv 1 3 2.78259993E+00 2 evdrv 2 5 2.78468990E+00 evdrv 1 2 2.78468990E+00 7 evdrv 3 3 34 evdrv 4 3 34 2.78468990E+00 6 evdrv 3 3 35 evdrv 3 3 36 evdrv 4 3 35 2.79702997E+00 8 evdrv 4 3 36 2.79702997E+00 1 evdrv 3 3 37 evdrv 3 3 38 evdrv 4 3 37 2.79702997E+00 5 evdrv 4 3 38 2.79702997E+00 4 evdrv 3 3 39 evdrv 3 3 40 evdrv 4 3 39 2.79702997E+00 3 evdrv 3 3 41 evdrv 3 3 42 evdrv 3 3 43 evdrv 3 2 44 evdrv 3 2 45 evdrv 3 2 46 evdrv 3 2 47 evdrv 3 2 48 evdrv 3 2 49 evdrv 3 2 50 evdrv 3 2 51 evdrv 3 2 52 evdrv 3 2 53 evdrv 5 3 39 2.80342007E+00 evdrv 4 3 42 2.80342007E+00 3 evdrv 5 3 36 2.80342007E+00 evdrv 5 3 37 2.80342007E+00 evdrv 5 3 34 2.83034992E+00 evdrv 4 3 41 2.80342007E+00 2 evdrv 4 3 40 2.80342007E+00 1 evdrv 5 3 38 2.83034992E+00 evdrv 5 3 35 2.83034992E+00 evdrv 4 2 44 2.83034992E+00 5 evdrv 4 3 43 2.83034992E+00 4 evdrv 4 2 45 2.83058000E+00 6 evdrv 4 2 47 2.83076000E+00 8 evdrv 4 2 46 2.83076000E+00 7 evdrv 5 3 41 2.83076000E+00 evdrv 5 3 40 2.83076000E+00 evdrv 4 2 49 2.83076000E+00 2 evdrv 4 2 48 2.83076000E+00 1 evdrv 5 3 43 2.83076000E+00 evdrv 4 2 51 2.83076000E+00 4 evdrv 5 2 44 2.83076000E+00 evdrv 5 3 42 2.83076000E+00 evdrv 4 2 52 2.83076000E+00 5 evdrv 4 2 50 2.83076000E+00 3 evdrv 5 2 45 2.83076000E+00 evdrv 5 2 47 2.86201000E+00 evdrv 4 2 53 2.86201000E+00 6 evdrv 5 2 46 2.86222005E+00 evdrv 1 3 2.86251998E+00 8 evdrv 2 3 2.86640000E+00 evdrv 5 2 49 2.86661005E+00 evdrv 5 2 48 2.86661005E+00 evdrv 5 2 51 2.87714005E+00 evdrv 5 2 50 2.87714005E+00 evdrv 5 2 53 2.87714005E+00 evdrv 5 2 52 2.87714005E+00 evdrv 1 2 2.89314008E+00 8 evdrv 2 2 2.89651990E+00 evdrv 1 1 2.89674997E+00 4 evdrv 3 1 54 evdrv 4 1 54 2.89674997E+00 1 evdrv 3 1 55 evdrv 3 1 56 evdrv 4 1 55 2.94768000E+00 8 evdrv 4 1 56 2.94768000E+00 7 evdrv 3 1 57 evdrv 3 1 58 evdrv 4 1 57 2.94768000E+00 3 evdrv 4 1 58 2.94768000E+00 5 evdrv 3 1 59 evdrv 3 1 60 evdrv 4 1 59 2.95273995E+00 2 evdrv 4 1 60 2.95273995E+00 6 evdrv 3 1 61 evdrv 3 1 62 evdrv 3 1 63 evdrv 5 1 59 2.95273995E+00 evdrv 4 1 61 2.95273995E+00 2 evdrv 5 1 54 2.95273995E+00 evdrv 5 1 57 2.95273995E+00 evdrv 5 1 60 2.95273995E+00 evdrv 4 1 62 2.95273995E+00 1 evdrv 4 1 63 2.95273995E+00 3 evdrv 5 1 58 2.95273995E+00 evdrv 5 1 56 2.95273995E+00 evdrv 5 1 55 2.99871993E+00 evdrv 5 1 61 3.02235007E+00 evdrv 5 1 62 3.02235007E+00 evdrv 5 1 63 3.02235007E+00 evdrv 1 1 3.02235007E+00 7 evdrv 2 1 3.02235007E+00 evdrv End of trace.dcnew echo trace.graph 1>&2 cat >trace.graph <<'End of trace.graph' 8 0 1 2 0 evdrv 0 2 2 1 1 evdrv 0 3 2 1 1 evdrv 0 4 2 1 2 evdrv 0 5 2 1 2 evdrv 0 6 2 1 3 evdrv 0 7 2 1 3 evdrv 0 8 0 1 4 tql2 0 9 0 1 4 tql2 0 10 0 1 5 tql2 0 11 0 1 5 tql2 0 12 0 1 6 tql2 0 13 0 1 6 tql2 0 14 0 1 7 tql2 0 15 0 1 7 tql2 1 9 2.76972008E+00 2 tql2 1 10 2.76990008E+00 3 tql2 1 11 2.76997995E+00 4 tql2 1 12 2.77015996E+00 5 tql2 1 13 2.77015996E+00 6 tql2 1 15 2.77015996E+00 8 tql2 1 14 2.77015996E+00 7 tql2 1 8 2.77015996E+00 1 tql2 2 10 2.77037001E+00 tql2 2 14 2.77037001E+00 tql2 2 12 2.77037001E+00 tql2 2 8 2.79243994E+00 tql2 2 9 2.79481006E+00 tql2 2 15 2.79481006E+00 tql2 2 11 2.79481006E+00 tql2 1 4 2.79505992E+00 5 evdrv 2 13 2.79505992E+00 tql2 1 5 2.79505992E+00 3 evdrv 1 7 2.79505992E+00 7 evdrv 1 6 2.79505992E+00 2 evdrv 3 5 17 evdrv 3 4 18 evdrv 3 7 19 evdrv 3 6 20 evdrv 4 5 17 2.80112004E+00 8 evdrv 3 5 21 evdrv 3 4 22 evdrv 4 4 18 2.80112004E+00 4 evdrv 4 7 19 2.80202007E+00 1 evdrv 3 7 23 evdrv 3 6 24 evdrv 3 5 25 evdrv 3 4 26 evdrv 4 6 20 2.80112004E+00 6 evdrv 3 7 27 evdrv 3 6 28 evdrv 3 5 29 evdrv 3 4 30 evdrv 3 7 31 evdrv 3 6 32 evdrv 3 4 33 evdrv 5 4 18 2.81402993E+00 evdrv 4 7 27 2.81636000E+00 4 evdrv 4 5 25 2.81644011E+00 2 evdrv 4 4 26 2.81677008E+00 3 evdrv 4 6 28 2.81685996E+00 5 evdrv 5 7 19 2.81702995E+00 evdrv 4 6 24 2.81729007E+00 1 evdrv 4 4 22 2.81737995E+00 7 evdrv 5 6 20 2.81787992E+00 evdrv 4 5 21 2.82076001E+00 6 evdrv 5 5 17 2.82114005E+00 evdrv 4 7 23 2.82173991E+00 8 evdrv 5 5 25 2.82540011E+00 evdrv 4 4 33 2.82703996E+00 2 evdrv 5 4 26 2.82805991E+00 evdrv 5 7 27 2.82897997E+00 evdrv 4 5 29 2.82977009E+00 3 evdrv 4 4 30 2.82984996E+00 4 evdrv 5 6 28 2.83353996E+00 evdrv 4 7 31 2.83383012E+00 5 evdrv 5 4 22 2.83390999E+00 evdrv 5 5 21 2.83406997E+00 evdrv 4 6 32 2.83416009E+00 7 evdrv 5 6 24 2.83526993E+00 evdrv 5 4 33 2.83708000E+00 evdrv 5 7 23 2.84118009E+00 evdrv 5 5 29 2.84118009E+00 evdrv 1 5 2.84139991E+00 2 evdrv 5 4 30 2.84297991E+00 evdrv 1 4 2.84391999E+00 8 evdrv 2 5 2.84414005E+00 evdrv 5 7 31 2.84506011E+00 evdrv 2 4 2.84594011E+00 evdrv 1 7 2.84617996E+00 2 evdrv 1 2 2.84617996E+00 3 evdrv 2 7 2.84833002E+00 evdrv 5 6 32 2.85086989E+00 evdrv 1 6 2.85086989E+00 6 evdrv 2 6 2.85405993E+00 evdrv 1 3 2.85597992E+00 8 evdrv 3 2 34 evdrv 4 2 34 2.85597992E+00 2 evdrv 3 2 35 evdrv 4 2 35 2.85597992E+00 4 evdrv 3 2 36 evdrv 4 2 36 2.85597992E+00 7 evdrv 3 2 37 evdrv 3 2 38 evdrv 4 2 37 2.85597992E+00 5 evdrv 3 2 39 evdrv 4 2 38 2.85597992E+00 6 evdrv 3 2 40 evdrv 4 2 39 2.85597992E+00 1 evdrv 3 2 41 evdrv 3 2 42 evdrv 3 2 43 evdrv 3 3 44 evdrv 3 3 45 evdrv 3 3 46 evdrv 3 3 47 evdrv 3 3 48 evdrv 3 3 49 evdrv 3 3 50 evdrv 3 3 51 evdrv 3 3 52 evdrv 5 2 39 2.87280011E+00 evdrv 5 2 34 2.87280011E+00 evdrv 5 2 35 2.87280011E+00 evdrv 5 2 37 2.87280011E+00 evdrv 5 2 36 2.87280011E+00 evdrv 5 2 38 2.87280011E+00 evdrv 3 3 53 evdrv 4 2 42 2.87280011E+00 3 evdrv 4 2 41 2.87280011E+00 2 evdrv 4 3 44 2.87280011E+00 5 evdrv 4 2 43 2.87280011E+00 4 evdrv 4 3 45 2.87280011E+00 6 evdrv 4 2 40 2.87280011E+00 1 evdrv 4 3 46 2.87280011E+00 7 evdrv 5 2 43 2.90348005E+00 evdrv 4 3 47 2.90372992E+00 8 evdrv 4 3 51 2.90372992E+00 4 evdrv 5 2 40 2.90372992E+00 evdrv 5 2 41 2.90372992E+00 evdrv 4 3 49 2.90372992E+00 2 evdrv 4 3 48 2.90372992E+00 1 evdrv 5 3 44 2.90372992E+00 evdrv 4 3 52 2.90372992E+00 5 evdrv 5 3 45 2.91260004E+00 evdrv 5 3 46 2.91269994E+00 evdrv 5 2 42 2.91279006E+00 evdrv 4 3 50 2.91279006E+00 7 evdrv 1 2 2.91279006E+00 3 evdrv 4 3 53 2.91279006E+00 6 evdrv 2 2 2.91279006E+00 evdrv 5 3 51 2.91279006E+00 evdrv 5 3 49 2.91279006E+00 evdrv 5 3 47 2.93586993E+00 evdrv 5 3 48 2.93612003E+00 evdrv 5 3 50 2.93612003E+00 evdrv 5 3 53 2.93612003E+00 evdrv 5 3 52 2.93612003E+00 evdrv 1 3 2.93612003E+00 4 evdrv 2 3 2.93612003E+00 evdrv 1 1 2.95104003E+00 8 evdrv 3 1 54 evdrv 3 1 55 evdrv 4 1 54 2.99597001E+00 7 evdrv 4 1 55 2.99597001E+00 6 evdrv 3 1 56 evdrv 4 1 56 2.99597001E+00 2 evdrv 3 1 57 evdrv 4 1 57 3.00617003E+00 5 evdrv 3 1 58 evdrv 4 1 58 3.00626993E+00 1 evdrv 3 1 59 evdrv 3 1 60 evdrv 4 1 59 3.00635004E+00 3 evdrv 3 1 61 evdrv 4 1 60 3.00635004E+00 4 evdrv 3 1 62 evdrv 3 1 63 evdrv 5 1 59 3.01819992E+00 evdrv 5 1 60 3.01819992E+00 evdrv 4 1 61 3.01819992E+00 3 evdrv 4 1 62 3.01819992E+00 4 evdrv 5 1 56 3.01819992E+00 evdrv 5 1 58 3.01819992E+00 evdrv 5 1 57 3.01819992E+00 evdrv 4 1 63 3.01819992E+00 2 evdrv 5 1 55 3.01819992E+00 evdrv 5 1 54 3.01819992E+00 evdrv 5 1 61 3.07873988E+00 evdrv 5 1 62 3.07873988E+00 evdrv 5 1 63 3.07873988E+00 evdrv 1 1 3.08858991E+00 8 evdrv 2 1 3.10532999E+00 evdrv End of trace.graph echo trace.tsnew 1>&2 cat >trace.tsnew <<'End of trace.tsnew' 8 0 1 0 7 2 3 4 5 6 7 8 stuff1 0 2 1 1 9 stuff2 0 3 1 1 16 stuff2 0 4 1 1 22 stuff2 0 5 1 1 27 stuff2 0 6 1 1 31 stuff2 0 7 1 1 34 stuff2 0 8 1 1 36 stuff2 0 9 1 6 10 11 12 13 14 15 stuff1 0 10 1 1 16 stuff2 0 11 1 1 22 stuff2 0 12 1 1 27 stuff2 0 13 1 1 31 stuff2 0 14 1 1 34 stuff2 0 15 1 1 36 stuff2 0 16 2 5 17 18 19 20 21 stuff1 0 17 1 1 22 stuff2 0 18 1 1 27 stuff2 0 19 1 1 31 stuff2 0 20 1 1 34 stuff2 0 21 1 1 36 stuff2 0 22 3 4 23 24 25 26 stuff1 0 23 1 1 27 stuff2 0 24 1 1 31 stuff2 0 25 1 1 34 stuff2 0 26 1 1 36 stuff2 0 27 4 3 28 29 30 stuff1 0 28 1 1 31 stuff2 0 29 1 1 34 stuff2 0 30 1 1 36 stuff2 0 31 5 2 32 33 stuff1 0 32 1 1 34 stuff2 0 33 1 1 36 stuff2 0 34 6 1 35 stuff1 0 35 1 1 36 stuff2 0 36 7 0 stuff1 1 1 4.92299981E-02 2 stuff1 2 1 5.13899997E-02 stuff1 1 2 5.30899987E-02 4 stuff2 1 3 5.43799996E-02 7 stuff2 1 4 5.45700006E-02 5 stuff2 1 5 5.43799996E-02 3 stuff2 1 6 5.35000004E-02 8 stuff2 1 7 5.35000004E-02 1 stuff2 1 8 5.43799996E-02 6 stuff2 2 2 5.35000004E-02 stuff2 2 7 5.35000004E-02 stuff2 1 9 5.43799996E-02 2 stuff1 2 6 5.43799996E-02 stuff2 2 5 5.43799996E-02 stuff2 2 9 5.43799996E-02 stuff1 2 8 5.45700006E-02 stuff2 2 3 5.45700006E-02 stuff2 1 10 5.45700006E-02 4 stuff2 1 11 5.45700006E-02 1 stuff2 1 12 5.45700006E-02 3 stuff2 2 10 5.45700006E-02 stuff2 2 4 5.45700006E-02 stuff2 2 12 5.45700006E-02 stuff2 1 13 5.45700006E-02 2 stuff2 1 14 5.45700006E-02 3 stuff2 2 11 5.45700006E-02 stuff2 2 13 5.47900014E-02 stuff2 1 15 5.53199984E-02 8 stuff2 2 14 5.53199984E-02 stuff2 1 16 5.53199984E-02 1 stuff1 2 16 5.53199984E-02 stuff1 2 15 5.61500005E-02 stuff2 1 17 5.63200004E-02 5 stuff2 1 18 5.63200004E-02 3 stuff2 1 19 5.63200004E-02 7 stuff2 1 20 5.61500005E-02 4 stuff2 1 21 5.63200004E-02 2 stuff2 2 20 5.63200004E-02 stuff2 2 19 5.63200004E-02 stuff2 2 18 5.63200004E-02 stuff2 2 21 5.63200004E-02 stuff2 2 17 5.63200004E-02 stuff2 1 22 5.63200004E-02 6 stuff1 2 22 5.63200004E-02 stuff1 1 23 6.16700016E-02 7 stuff2 1 24 6.16700016E-02 2 stuff2 1 25 6.16700016E-02 5 stuff2 1 26 6.16700016E-02 8 stuff2 2 23 6.16700016E-02 stuff2 2 24 6.25000000E-02 stuff2 2 26 6.25000000E-02 stuff2 1 27 6.25000000E-02 4 stuff1 2 25 6.25000000E-02 stuff2 2 27 6.25000000E-02 stuff1 1 28 6.26799986E-02 6 stuff2 1 29 6.26799986E-02 7 stuff2 1 30 6.26799986E-02 1 stuff2 2 30 6.26799986E-02 stuff2 2 28 6.26799986E-02 stuff2 2 29 6.26799986E-02 stuff2 1 31 6.59800023E-02 8 stuff1 2 31 6.69900030E-02 stuff1 1 32 6.72399998E-02 6 stuff2 1 33 6.72399998E-02 3 stuff2 2 33 6.72399998E-02 stuff2 2 32 6.72399998E-02 stuff2 1 34 6.99400008E-02 8 stuff1 2 34 7.07700029E-02 stuff1 1 35 7.09600002E-02 6 stuff2 2 35 7.09600002E-02 stuff2 1 36 7.29900002E-02 8 stuff1 2 36 7.38100037E-02 stuff1 End of trace.tsnew echo trcxx.1 1>&2 cat >trcxx.1 <<'End of trcxx.1' 0 1 2 0 0 2 1 1 1 0 3 1 1 1 0 4 0 1 2 0 5 0 1 3 End of trcxx.1 echo trcxx.2 1>&2 cat >trcxx.2 <<'End of trcxx.2' 0 1 4 0 0 2 1 1 1 0 3 1 1 1 0 4 0 1 2 0 5 0 1 3 0 6 2 2 1 9 0 7 0 1 6 0 8 0 1 6 0 9 1 1 1 End of trcxx.2 echo trcxx.3 1>&2 cat >trcxx.3 <<'End of trcxx.3' 0 2 5 0 0 3 0 3 2 1 7 0 5 0 3 1 6 6 7 0 6 3 1 2 0 7 2 1 2 End of trcxx.3 echo trcxx.foo 1>&2 cat >trcxx.foo <<'End of trcxx.foo' 0 1 4 0 0 2 4 1 1 0 3 0 1 1 0 4 0 1 1 0 5 0 1 1 0 6 0 1 2 0 7 0 1 2 0 8 0 1 2 0 9 0 1 2 End of trcxx.foo echo window_init.c 1>&2 cat >window_init.c <<'End of window_init.c' #include "sched.trace.h" #include "sundecs.h" extern void load_notify_proc(), go_notify_proc(), step_notify_proc(), stop_notify_proc(), direction_notify_proc(), full_notify_proc(), timing_notify_proc(), subtree_notify_proc(), prepath_notify_proc(), c_time_notify_proc(), name_notify_proc(), path_notify_proc(), redraw_notify_proc(), histogram_notify_proc(), contrast_notify_proc(), processor_notify_proc(), legend_notify_proc(), quit_notify_proc(), e_speed_notify_proc(), t_speed_notify_proc(), count_notify_proc(), directory_notify_proc(), file_notify_proc(), handle_event(); static short icon_image[] = { #include "sched.trace.icon" }; DEFINE_ICON_FROM_IMAGE (sched_trace_icon, icon_image); window_init() { struct pixfont *title_font; frame = window_create(NULL, FRAME, WIN_ROWS, 45, WIN_COLUMNS, 95, FRAME_ICON, &sched_trace_icon, WIN_X, 200, WIN_Y, 100, 0); panel = window_create(frame, PANEL, WIN_PERCENT_HEIGHT, 30, 0); histogram_frame = window_create(frame, FRAME, WIN_ROWS, 8, WIN_COLUMNS, 60, 0); processor_frame = window_create(frame, FRAME, WIN_ROWS, 8, WIN_COLUMNS, 60, 0); legend_frame = window_create(frame, FRAME, WIN_ROWS, 8, WIN_COLUMNS, 60, 0); window_fit(histogram_frame); window_fit(processor_frame); window_fit(legend_frame); title_font = pf_open("/usr/lib/fonts/fixedwidthfonts/gallant.r.19"); title = panel_create_item(panel, PANEL_MESSAGE, PANEL_ITEM_X, ATTR_COL(23), PANEL_ITEM_Y, ATTR_ROW(0), PANEL_LABEL_STRING, "Argonne Schedule Tracing Facility", PANEL_LABEL_FONT, title_font, 0); directory_choice = panel_create_item(panel, PANEL_CHOICE, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(1), PANEL_LABEL_STRING, "Directory: ", PANEL_DISPLAY_LEVEL, PANEL_NONE, PANEL_NOTIFY_PROC, directory_notify_proc, 0); file_choice = panel_create_item(panel, PANEL_CHOICE, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(2), PANEL_LABEL_STRING, "Trace file: ", PANEL_DISPLAY_LEVEL, PANEL_NONE, PANEL_NOTIFY_PROC, file_notify_proc, 0); count_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(3), PANEL_VALUE, 100, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 100, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, TRUE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "Events ", PANEL_NOTIFY_PROC, count_notify_proc, 0); cw_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(4), PANEL_VALUE, 0, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 100, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, FALSE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "Active Processes", 0); t_speed_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(5), PANEL_VALUE, 100, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 100, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, TRUE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "Timing Speed", PANEL_NOTIFY_PROC, t_speed_notify_proc, 0); e_speed_slider = panel_create_item(panel, PANEL_SLIDER, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(6), PANEL_VALUE, 100, PANEL_MIN_VALUE, 0, PANEL_MAX_VALUE, 100, PANEL_SLIDER_WIDTH, 400, PANEL_SHOW_RANGE, TRUE, PANEL_SHOW_VALUE, TRUE, PANEL_LABEL_STRING, "Event Speed", PANEL_NOTIFY_PROC, e_speed_notify_proc, 0); window_set(panel, PANEL_ITEM_X_GAP, 5, 0); load_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Load",0,NULL), PANEL_NOTIFY_PROC, load_notify_proc, 0); go_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Go",0,NULL), PANEL_NOTIFY_PROC, go_notify_proc, 0); stop_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Stop",0,NULL), PANEL_NOTIFY_PROC, stop_notify_proc, 0); direction_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel, "Forward ", 0, NULL), PANEL_NOTIFY_PROC, direction_notify_proc, 0); step_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Step",0,NULL), PANEL_NOTIFY_PROC, step_notify_proc, 0); full_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Full",0,NULL), PANEL_NOTIFY_PROC, full_notify_proc, 0); path_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Path",0,NULL), PANEL_NOTIFY_PROC, path_notify_proc, 0); prepath_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Cprep",0,NULL), PANEL_NOTIFY_PROC, prepath_notify_proc, 0); c_time_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Critical time",0,NULL), PANEL_NOTIFY_PROC, c_time_notify_proc, 0); name_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Process name",0,NULL), PANEL_NOTIFY_PROC, name_notify_proc, 0); quit_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(85), PANEL_ITEM_Y, ATTR_ROW(7), PANEL_LABEL_IMAGE, panel_button_image(panel,"Quit",0,NULL), PANEL_NOTIFY_PROC, quit_notify_proc, 0); subtree_button = panel_create_item(panel, PANEL_BUTTON, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(8), PANEL_LABEL_IMAGE, panel_button_image(panel,"Subtree",0,NULL), PANEL_NOTIFY_PROC, subtree_notify_proc, 0); redraw_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Redraw",0,NULL), PANEL_NOTIFY_PROC, redraw_notify_proc, 0); histogram_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Histogram",0,NULL), PANEL_NOTIFY_PROC, histogram_notify_proc, 0); processor_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Processor",0,NULL), PANEL_NOTIFY_PROC, processor_notify_proc, 0); legend_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Legend",0,NULL), PANEL_NOTIFY_PROC, legend_notify_proc, 0); contrast_button = panel_create_item(panel, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(panel,"Contrast",0,NULL), PANEL_NOTIFY_PROC, contrast_notify_proc, 0); window_set(panel, PANEL_ITEM_X_GAP, 10, 0); nodetext = panel_create_item(panel, PANEL_MESSAGE, PANEL_ITEM_X, ATTR_COL(50), PANEL_ITEM_Y, ATTR_ROW(9), PANEL_LABEL_STRING, "Current node ", 0); pathtext = panel_create_item(panel, PANEL_MESSAGE, PANEL_ITEM_X, ATTR_COL(5), PANEL_ITEM_Y, ATTR_ROW(9), PANEL_LABEL_STRING, " ", 0); msgtext = panel_create_item(panel, PANEL_MESSAGE, PANEL_ITEM_X, ATTR_COL(60), PANEL_ITEM_Y, ATTR_ROW(1), PANEL_LABEL_STRING, "No active file", 0); directiontext = panel_create_item(panel, PANEL_MESSAGE, PANEL_ITEM_X, ATTR_COL(60), PANEL_ITEM_Y, ATTR_ROW(2), PANEL_LABEL_STRING, "Direction : forward", 0); canvas = window_create(frame,CANVAS, CANVAS_WIDTH, 1000, CANVAS_HEIGHT, 1000, WIN_PERCENT_HEIGHT, 70, CANVAS_AUTO_SHRINK, FALSE, WIN_VERTICAL_SCROLLBAR, scrollbar_create(0), WIN_HORIZONTAL_SCROLLBAR, scrollbar_create(0), WIN_EVENT_PROC, handle_event, 0); histogram_canvas = window_create(histogram_frame, CANVAS, CANVAS_WIDTH, 1000, CANVAS_HEIGHT, 400, CANVAS_AUTO_SHRINK, FALSE, WIN_VERTICAL_SCROLLBAR, v_bar=scrollbar_create(0), WIN_HORIZONTAL_SCROLLBAR, h_bar=scrollbar_create(0), 0); processor_canvas = window_create(processor_frame, CANVAS, CANVAS_AUTO_SHRINK, FALSE, 0); legend_canvas = window_create(legend_frame, CANVAS, CANVAS_AUTO_SHRINK, FALSE, 0); pw = canvas_pixwin(canvas); pw2 = canvas_pixwin(histogram_canvas); pw_processor = canvas_pixwin(processor_canvas); pw_legend = canvas_pixwin(legend_canvas); } End of window_init.c echo xxxyyy 1>&2 cat >xxxyyy <<'End of xxxyyy' #include "sched.trace.h" #include "sundecs.h" window_init() { struct pixfont *title_font; title = panel_create_item(panel, PANEL_MESSAGE, PANEL_ITEM_X, ATTR_COL(23), PANEL_ITEM_Y, ATTR_ROW(0), PANEL_LABEL_STRING, "Argonne Schedule Tracing Facility", PANEL_LABEL_FONT, title_font, 0); directory_choice = panel_create_item(panel, PANEL_CHOICE, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(1), PANEL_LABEL_STRING, "Directory: ", PANEL_DISPLAY_LEVEL, PANEL_NONE, PANEL_NOTIFY_PROC, directory_notify_proc, 0); file_choice = panel_create_item(panel, PANEL_CHOICE, PANEL_ITEM_X, ATTR_COL(1), PANEL_ITEM_Y, ATTR_ROW(2), PANEL_LABEL_STRING, "Trace file: ", PANEL_DISPLAY_LEVEL, PANEL_NONE, PANEL_NOTIFY_PROC, file_notify_proc, 0); } load_tables() { load_directory_table(); load_file_table("."); } load_directory_table() { extern void directory_notify_proc(); struct direct *d; DIR *dp; int i; struct stat stbuf; static char current_dir[150]; if ((dp = opendir(".")) == NULL) { printf("Cannot open directory .\n"); exit(); } i = 0; while (directory_table[i] != NULL) free(directory_table[i++]); i = 0; while ((d = readdir(dp)) != NULL && i < 127) { if (stat(d->d_name,&stbuf) == -1) { printf("Stat failed on %s.\n",d->d_name); exit(); } if ((stbuf.st_mode & S_IFMT) == S_IFDIR) { directory_table[i] = (char *) malloc(d->d_namlen+1); if (directory_table[i] == NULL) { printf("No memory for directory.\n"); exit(); } strcpy(directory_table[i++],d->d_name); } } closedir(dp); if (i == 127) printf("Too many directory entries.\n"); directory_table[i] = NULL; panel_set(directory_choice, PANEL_CHOICE_STRINGS, "", 0, 0); for (i = 0; directory_table[i] != NULL; i++) panel_set(directory_choice, PANEL_CHOICE_STRING, i, directory_table[i], 0); panel_set(directory_choice, PANEL_CHOICE_STRING, i, "Enter new directory.", 0); /* enter_new_directory = i; */ strcpy(current_dir,"Directory: "); getwd(current_dir + 11); panel_set(directory_choice, PANEL_LABEL_STRING, current_dir, 0); } load_file_table(s) char *s; { extern void file_notify_proc(); struct direct *d; static char current_file[150]; DIR *dp; int i; if ((dp = opendir(s)) == NULL) { printf("Cannot open directory.\n"); exit(); } i = 0; while (file_table[i] != NULL) free(file_table[i++]); i = 0; while ((d = readdir(dp)) != NULL && i < 127) { if (d->d_namlen > 4 && d->d_name[0] == 't' && d->d_name[1] == 'r' && d->d_name[2] == 'a' && d->d_name[3] == 'c' && d->d_name[4] == 'e') { file_table[i] = (char *) malloc(d->d_namlen+1); if (file_table[i] == NULL) { printf("No memory for directory.\n"); exit(); } strcpy(file_table[i++], d->d_name); } } closedir(dp); if (i == 127) printf("Too many file entries.\n"); file_table[i] = NULL; panel_set(file_choice,PANEL_CHOICE_STRINGS, "", 0, 0); for (i = 0; file_table[i] != NULL; i++) panel_set(file_choice, PANEL_CHOICE_STRING, i, file_table[i], 0); ft_index = 0; strcpy(current_file, "Trace file: "); strcpy(current_file + 12, file_table[ft_index]); panel_set(file_choice,PANEL_LABEL_STRING, current_file, 0); } void load_notify_proc(item,event) Panel_item item; Event *event; { open_tracefile(file_table[ft_index]); } void file_notify_proc(item,value,event) Panel_item item; int value; Event *event; { static char current_file[150]; ft_index = value; strcpy(current_file, "Trace file: "); strcpy(current_file + 12, file_table[ft_index]); panel_set(file_choice,PANEL_LABEL_STRING, current_file, 0); } void directory_notify_proc(item,value,event) Panel_item item; int value; Event *event; { /* if (value < enter_new_directory) { chdir(directory_table[value]); load_tables(); } else { Frame popup_frame; popup_frame = window_create(frame, FRAME, WIN_ROWS, 1, WIN_COLUMNS, 80, 0); window_fit(popup_frame); popup_panel = window_create(popup_frame, PANEL, 0); panel_text = panel_create_item(popup_panel, PANEL_TEXT, PANEL_LABEL_STRING, "New directory: ", 0); panel_button = panel_create_item(popup_frame, PANEL_BUTTON, PANEL_LABEL_IMAGE, panel_button_image(popup_panel, "Ready", 0, NULL); PANEL_NOTIFY_PROC, ready_notify_proc, 0); window_set(popup_frame, WIN_SHOW, TRUE, 0); } if (chdir(directory_table[value]) == -1) printf("chdir failed with error number %d\n", errno); else */ } End of xxxyyy .