Beispiel #1
0
const _PlanOperation *_PlanOperation::execute() {
  epoch_t startTime = get_epoch_nanoseconds();

  refreshInput();

  setupPlanOperation();

  PapiTracer pt;
  pt.addEvent("PAPI_TOT_CYC");
  pt.addEvent(getEvent());

  pt.start();
  executePlanOperation();
  pt.stop();

  teardownPlanOperation();

  epoch_t endTime = get_epoch_nanoseconds();
  std::string threadId = boost::lexical_cast<std::string>(std::this_thread::get_id());

  if (_performance_attr != nullptr)
    *_performance_attr = (performance_attributes_t) {
      pt.value("PAPI_TOT_CYC"), pt.value(getEvent()), getEvent() , planOperationName(), _operatorId, startTime, endTime, threadId
    };

  setState(OpSuccess);
  return this;
}
void drawLogs()
{
	int i=which_logfile, j, k, l, done=0;
	s_screen *Viewer = NULL;

	bothkeys = bothnewkeys = 0;
	Viewer = allocscreen(Source->width, Source->height, Source->pixelformat);
	clearscreen(Viewer);
	bothkeys = bothnewkeys = 0;

	while(!done)
	{
	    copyScreens(Viewer);
	    //inputrefresh();
	    refreshInput();
	    printText((isWide ? 410 : 250), 3, RED, 0, 0, "Quit : 1/B");
		if(buttonsPressed & (WIIMOTE_1|CC_B|GC_B)) done = 1;

		if(logfile[i].ready)
		{
			printText(5, 3, RED, 0, 0, "OpenBorLog.txt");
			if(buttonsHeld & DIR_UP) --logfile[i].line;
	        if(buttonsHeld & DIR_DOWN) ++logfile[i].line;
			if(buttonsHeld & DIR_LEFT) logfile[i].line = 0;
			if(buttonsHeld & DIR_RIGHT) logfile[i].line = logfile[i].rows - (LOG_SCREEN_END - LOG_SCREEN_TOP);
			if(logfile[i].line > logfile[i].rows - (LOG_SCREEN_END - LOG_SCREEN_TOP) - 1) logfile[i].line = logfile[i].rows - (LOG_SCREEN_END - LOG_SCREEN_TOP) - 1;
			if(logfile[i].line < 0) logfile[i].line = 0;
			for(l=LOG_SCREEN_TOP, j=logfile[i].line; j<logfile[i].rows-1; l++, j++)
			{
				if(l<LOG_SCREEN_END)
				{
					char textpad[480] = {""};
					for(k=0; k<480; k++)
					{
						if(!logfile[i].buf->ptr[logfile[i].pos[j]+k]) break;
						textpad[k] = logfile[i].buf->ptr[logfile[i].pos[j]+k];
					}
					if(logfile[i].rows>0xFFFF)
						printText(5, l*10, WHITE, 0, 0, "0x%08x:  %s", j, textpad);
					else
						printText(5, l*10, WHITE, 0, 0, "0x%04x:  %s", j, textpad);
				}
				else break;
			}
		}
		else if(i == SCRIPT_LOG) printText(5, 3, RED, 0, 0, "Log NOT Found: ScriptLog.txt");
		else                     printText(5, 3, RED, 0, 0, "Log NOT Found: OpenBorLog.txt");

	    drawScreens(NULL, 0, 0);
	}
	freescreen(&Viewer);
	Viewer = NULL;
	drawMenu();
}
Beispiel #3
0
NS_O_BEGIN

OWindow::OWindow(const char* title, uint width, uint height, OApplication *app)
    :m_Title(title), m_Width(width), m_Height(height), m_Closed(false), m_Application(app)
{

    if (!init()) {
        OErrLog("Window initialization failed !");
        return;
    }
    setVsync(true);

    refreshInput();
}
Beispiel #4
0
const PlanOperation* PlanOperation::execute() {
  const bool recordPerformance = _performance_attr != nullptr;

  // Check if we really need this
  epoch_t startTime = 0;
  if (recordPerformance)
    startTime = get_epoch_nanoseconds();

  PapiTracer pt;

  // Start the execution
  refreshInput();
  setupPlanOperation();

  if (recordPerformance) {
    pt.addEvent("PAPI_TOT_CYC");
    pt.addEvent(getEvent());
    pt.start();
  }

  executePlanOperation();

  if (recordPerformance)
    pt.stop();

  teardownPlanOperation();

  if (recordPerformance) {
    epoch_t endTime = get_epoch_nanoseconds();
    std::string threadId = boost::lexical_cast<std::string>(std::this_thread::get_id());

    size_t cardinality;
    if (getResultTable() != empty_result)
      cardinality = getResultTable()->size();
    else
      // the cardinality is max(size_t) by convention if there is no return table
      cardinality = std::numeric_limits<size_t>::max();

    *_performance_attr = (performance_attributes_t) {pt.value("PAPI_TOT_CYC"), pt.value(getEvent()), getEvent(),
                                                     planOperationName(),      _operatorId,          startTime,
                                                     endTime,                  threadId,             cardinality};
  }

  setState(OpSuccess);
  return this;
}
int ControlMenu()
{
	int status = -1;
	int dListMaxDisplay = 17;
	//bothnewkeys = 0;
	//inputrefresh();
	refreshInput();
	switch(buttonsPressed)
	{
		case DIR_UP:
			dListScrollPosition--;
			if(dListScrollPosition < 0)
			{
				dListScrollPosition = 0;
				dListCurrentPosition--;
			}
			if(dListCurrentPosition < 0) dListCurrentPosition = 0;
			break;

		case DIR_DOWN:
			dListCurrentPosition++;
			if(dListCurrentPosition > dListTotal - 1) dListCurrentPosition = dListTotal - 1;
			if(dListCurrentPosition > dListMaxDisplay)
	        {
		        if((dListCurrentPosition+dListScrollPosition) < dListTotal) dListScrollPosition++;
			    dListCurrentPosition = dListMaxDisplay;
			}
			break;

		case DIR_LEFT:
			break;

		case DIR_RIGHT:
			break;

		case WIIMOTE_PLUS:
		case WIIMOTE_2:
		case CC_PLUS:
		case CC_A:
		case GC_START:
		case GC_A:
			// Start Engine!
			status = 1;
			break;

		case WIIMOTE_HOME: // TODO? make a nice-looking Home menu
		case CC_HOME:
		case GC_Z:
			// Exit Engine!
			status = 2;
			break;

		case WIIMOTE_1:
		case CC_X:
		case GC_X:
			status = 3;
			break;

		default:
			// No Update Needed!
			status = 0;
			break;
	}
	return status;
}