Ejemplo n.º 1
0
static void 
sig_heartbeat(int signum)
{
    send_heartbeat(signum);
    check_heartbeat(signum);
    alarm(NODE_HEARTBEAT_INTERVAL);
}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
  int ii;

    FILE *tr_file;
    char tr_filename[1024];
    char cmd_string[256];
    
    if(argc < 1) {
        die_message("Must Provide a Trace File"); 
    }

    //--------------------------------------------------------------------
    // -- Get params from command line 
    //--------------------------------------------------------------------    
    for ( ii = 1; ii < argc; ii++) {
	if (argv[ii][0] == '-') {	    
	    if (!strcmp(argv[ii], "-h") || !strcmp(argv[ii], "-help")) {
		die_usage();
	    }	    


	    else if (!strcmp(argv[ii], "-pipewidth")) {
		if (ii < argc - 1) {		  
		    PIPE_WIDTH = atoi(argv[ii+1]);
		    ii += 1;
		}
	    }

	      else if (!strcmp(argv[ii], "-schedpolicy")) {
		if (ii < argc - 1) {		  
		    SCHED_POLICY = atoi(argv[ii+1]);
		    ii += 1;
		}
	    }

	      else if (!strcmp(argv[ii], "-loadlatency")) {
		if (ii < argc - 1) {		  
		    LOAD_EXE_CYCLES = atoi(argv[ii+1]);
		    ii += 1;
		}
	    }


	}
	else {
	  strcpy(tr_filename, argv[ii]);
	}
    }

    
  // ------- Open Trace File -------------------------------------------
    sprintf(cmd_string,"gunzip -c %s", tr_filename);
    if ((tr_file = popen(cmd_string, "r")) == NULL){
        printf("Command string is %s\n", cmd_string);
        die_message("Unable to open the trace file with gzip option \n")  ;
    } else {
        printf("Opened file with command: %s \n", cmd_string);
    }
     
  // ------- Pipeline Initialization & Execution ----------------------

     pipeline = pipe_init(tr_file); 

     printf("\n%48s", "");
     
    while(!pipeline->halt) {
      pipe_cycle(pipeline);
      check_heartbeat();
    }

  // ------- Print Statistics------------------------------------------
    print_stats();
    fclose(tr_file);
    return 0;
}