Exemplo n.º 1
0
int main (int argc, char** argv){
    setTraceType (PAJE);
    initTrace ("gtg_color", 0, GTG_FLAG_NONE);
    addContType ("CT_NET", "0", "Network");
    addContType ("CT_NODE", "CT_NET", "Node");
    addContType ("CT_PROC", "CT_NODE", "Proc");
    addStateType ("ST_NodeState", "CT_NODE", "Node state");
    addStateType ("ST_ProcState", "CT_PROC", "Procstate");

    addEntityValue ("SN_0", "ST_NodeState", "black", GTG_BLACK);
    addEntityValue ("SN_1", "ST_NodeState", "red", GTG_RED);
    addEntityValue ("SN_2", "ST_NodeState", "green", GTG_GREEN);
    addEntityValue ("SN_3", "ST_NodeState", "blue", GTG_BLUE);
    addEntityValue ("SN_4", "ST_NodeState", "white", GTG_WHITE);
    addEntityValue ("SN_5", "ST_NodeState", "teal", GTG_TEAL);
    addEntityValue ("SN_6", "ST_NodeState", "darkgrey", GTG_DARKGREY);
    addEntityValue ("SN_7", "ST_NodeState", "yellow", GTG_YELLOW);
    addEntityValue ("SN_8", "ST_NodeState", "purple", GTG_PURPLE);
    addEntityValue ("SN_9", "ST_NodeState", "lightbrown", GTG_LIGHTBROWN);
    addEntityValue ("SN_10", "ST_NodeState", "lightgrey", GTG_LIGHTGREY);
    addEntityValue ("SN_11", "ST_NodeState", "darkblue", GTG_DARKBLUE);
    addEntityValue ("SN_12", "ST_NodeState", "pink", GTG_PINK);
    addEntityValue ("SN_13", "ST_NodeState", "darkpink", GTG_DARKPINK);
    addEntityValue ("SN_14", "ST_NodeState", "seablue", GTG_SEABLUE);
    addEntityValue ("SN_15", "ST_NodeState", "kaki", GTG_KAKI);
    addEntityValue ("SN_16", "ST_NodeState", "redblood", GTG_REDBLOOD);
    addEntityValue ("SN_17", "ST_NodeState", "brown", GTG_BROWN);
    addEntityValue ("SN_18", "ST_NodeState", "grenat", GTG_GRENAT);
    addEntityValue ("SN_19", "ST_NodeState", "orange", GTG_ORANGE);
    addEntityValue ("SN_20", "ST_NodeState", "mauve", GTG_MAUVE);
    addEntityValue ("SN_21", "ST_NodeState", "lightpink", GTG_LIGHTPINK);

    addContainer (0.00000, "C_Net0", "CT_NET", "0", "Ensemble0", "0");
    addContainer (0.00000, "C_N0", "CT_NODE", "C_Net0", "Node0", "0");


    addContainer (0.00000, "C_P0", "CT_PROC", "C_N0", "Proc0", "0");

    int i;
    for(i=0; i<21;i++) {
	    char* nodeState = NULL;
	    asprintf(&nodeState, "SN_%d", i);
	    setState ((float)i, "ST_NodeState", "C_P0", nodeState);
    }

    endTrace ();
    return EXIT_SUCCESS;
}
Exemplo n.º 2
0
/*
 * This program should be used to parse the log file generated by FxT
 */
int
main (int argc, char **argv)
{
  int ret;
  int fd_in;

  load_modules(1);

  setTraceType (PAJE);

  /* parse the arguments passed to this program */
  parse_args (argc, argv);

#ifdef GTG_OUT_OF_ORDER
  ret = initTrace(output_filename, 0, GTG_FLAG_OUTOFORDER);
#else
  ret = initTrace(output_filename, 0, GTG_FLAG_NONE);
#endif
  if(ret != TRACE_SUCCESS) {
    fprintf(stderr, "fail to initialize GTG\n");
    return 1;
  }

  if(compress)
    if(setCompress(9) != TRACE_SUCCESS)
      fprintf(stderr, "Fail to enable trace compression\n");

  eztrace_initialize_gtg();

  __init_modules();


  int i;
  /* initialize the traces array */
  for(i=0;i< NB_TRACES; i++) {
    /* open the trace file */
    fxt_t fut = fxt_open (get_traces(i)->input_filename);
    if (!fut)
      {
	perror ("fxt_open:");
	exit (-1);
      }

    get_traces(i)->delay = 0;
    get_traces(i)->rank = i;
    get_traces(i)->id = i;
    get_traces(i)->done = 0;
    get_traces(i)->skip = 0;
    get_traces(i)->line_number = 0;

    eztrace_create_containers(i);

    /* if several traces are loaded, this means that MPI was used,
     * so let's skip all the first events until MPI_Init is detected
     */
    if(NB_TRACES > 1) {
      get_traces(i)->start = 0;
      get_traces(i)->trace_id = NULL;
    } else {
      CREATE_TRACE_ID_STR(get_traces(i)->trace_id, 0);
      get_traces(i)->start = 1;
      NB_START= 1;
      addContainer (0.00000, get_traces(i)->trace_id, "CT_Process", "C_Prog", get_traces(i)->trace_id, "0");
      eztrace_create_ids(get_traces(i)->rank);
    }

    get_traces(i)->block = fxt_blockev_enter (fut);

    ret = fxt_next_ev (get_traces(i)->block, FXT_EV_TYPE_64, (struct fxt_ev *) &get_traces(i)->ev);
    if (ret != FXT_EV_OK)
      {
	fprintf (stderr, "no more block ...\n");
	break;
      }

    get_traces(i)->start_time = get_traces(i)->ev.time;
  }

  /* todo: 0 or i ? */
  set_cur_trace(get_traces(0));
  set_cur_ev(&get_traces(i)->ev);

  struct eztrace_event_handler* h_info = NULL;
  h_info = get_handler_info();

  h_info->cur_trace_nb = 0;
  h_info->nb_done = 0;
  h_info->nb_handled = 0;
  sem_init(&h_info->events_processed, 0, 0);

  /* create the handler thread and wait until it completes */
  create_main_thread();
  wake_up_handler_thread();
  sem_wait(&h_info->events_processed);

  /* finalize the trace and close the file */
  endTrace ();
  eztrace_convert_finalize();
  printf("%d events handled\n", h_info->nb_handled);
  return 0;
}
int main (int argc, char** argv){
    int rk;
    MPI_Init (&argc, &argv);
    MPI_Comm_rank (MPI_COMM_WORLD, &rk);

    setTraceType (VITE, BUFF);
    setComm (MPI_COMM_WORLD);
    initTrace ("cvite");
    if (rk==0){
        addContType ("CT_NET", "0", "Network");
        addContType ("CT_NODE", "CT_NET", "Node");
        addContType ("CT_PROC", "CT_NODE", "Proc");
        addStateType ("ST_NodeState", "CT_NODE", "Node state");
        addStateType ("ST_ProcState", "CT_PROC", "Procstate");
        addEntityValue ("SN_0", "ST_NodeState", "Sleep", "0.5 0.5 0.5");
        addEntityValue ("SN_1", "ST_NodeState", "WaitLocal", "0.0 0.5 0.9");
        addEntityValue ("SN_2", "ST_NodeState", "WaitDistant", "0.9 0.5 0.0");
        addEntityValue ("SP_3", "ST_ProcState", "Produit", "0.5 0.9 0.0");
        addEntityValue ("SP_4", "ST_ProcState", "Somme", "0.9 0.9 0.0");
        addEntityValue ("SP_5", "ST_ProcState", "Difference", "0.1 0.5 0.4");
        addLinkType ("L_0", "Fanin", "CT_NET", "CT_PROC", "CT_PROC");
        addLinkType ("L_1", "Bloc", "CT_NET", "CT_PROC", "CT_PROC");
        addVarType ("V_Mem", "Memoire", "CT_NODE");
        addEventType ("E_0", "CT_PROC", "Lapin");
        addEventType ("E_1", "CT_PROC", "Chocolat");
    
        addContainer (0.00000, "C_Net0", "CT_NET", "0", "Ensemble0", "0");
        addContainer (0.00000, "C_N0", "CT_NODE", "C_Net0", "Node0", "0");
        addContainer (0.00000, "C_N1", "CT_NODE", "C_Net0", "Node1", "0");
        addContainer (0.00000, "C_P0", "CT_PROC", "C_N0", "Proc0", "cvite_proc0");
        addContainer (0.00000, "C_P1", "CT_PROC", "C_N0", "Proc1", "cvite_proc1");
        addContainer (0.00000, "C_P2", "CT_PROC", "C_N0", "Proc2", "cvite_proc2");

        addContainer (0.00000, "C_P3", "CT_PROC", "C_N1", "Proc3", "cvite_proc3");
        addContainer (0.00000, "C_P4", "CT_PROC", "C_N1", "Proc4", "cvite_proc4");
        addContainer (0.00000, "C_P5", "CT_PROC", "C_N1", "Proc5", "cvite_proc5");
    }
    setVar (0.0111742, "V_Mem", "C_N0", 1.0000000);
    setState (0.01120000, "ST_NodeState", "C_N1", "SN_1");
    setState (0.02121000, "ST_NodeState", "C_N0", "SN_0");
    setVar (0.0212742, "V_Mem", "C_N0", 2.0000000);
    setState (0.03122000, "ST_NodeState", "C_N1", "SN_2");
    setState (0.04123000, "ST_NodeState", "C_N0", "SN_1");
    setVar (0.0313742, "V_Mem", "C_N0", 3.0000000);
    setVar (0.0414742, "V_Mem", "C_N1", 1.0000000);
    setState (0.05124000, "ST_NodeState", "C_N1", "SN_0");
    setVar (0.0515742, "V_Mem", "C_N1", 2.0000000);
    setState (0.06124500, "ST_NodeState", "C_N0", "SN_2");
    setVar (0.0616742, "V_Mem", "C_N1", 3.0000000);
    switch (rk){
    case 0:
    setState (0.00130000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.00150000, "ST_ProcState", "C_P0", "SP_5");
    setState (0.00230000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.00330000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.00830000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.03130000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.05130000, "ST_ProcState", "C_P0", "SP_4");
    setState (0.09130000, "ST_ProcState", "C_P0", "SP_3");
    startLink (0.040000, "L_0", "C_Net0", "C_P0", "C_P5", "14", "2");
    endLink (0.050000, "L_0", "C_Net0", "C_P0", "C_P5", "14", "2");
    addEvent (0.030000, "E_0", "C_P0", "11");
    break;
    case 1 :
    setState (0.00140000, "ST_ProcState", "C_P1", "SP_3");
    setState (0.00210000, "ST_ProcState", "C_P1", "SP_4");
    setState (0.00930000, "ST_ProcState", "C_P1", "SP_3");
    setState (0.01030000, "ST_ProcState", "C_P1", "SP_4");
    addEvent (0.070000, "E_1", "C_P1", "1");
    break;
    case 3 :
    setState (0.00160000, "ST_ProcState", "C_P3", "SP_5");
    setState (0.00200000, "ST_ProcState", "C_P3", "SP_4");
    setState (0.00630000, "ST_ProcState", "C_P3", "SP_5");
    setState (0.04130000, "ST_ProcState", "C_P3", "SP_3");
    startLink (0.050000, "L_1", "C_Net0", "C_P3", "C_P1", "15", "3");
    endLink (0.060000, "L_1", "C_Net0", "C_P3", "C_P1", "15", "3");
    break;
    case 4 :
    setState (0.00170000, "ST_ProcState", "C_P4", "SP_3");
    setState (0.00530000, "ST_ProcState", "C_P4", "SP_5");
    setState (0.07130000, "ST_ProcState", "C_P4", "SP_5");
    startLink (0.030000, "L_1", "C_Net0", "C_P4", "C_P2", "13", "1");
    endLink (0.030000, "L_0", "C_Net0", "C_P2", "C_P4", "12", "0");
    break;
    case 5 :
    setState (0.00180000, "ST_ProcState", "C_P5", "SP_4");
    setState (0.00430000, "ST_ProcState", "C_P5", "SP_4");
    setState (0.06130000, "ST_ProcState", "C_P5", "SP_5");
    addEvent (0.090000, "E_1", "C_P5", "3");
    break;
    case 2 :
    setState (0.00190000, "ST_ProcState", "C_P2", "SP_3");
    setState (0.00730000, "ST_ProcState", "C_P2", "SP_5");
    setState (0.02130000, "ST_ProcState", "C_P2", "SP_4");
    setState (0.08130000, "ST_ProcState", "C_P2", "SP_4");
    startLink (0.020000, "L_0", "C_Net0", "C_P2", "C_P4", "12", "0");
    endLink (0.040000, "L_1", "C_Net0", "C_P4", "C_P2", "13", "1");
    addEvent (0.050000, "E_0", "C_P2", "10");
    break;

    default :
        break;
    }
    endTrace ();
    MPI_Finalize ();
    return EXIT_SUCCESS;
}
void
endTrace_i (int *err)
{
  *err = endTrace ();
}
Exemplo n.º 5
0
int main (int argc, char** argv){
(void) argc;
(void) argv;
    setTraceType (PAJE);
    initTrace ("cpaje", 0, GTG_FLAG_NONE);
    addContType ("CT_NET", "0", "Network");
    addContType ("CT_NODE", "CT_NET", "Node");
    addContType ("CT_PROC", "CT_NODE", "Proc");
    addStateType ("ST_NodeState", "CT_NODE", "Node state");
    addStateType ("ST_ProcState", "CT_PROC", "Procstate");
    addEntityValue ("SN_0", "ST_NodeState", "Sleep", GTG_LIGHTPINK);
    addEntityValue ("SN_1", "ST_NodeState", "WaitLocal", GTG_PINK);
    addEntityValue ("SN_2", "ST_NodeState", "WaitDistant", GTG_BLUE);
    addEntityValue ("SP_3", "ST_ProcState", "Produit", GTG_ORANGE);
    addEntityValue ("SP_4", "ST_ProcState", "Somme", GTG_GREEN);
    addEntityValue ("SP_5", "ST_ProcState", "Difference", GTG_BLACK);
    addLinkType ("L_0", "Fanin", "CT_NET", "CT_PROC", "CT_PROC");
    addLinkType ("L_1", "Bloc", "CT_NET", "CT_PROC", "CT_PROC");
    addVarType ("V_Mem", "Memoire", "CT_NODE");
    addEventType ("E_0", "CT_PROC", "Lapin");
    addEventType ("E_1", "CT_PROC", "Chocolat");
    addContainer (0.00000, "C_Net0", "CT_NET", "0", "Ensemble0", "0");
    addContainer (0.00000, "C_N0", "CT_NODE", "C_Net0", "Node0", "0");
    addContainer (0.00000, "C_P0", "CT_PROC", "C_N0", "Proc0", "0");
    addContainer (0.00000, "C_P1", "CT_PROC", "C_N0", "Proc1", "0");
    addContainer (0.00000, "C_P2", "CT_PROC", "C_N0", "Proc2", "0");
    addContainer (0.00000, "C_N1", "CT_NODE", "C_Net0", "Node1", "0");
    addContainer (0.00000, "C_P3", "CT_PROC", "C_N1", "Proc3", "0");
    addContainer (0.00000, "C_P4", "CT_PROC", "C_N1", "Proc4", "0");
    addContainer (0.00000, "C_P5", "CT_PROC", "C_N1", "Proc5", "0");
    setVar (0.0111742, "V_Mem", "C_N0", 1.0000000);
    setState (0.01120000, "ST_NodeState", "C_N1", "SN_1");
    setState (0.02121000, "ST_NodeState", "C_N0", "SN_0");
    setVar (0.0212742, "V_Mem", "C_N0", 2.0000000);
    setState (0.03122000, "ST_NodeState", "C_N1", "SN_2");
    setState (0.04123000, "ST_NodeState", "C_N0", "SN_1");
    setVar (0.0313742, "V_Mem", "C_N0", 3.0000000);
    setVar (0.0414742, "V_Mem", "C_N1", 1.0000000);
    setState (0.05124000, "ST_NodeState", "C_N1", "SN_0");
    setVar (0.0515742, "V_Mem", "C_N1", 2.0000000);
    setState (0.06124500, "ST_NodeState", "C_N0", "SN_2");
    setVar (0.0616742, "V_Mem", "C_N1", 3.0000000);
    setState (0.00130000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.00140000, "ST_ProcState", "C_P1", "SP_3");
    setState (0.00150000, "ST_ProcState", "C_P0", "SP_5");
    setState (0.00160000, "ST_ProcState", "C_P3", "SP_5");
    setState (0.00170000, "ST_ProcState", "C_P4", "SP_3");
    setState (0.00180000, "ST_ProcState", "C_P5", "SP_4");
    setState (0.00190000, "ST_ProcState", "C_P2", "SP_3");
    setState (0.00200000, "ST_ProcState", "C_P3", "SP_4");
    setState (0.00210000, "ST_ProcState", "C_P1", "SP_4");
    setState (0.00230000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.00330000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.00430000, "ST_ProcState", "C_P5", "SP_4");
    setState (0.00530000, "ST_ProcState", "C_P4", "SP_5");
    setState (0.00630000, "ST_ProcState", "C_P3", "SP_5");
    setState (0.00730000, "ST_ProcState", "C_P2", "SP_5");
    setState (0.00830000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.00930000, "ST_ProcState", "C_P1", "SP_3");
    setState (0.01030000, "ST_ProcState", "C_P1", "SP_4");
    setState (0.02130000, "ST_ProcState", "C_P2", "SP_4");
    setState (0.03130000, "ST_ProcState", "C_P0", "SP_3");
    setState (0.04130000, "ST_ProcState", "C_P3", "SP_3");
    setState (0.05130000, "ST_ProcState", "C_P0", "SP_4");
    setState (0.06130000, "ST_ProcState", "C_P5", "SP_5");
    setState (0.07130000, "ST_ProcState", "C_P4", "SP_2");
    setState (0.08130000, "ST_ProcState", "C_P2", "SP_4");
    setState (0.09130000, "ST_ProcState", "C_P0", "SP_3");
    startLink (0.020000, "L_0", "C_Net0", "C_P2", "C_P4", "12", "0");
    startLink (0.030000, "L_1", "C_Net0", "C_P4", "C_P2", "13", "1");
    startLink (0.040000, "L_0", "C_Net0", "C_P0", "C_P5", "14", "2");
    startLink (0.050000, "L_1", "C_Net0", "C_P3", "C_P1", "15", "3");
    endLink (0.030000, "L_0", "C_Net0", "C_P2", "C_P4", "12", "0");
    endLink (0.040000, "L_1", "C_Net0", "C_P4", "C_P2", "13", "1");
    endLink (0.050000, "L_0", "C_Net0", "C_P0", "C_P5", "14", "2");
    endLink (0.060000, "L_1", "C_Net0", "C_P3", "C_P1", "15", "3");
    addEvent (0.030000, "E_0", "C_P0", "11");
    addEvent (0.050000, "E_0", "C_P2", "10");
    addEvent (0.070000, "E_1", "C_P1", "1");
    addEvent (0.090000, "E_1", "C_P5", "3");
    endTrace ();
    return EXIT_SUCCESS;
}
Exemplo n.º 6
0
bool start_ndfsm(int argc, char** argv, ndfsm* test)
{
NDFSM_TestEngineData ndfsm_state;
bool tracing_was_started_here = false;
bool was_accidental_transition_traced;
AssertionExit prev_assert = NULL;
TestSystemParameters* pars;
bool verdict;
bool verdict_init;

  // Initialize test engine data
  init_NDFSM_TestEngineData( &ndfsm_state, test );

  // Process standard parameters
  pars = processStandardParameters(test->name,test->actions,argc,argv);
  assertion( pars != NULL, "start_ndfsm: standard parameters processing fails");

  // Start tracing if it has not been started yet
  if (!isInTrace())
   {
    tracing_was_started_here = true;
    prev_assert = ts_setup_assert_function();
    startTrace();
   }

  START_EXCEPTION_PROTECTED_SECTION(ts_default_exception_handler);

  setCurrentTestScenarioName(test->name);
  traceScenarioStart(test->name);
  traceScenarioParameters(pars->argc,pars->argv);

  // Scenario initialization
  verdict = true;
  if (test->init != NULL)
   {
    // Trace pseudo transition start
    was_accidental_transition_traced = setTraceAccidental(true);
    traceState("start");
    traceScenarioValue ("state", "", "", "start");
    traceTransitionStart("initialize");
    traceScenarioValue ("scenario method", "", "", "initialize");

    // Call 'init' function
    clearOracleVerdict();
    verdict_init = test->init(pars->argc, pars->argv);
    verdict = verdict_init && getOracleVerdict();

    // Frame end
    verdict = onFrameEnd( &ndfsm_state.executor.model_state, verdict );

    // Trace initialization failed message
    if (!verdict_init)
     {
      traceException(SCENARIO_INITIALIZATION_FAILED_MESSAGE);
      testVerdict = TD_faulted;
     }

    // Trace pseudo transition end
    traceTransitionEnd();
    setTraceAccidental(was_accidental_transition_traced);
   }

  // FSM traversing
  if (verdict)
   {if (check_consistency_NDFSM(test))
     {
      traceProperties_NDFSM( &ndfsm_state );
      traverse_NDFSM( &ndfsm_state );
      // Evaluate historical test verdict
      if (ndfsm_state.fatal_failure)
       {
        verdict = false;
        testVerdict = TD_faulted;
       }
      else if (ndfsm_state.failure_number > 0)
       {
        verdict = false;
        testVerdict = TD_bad_verdict;
       }
      else
        testVerdict = TD_ok;
     }
    if (test->finish != NULL)
     {
      // Trace pseudo transition start
      was_accidental_transition_traced = setTraceAccidental(true);
      traceTransitionStart("finalize");
      traceScenarioValue ("scenario method", "", "", "finalize");

      // Call 'finish' function
      clearOracleVerdict();
      test->finish();
      verdict = verdict && getOracleVerdict();

      // Frame end
      verdict = onFrameEnd( &ndfsm_state.executor.model_state, verdict );

      // Trace pseudo transition end
      traceTransitionEnd();
      traceState("end");
      traceScenarioValue ("state", "", "", "end");
      setTraceAccidental(was_accidental_transition_traced);
     }
   }

  traceScenarioEnd();
  setCurrentTestScenarioName(NULL);

  // Deallocate resources
  destroy_NDFSM_TestEngineData( &ndfsm_state );

  END_EXCEPTION_PROTECTED_SECTION();

  // Stop tracing if it was started here
  if (tracing_was_started_here)
   {
    endTrace();
    ts_restore_assert_function(prev_assert);
   }

  // Disable standard parameters
  disableStandardParameters(pars);

  return verdict;
}