//================================================================
bool HistMuCapUncontainedChannel::accepted(const EventClass& evt,
                                           bool referenceSampleAccepted,
                                           int iPosTrack,
                                           int iNegTrack)

{
  CutNumber c = analyzeEvent(evt, referenceSampleAccepted, iPosTrack, iNegTrack);
  h_cuts_r->Fill(c);
  for(int cut=0; cut<=c; cut++) {
    h_cuts_p->Fill(cut);
  }
  return c == CUTS_ACCEPTED;
}
void PerformanceAnalyser::analyzeProgramEvent(cl_command_queue* queue, cl_event &event, const std::string &program_name) {
    if (!m_gatherAnalytics) {
        return;
    }

    clFinish(*queue);
    TimelineEntry time = analyzeEvent(event);
    ProgramTimelineEntry prog_entry;
    prog_entry.program_name = program_name;

    m_programEvents.push_back(prog_entry);
    time.type = PROGRAM;
    time.index = m_programEvents.size()-1;
    m_timeline.push_back(time);
}
void PerformanceAnalyser::analyzeMemoryEvent(cl_command_queue* queue, cl_event &event, const size_t &size, PerformanceAnalyser::MemoryEvent const &mem_event) {
    if (!m_gatherAnalytics) {
        return;
    }

    clFinish(*queue);
    TimelineEntry time = analyzeEvent(event);
    MemoryTimelineEntry mem_entry;
    mem_entry.type = mem_event;
    mem_entry.bytes = size;
    mem_entry.transfere_rate = ((double)mem_entry.bytes/1073741824.0)/time.execution_time;

    m_memoryEvents.push_back(mem_entry);
    time.type = MEMORY;
    time.index = m_memoryEvents.size()-1;
    m_timeline.push_back(time);
}
示例#4
0
//====================================
void runMode(int stop)
//====================================
{
  int ch,x,step,tmp,res=0,a=0,b=0,ir,ok=0,n=0;
  char tempName[80],syscom[120],temp[80];
  char command[40][40];

  strcpy(tempName,"help.txt");

  s_mode = S_RUN;


  if(stop > 1)
    {
      if(stop > g_steps)stop = g_steps;
      //if(stop > currentStep)
	runAll(stop);
      return;
    }

  putMsg(3,"Run Mode. Press h for help.");

  while(1)  
    {
      anyErrors();
      if(g_silent==S_NO )mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode);
      if(g_silent==S_YES)mvwprintw(uno,board_h-2,1,"R%1d<",confWinMode);
      unoInfo();

      if(g_debug == 1) 
	readFile(confSketchFile,g_lineSketch[currentStep]);


      ch = getchar();

      if (ch=='q')
	{
	  return;
	}

      if (ch=='h')
        {
          readMsg(fileInfoRun);
        }
      else if (ch=='c')
        {
          readMsg(currentConf);
        }
      else if (ch=='d')
        {
          readMsg(fileServTime);
        }
      else if(ch=='y' ) // scenario
	{
	  readMsg(fileServScen);
	}
      else if (ch=='x')
	{
	  readMsg(fileServScenario);
	}
      else if (ch=='G')
	{
	  runAll(g_steps);
	}
      else if (ch=='l')
	{
	  showLoops();
	}
      else if (ch=='s')
	{
	  g_debug++;
	  if(g_debug > 1)g_debug = 0;
	}
      else if (ch=='w')
	{
	  confWinMode++;
	  if(confWinMode > WIN_MODES)confWinMode = 0;
          init(confWinMode);
	  mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode);
	  unoInfo();
	}
      else if (ch=='a')
	{
          goStep(1);
	}
      else if (ch=='r')
	{
          goStep(loopStep[currentLoop+1]);
	}
      else if (ch=='o')
	{
          goStep(loopStep[currentLoop]);
	}
      else if (ch=='p')
	{
          goStep(loopStep[currentLoop-1]);
	}
      else if (ch=='z')
	{
          goStep(g_steps);
	}
      else if (ch=='k')
	{
	  resetSim();
	  init(confWinMode);
	  unoInfo();
	  mvwprintw(uno,board_h-2,1,"R%1d>",confWinMode);
	  show(uno);
	}
      else if (ch=='f')// Up Arrow 
	{
	  goStep(currentStep+1);
	}
      else if (ch=='b')// Down Arrow
	{
	  goStep(currentStep-1);
	}
      else if (ch=='R') // Right Arrow
	{
	  runLoop(S_FORWARD);
	}
      else if (ch=='P') // Left Arrow
	{
	  runLoop(S_BACKWARD);
	}
      else if (ch=='t')
	{
	  runNextRead();
	}
      else if (ch=='j')
	{
	  runPrevRead();
	}
      else if (ch=='i') 
	{
          step = currentStep;
	  sprintf(temp,"(Step:%d) Enter: d/a pin value (q - cancel)",step);
          putMsg(2,temp);
	  wgetstr(uno,temp);
	  n = tokCommand(command,temp);
      
	  if(strstr(command[0],"q") == NULL && n == 3)
	    {
	      g_pinNo = atoi(command[1]);
	      x = atoi(command[2]);
	      printf("%s %d %d",command[0],g_pinNo,x);
	      if(strstr(command[0],"a"))
		{
		  ok = ok + checkRange(S_OK,"anapin",g_pinNo);
		  ok = ok + checkRange(S_OK,"anaval",x);
		  g_pinType = ANA;
		}
	      if(strstr(command[0],"d"))
		{
		  ok = ok + checkRange(S_OK,"digpin",g_pinNo);
		  ok = ok + checkRange(S_OK,"digval",x);
		  g_pinType = DIG;
		}
	      if(ok == S_OK)
		{ 
		  g_scenSource = 1;
		  // steps, source, pintype, pinno, pinvalue, pinstep
		  sprintf(syscom,"cd servuino;./servuino %d %d %d %d %d %d %d;",confSteps,g_scenSource,g_pinType,g_pinNo,x,currentStep,S_ADD);
		  tmp=system(syscom);
		  initSim();
		  readSketchInfo();
		  readSimulation();
		  goStep(currentStep);
		  readMsg(fileServScen);
		}
	    }
	  else
	    putMsg(2,"Cancelled!");
	}
      else if (ch=='v') 
	{
          step = currentStep ;
	  sprintf(temp," Enter value to be read at step %d (q - cancel)",step);
          putMsg(2,temp);
	  res = analyzeEvent(simulation[step]);
          if(res > 0)
	    {
	      wgetstr(uno,temp);

	      if(strstr(temp,"q") == NULL)
		{
		  x = atoi(temp); 
		  ok = S_OK;
		  if(res == ANA)ok = ok + checkRange(S_OK,"anaval",x);
		  if(res == DIG)ok = ok + checkRange(S_OK,"digval",x);
		  if(ok == S_OK)
		    {         
		      g_scenSource = 1;
		      // steps, source, pintype, pinno, pinvalue, pinstep
		      sprintf(syscom,"cd servuino;./servuino %d %d %d %d %d %d %d;",confSteps,g_scenSource,g_pinType,g_pinNo,x,currentStep,S_ADD);
		      tmp=system(syscom);
		      initSim();
		      readSketchInfo();
		      readSimulation();
		      goStep(currentStep);
		      readMsg(fileServScen);
		    }
		}
	      else
		putMsg(2,"Cancelled!");
	    }
	  else
	    putMsg(2,"Next step is not a Read event");
	}
      else
	{
	  sprintf(temp,"Unknown command: %c",ch);
	  putMsg(msg_h-2,temp);
	}
    }
  return;
}