Exemplo n.º 1
0
int main (int argc, char **argv)
{
  //Vite-SVN requires a trace file with no extended events)
  //So:
  //first parameter set to 1 means basic header with no extended events
  //second parameter set to 0 means *new* header
  poti_header (1, 0);

  //Defining my types
  poti_DefineContainerType ("ROOT", "0", "ROOT");
  poti_DefineContainerType("THREAD", "ROOT", "THREAD");
  poti_DefineStateType("STATE", "THREAD", "STATE");
  poti_DefineLinkType("LINK", "ROOT", "THREAD", "THREAD", "LINK");

  //define values and color for the STATE type
  poti_DefineEntityValue("r", "STATE", "running", "0.0 1.0 0.0");
  poti_DefineEntityValue("i", "STATE", "idle", "0.3 0.3 0.3");

  //define values and color for the LINK type
  poti_DefineEntityValue("c", "LINK", "communication", "1 0 0");

  //Create my root container and containers for two threads
  poti_CreateContainer (0.01, "root", "ROOT", "0", "root");
  poti_CreateContainer (0.12, "thread-0", "THREAD", "root", "thread-0");
  poti_CreateContainer (0.23, "thread-1", "THREAD", "root", "thread-1");
  
  //Start a link from thread-0
  poti_StartLink (0.24, "root", "LINK", "thread-0", "c", "myKey-001");

  //Push and Pop two states for each thread
  poti_PushState (0.34, "thread-0", "STATE", "r");
  poti_PushState (0.45, "thread-1", "STATE", "r");
  poti_PopState  (0.56, "thread-0", "STATE");
  poti_PushState (0.67, "thread-0", "STATE", "i");
  poti_PopState  (0.78, "thread-1", "STATE");
  poti_PushState (0.89, "thread-1", "STATE", "i");
  poti_PopState  (0.90, "thread-0", "STATE");
  poti_PopState  (1.01, "thread-1", "STATE");

  //End the link at thread-1
  poti_EndLink (1.02, "root", "LINK", "thread-1", "c", "myKey-001");

  //Closing containers
  poti_DestroyContainer (1.12, "THREAD", "thread-0");
  poti_DestroyContainer (1.23, "THREAD", "thread-1");
  poti_DestroyContainer (1.34, "ROOT", "root");

  return 0;
}
Exemplo n.º 2
0
void create_poti_event (paje_line line)
{
  int identifier = atoi(line.word[0]); 
  PajeEventId eventId = getPajeEventId (identifier);
  switch (eventId) {
  case PajeDefineContainerTypeEventId:
    poti_DefineContainerType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			     line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			     line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDefineEventTypeEventId:
    poti_DefineEventType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDefineStateTypeEventId:
    poti_DefineStateType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDefineVariableTypeEventId:
    poti_DefineVariableType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			    line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			    line.word[getPajeFieldPosition(identifier,PAJE_Name)],
			    line.word[getPajeFieldPosition(identifier,PAJE_Color)]);
    break;
  case PajeDefineLinkTypeEventId:
    poti_DefineLinkType(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			line.word[getPajeFieldPosition(identifier,PAJE_StartContainerType)],
			line.word[getPajeFieldPosition(identifier,PAJE_EndContainerType)],
			line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDefineEntityValueEventId:
    poti_DefineEntityValue(line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			   line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			   line.word[getPajeFieldPosition(identifier,PAJE_Name)],
			   line.word[getPajeFieldPosition(identifier,PAJE_Color)]);
    break;
  case PajeCreateContainerEventId:
    poti_CreateContainer(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
			 line.word[getPajeFieldPosition(identifier,PAJE_Alias)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Container)],
			 line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeDestroyContainerEventId:
    poti_DestroyContainer(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
			  line.word[getPajeFieldPosition(identifier,PAJE_Type)],
			  line.word[getPajeFieldPosition(identifier,PAJE_Name)]);
    break;
  case PajeNewEventEventId:
    poti_NewEvent(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		  line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Value)]);
    break;
  case PajeSetStateEventId:
    poti_SetState(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		  line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Value)]);
    break;
  case PajePushStateEventId:
    poti_PushState(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		   line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Value)]);
    break;
  case PajePopStateEventId:
    poti_PopState(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		  line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		  line.word[getPajeFieldPosition(identifier,PAJE_Type)]);
    break;
  case PajeResetStateEventId:
    poti_ResetState(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		    line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		    line.word[getPajeFieldPosition(identifier,PAJE_Type)]);
    break;
  case PajeSetVariableEventId:
    poti_SetVariable(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		     line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		     line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		     strtod(line.word[getPajeFieldPosition(identifier,PAJE_Value)],NULL));
    break;
  case PajeAddVariableEventId:
    poti_AddVariable(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		     line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		     line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		     strtod(line.word[getPajeFieldPosition(identifier,PAJE_Value)],NULL));
    break;
  case PajeSubVariableEventId:
    poti_SubVariable(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		     line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		     line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		     strtod(line.word[getPajeFieldPosition(identifier,PAJE_Value)],NULL));
    break;
  case PajeStartLinkEventId:
    poti_StartLink(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		   line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		   line.word[getPajeFieldPosition(identifier,PAJE_StartContainer)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Value)],
		   line.word[getPajeFieldPosition(identifier,PAJE_Key)]);
    break;
  case PajeEndLinkEventId:
    poti_EndLink(strtod(line.word[getPajeFieldPosition(identifier,PAJE_Time)],NULL),
		 line.word[getPajeFieldPosition(identifier,PAJE_Container)],
		 line.word[getPajeFieldPosition(identifier,PAJE_Type)],
		 line.word[getPajeFieldPosition(identifier,PAJE_EndContainer)],
		 line.word[getPajeFieldPosition(identifier,PAJE_Value)],
		 line.word[getPajeFieldPosition(identifier,PAJE_Key)]);
    break;
  default:
    break;
  }
}