Ejemplo n.º 1
0
double MergeAllParents::totalExecCost(std::pair<ParentsIterator,ParentsIterator> pair,
              VertexID parent)
{
  double cost=0.0;
  ContainSet allNodes;
  ParentsIterator p,p_end;

  for(tie(p,p_end) = pair; p != p_end; p++) {
    ContainSetMap::iterator set;
    if (*p != m_invartask && *p != m_outvartask) {
      set = m_containTasks->find(*p);
      if (set != m_containTasks->end()) {
  allNodes.make_union((*set).second);
      }
      allNodes.insert(getTaskID(*p,m_taskgraph));
    }
  }

  ContainSet::iterator it;
  for (it = allNodes.begin(); it !=allNodes.end(); it++) {
    cost +=getExecCost(find_task(*it,(TaskGraph*)m_taskgraph));
  }
  cost+= getExecCost(parent);
  return cost;
}
Ejemplo n.º 2
0
void Task::execute(void) {
	pid_t pid, wait_return;
	int wait_status;

	pid = fork();
	if (pid == -1) {
		perror("fork");
		exit(EXIT_FAILURE);
	}

	// forked task
	if (pid == 0) {

		printf( "executing time and rtspin " );
		char wcet[20];
		char period[20];
		char duration[20];
		sprintf(wcet,"%d",getExecCost());
		sprintf(period,"%d",getPeriod());
		sprintf(duration,"%d",getTestingDuration());
		
		execl( TIME_PATH, TIME_BIN,
		       "-f",
		       " \"%P\" ",
		       "-o",
		       // "cpuusagefile",
		       TS_CPU_U_F,
		       "-a",
		       RTSPIN_PATH, 
		       "-w",
		       wcet,
		       period,
		       duration,
		       (char *) NULL );

		// char wcet[20];
		// char period[20];
		// char cnt[20];
		// sprintf(wcet,"%d",10);
		// sprintf(period,"%d",100);
		// sprintf(cnt,"%d",1000);


		// execl( "./base_task","base_task",
		//        wcet,
		//        period,
		//        cnt,		       
		//        (char *) NULL );

		perror( "could not execute time or rtspin " );

		exit(EXIT_FAILURE);

	} else { 		// parent
		// Save child pid to wait for.
		setWaitReturn(pid);
	}

}
Ejemplo n.º 3
0
double Task::getUtilization() {
  return (double)((double)(getExecCost())
		  /(double)(getPeriod()));
}