예제 #1
0
ENTRYPOINT void draw_screenflip(ModeInfo *mi)
{
  Screenflip *c = &screenflip[MI_SCREEN(mi)];
  Window w = MI_WINDOW(mi);
  Display *disp = MI_DISPLAY(mi);

  if (!c->glx_context)
      return;

  /* Wait for the first image; for subsequent images, load them in the
     background while animating. */
  if (c->waiting_for_image_p && c->first_image_p)
    return;

  glXMakeCurrent(disp, w, *c->glx_context);

  glBindTexture(GL_TEXTURE_2D, c->texid);

  if (c->regrab)
    getSnapshot(mi);

  display(c, MI_IS_WIREFRAME(mi));

  if(mi->fps_p) do_fps(mi);
  glFinish(); 
  glXSwapBuffers(disp, w);
}
예제 #2
0
void cmd_drop(int id){
	snapshot* snapshot = getSnapshot(id);
	if(snapshot != NULL){
		deleteSnapshot(snapshot);
		printf("ok\n");
		return;
	}
	printf("no such snapshot\n");
}
예제 #3
0
void cmd_checkout(int id){
	snapshot* checkoutSnapshot = getSnapshot(id);
	entry* currentEntry = entry_head;
	entry* previousEntry;
	entry* duplicateEntry;

	if(checkoutSnapshot == NULL){
		printf("no such snapshot\n");
		return;
	}

	while(currentEntry != NULL){
		previousEntry = currentEntry;
		currentEntry = currentEntry->next;
		deleteEntry(previousEntry);
	}
	currentEntry = checkoutSnapshot->entries;
	
	while(currentEntry != NULL){
		value *currentValue, *duplicateValue = NULL;

		entry* newEntry = (entry*)malloc(sizeof(*newEntry));
		strcpy(newEntry->key, currentEntry->key);
		newEntry->next = NULL;
		newEntry->prev = NULL;
		newEntry->values = NULL;
		if(currentEntry->prev == NULL){
			newEntry->prev = NULL;
			entry_head = newEntry;
		}else{
			newEntry->prev = duplicateEntry;
			duplicateEntry->next = newEntry;
		}
		duplicateEntry = newEntry;
		currentValue = currentEntry->values;
		
		while(currentValue != NULL){
			value* newValue = (value*)malloc(sizeof(*newValue));
			newValue->value = currentValue->value;
			newValue->next = NULL;
			newValue->prev = NULL;
			if(currentValue->prev == NULL){
				newEntry->values = newValue;
			}else{
				newValue->prev = duplicateValue;
				duplicateValue->next = newValue;
			}
			duplicateValue = newValue;
			currentValue = currentValue->next;
		}
		currentEntry = currentEntry->next;
	}
	entry_tail = duplicateEntry;
	printf("ok\n");
}
예제 #4
0
ENTRYPOINT void init_screenflip(ModeInfo *mi)
{
  int screen = MI_SCREEN(mi);
  Screenflip *c;

 if (screenflip == NULL) {
   if ((screenflip = (Screenflip *) calloc(MI_NUM_SCREENS(mi),
                                        sizeof(Screenflip))) == NULL)
          return;
 }
 c = &screenflip[screen];
 c->window = MI_WINDOW(mi);

 c->trackball = gltrackball_init ();

 if ((c->glx_context = init_GL(mi)) != NULL) {
      reshape_screenflip(mi, MI_WIDTH(mi), MI_HEIGHT(mi));
 } else {
     MI_CLEARWINDOW(mi);
 }
 c->winh = MI_WIN_HEIGHT(mi);
 c->winw = MI_WIN_WIDTH(mi);
 c->qw = QW;
 c->qh = QH;
 c->qx = -6;
 c->qy = 6;

 c->rx = c->ry = 1;
 c->odrot = 1;

 c->show_colors[0] = c->show_colors[1] = 
   c->show_colors[2] = c->show_colors[3] = 1;

 if (! MI_IS_WIREFRAME(mi))
   {
     glShadeModel(GL_SMOOTH);
     glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
     glEnable(GL_DEPTH_TEST);
     glEnable(GL_CULL_FACE);
     glCullFace(GL_BACK);
     glDisable(GL_LIGHTING);
   }

 if (strstr ((char *) glGetString(GL_EXTENSIONS),
             "GL_EXT_texture_filter_anisotropic"))
   glGetFloatv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &c->anisotropic);
 else
   c->anisotropic = 0.0;

 glGenTextures(1, &c->texid);

 c->first_image_p = True;
 getSnapshot(mi);
}
예제 #5
0
void cmd_rollback(int id){
	snapshot* rollbackSnapshot = getSnapshot(id);
	if(rollbackSnapshot != NULL){
		snapshot* currentSnapshot = snapshot_head;
		while(currentSnapshot != rollbackSnapshot){
			snapshot* nextSnapshot = currentSnapshot->next;
			deleteSnapshot(currentSnapshot);
			currentSnapshot = nextSnapshot;
		}
		cmd_checkout(id);
	}else{
		printf("no such snapshot\n");
	}
}
예제 #6
0
    //--------------------------------------------------------------
    void SequenceRamses::draw(float scale)
    {
        if (m_bRender) 
		{
            ofSetColor(ofColor::white);
            glPointSize(1.0);

            ofPushMatrix();
            ofScale(scale / m_normalizeFactor, scale / m_normalizeFactor, scale / m_normalizeFactor);
            ofTranslate(m_originShift.x, m_originShift.y, m_originShift.z);
            {
                m_renderShader.begin();
				m_renderShader.setUniform1f("uDensityMin", m_densityMin * m_densityRange.getSpan());
				m_renderShader.setUniform1f("uDensityMax", m_densityMax * m_densityRange.getSpan());
				{
					getSnapshot().update(m_renderShader);
					getSnapshot().draw();
				}
				m_renderShader.end();
            }
            ofPopMatrix();
        }
    }
예제 #7
0
    double endTiming() {
      Snapshot end;
      getSnapshot(end);

      Entry *entry = currentTimers.top().first;
      compareSnapshot(currentTimers.top().second, end, entry);
      
      currentTimers.pop();
      if (!currentTimers.empty()) {
        entry->parent = currentTimers.top().first;
        entry->parent->children.push_back(entry);
      } else {
        root_entries.push_back(entry);
      }
      //std::sort(entry->children.begin(), entry->children.end(), cmp());
      return entry->time;
    }
예제 #8
0
CPixelate::CPixelate(unsigned short speed) :
mp_OldSurface(NULL),
m_speed(speed)
{
	SDL_Rect gameres = g_pVideoDriver->getGameResolution().SDLRect();
	getSnapshot();

	m_line = 0;
	m_lines_completed = 0;
	m_drawmap = new bool[gameres.h*gameres.w];
	m_pixels_per_line = new unsigned short[gameres.h];

	for(size_t y=0 ; y<gameres.h ; y++)
	{
		m_pixels_per_line[y] = 0;
		for(size_t x=0 ; x<gameres.w ; x++)
			m_drawmap[y*gameres.w+x] = false;
	}
}
예제 #9
0
void DB2Mon::getDatabaseSnapshot(JNIEnv* env, char* dbName, Snapshot& snap)
{
	// Allocate the sqlma (monitor area) structure. This tells DB2 which objects
	// we want to monitor.
	unsigned int obj_num = 16;    // # of objects to monitor
	unsigned int ma_sz = SQLMASIZE(obj_num);
	MemObj	ptrSQLMA(ma_sz);
	sqlma *ma_ptr = (sqlma *) ptrSQLMA.get();
	ma_ptr->obj_num = obj_num;
	ma_ptr->obj_var[0].obj_type = SQLMA_DBASE;
	strncpy((char *)ma_ptr->obj_var[0].object, dbName, SQLM_OBJECT_SZ);
	ma_ptr->obj_var[1].obj_type = SQLMA_DBASE_APPLS;
	strncpy((char *)ma_ptr->obj_var[1].object, dbName, SQLM_OBJECT_SZ);
	ma_ptr->obj_var[2].obj_type = SQLMA_DBASE_TABLESPACES;
	strncpy((char *)ma_ptr->obj_var[2].object, dbName, SQLM_OBJECT_SZ);
	ma_ptr->obj_var[3].obj_type = SQLMA_DBASE_LOCKS;
	strncpy((char *)ma_ptr->obj_var[3].object, dbName, SQLM_OBJECT_SZ);
	ma_ptr->obj_var[4].obj_type = SQLMA_DBASE_BUFFERPOOLS;
	strncpy((char *)ma_ptr->obj_var[4].object, dbName, SQLM_OBJECT_SZ);
	ma_ptr->obj_var[5].obj_type = SQLMA_DBASE_TABLES;
	strncpy((char *)ma_ptr->obj_var[5].object, dbName, SQLM_OBJECT_SZ);
	ma_ptr->obj_var[6].obj_type = SQLMA_DYNAMIC_SQL;
	strncpy((char *)ma_ptr->obj_var[6].object, dbName, SQLM_OBJECT_SZ);

	ma_ptr->obj_var[7].obj_type = SQLMA_DCS_DBASE_APPLS;
	strncpy((char *)ma_ptr->obj_var[7].object, dbName, SQLM_OBJECT_SZ);

	ma_ptr->obj_var[8].obj_type = SQLMA_DBASE_APPLS_REMOTE;
	strncpy((char *)ma_ptr->obj_var[8].object, dbName, SQLM_OBJECT_SZ);

	// include generic ones as well
	ma_ptr->obj_var[ 9].obj_type = SQLMA_DBASE_ALL;
	ma_ptr->obj_var[10].obj_type = SQLMA_BUFFERPOOLS_ALL;
	ma_ptr->obj_var[11].obj_type = SQLMA_DBASE_REMOTE_ALL;
	ma_ptr->obj_var[12].obj_type = SQLMA_DCS_DBASE_ALL;
	ma_ptr->obj_var[13].obj_type = SQLMA_APPL_ALL;
	ma_ptr->obj_var[14].obj_type = SQLMA_DCS_APPL_ALL;
	ma_ptr->obj_var[15].obj_type = SQLMA_APPL_REMOTE_ALL;
	//ma_ptr->obj_var[16].obj_type = SQLMA_APPLINFO_ALL;
	//ma_ptr->obj_var[17].obj_type = SQLMA_DCS_APPLINFO_ALL;

	getSnapshot(env, ma_ptr, snap);
}
예제 #10
0
bool OpenGLRenderer::getSnapshot(Image & image, size_t width, size_t height) {
	
	// TODO handle scaling on the GPU so we don't need to download the whole image
	
	Image fullsize;
	
	getSnapshot(fullsize);
	
 	image.Create(width, height, Image::Format_R8G8B8);
	
	GLint ret = gluScaleImage(GL_RGB, fullsize.GetWidth(), fullsize.GetHeight(), GL_UNSIGNED_BYTE,
	                          fullsize.GetData(), width, height, GL_UNSIGNED_BYTE, image.GetData());
	
	if(ret) {
		LogWarning << "Failed to scaled down screen capture: " << ret << " = " << gluErrorString(ret);
		return false;
	}
	
	return true;
}
예제 #11
0
ENTRYPOINT Bool
screenflip_handle_event (ModeInfo *mi, XEvent *event)
{
  Screenflip *c = &screenflip[MI_SCREEN(mi)];

  if (gltrackball_event_handler (event, c->trackball,
                                 MI_WIDTH (mi), MI_HEIGHT (mi),
                                 &c->button_down_p))
    return True;
  else if (screenhack_event_helper (MI_DISPLAY(mi), MI_WINDOW(mi), event))
    {
      if (!c->waiting_for_image_p)
        {
          getSnapshot (mi);
          return True;
        }
    }

  return False;
}
예제 #12
0
파일: gpuWnd.c 프로젝트: 0nem4n/demul
LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
	switch (msg) {
	case WM_CLOSE:
		return TRUE;

	case WM_KEYDOWN:
		switch (LOWORD(wParam)) {
		case VK_F9:
		{
			u8 *buf = malloc(width * height * 3);
			getSnapshot(buf);
			SaveSnapshot(buf, width * height * 3);
			free(buf);
		}
		}

	default:
		return DefWindowProc(hWnd, msg, wParam, lParam);
	}

	return FALSE;
}
예제 #13
0
void DB2Mon::getSystemSnapshot(JNIEnv* env, Snapshot& snap)
{
	// Allocate the sqlma (monitor area) structure. This tells DB2 which objects
	// we want to monitor.
	unsigned int obj_num = 7;    // # of objects to monitor
	unsigned int ma_sz = SQLMASIZE(obj_num);
	MemObj	ptrSQLMA(ma_sz);
	sqlma *ma_ptr = (sqlma *) ptrSQLMA.get();
	ma_ptr->obj_num = obj_num;
	ma_ptr->obj_var[0].obj_type = SQLMA_DBASE_ALL;
	ma_ptr->obj_var[1].obj_type = SQLMA_BUFFERPOOLS_ALL;
	ma_ptr->obj_var[2].obj_type = SQLMA_DBASE_REMOTE_ALL;
	ma_ptr->obj_var[3].obj_type = SQLMA_DCS_DBASE_ALL;
	ma_ptr->obj_var[4].obj_type = SQLMA_APPL_ALL;
	ma_ptr->obj_var[5].obj_type = SQLMA_DCS_APPL_ALL;
	ma_ptr->obj_var[6].obj_type = SQLMA_APPL_REMOTE_ALL;
	//ma_ptr->obj_var[7].obj_type = SQLMA_APPLINFO_ALL;
	//ma_ptr->obj_var[8].obj_type = SQLMA_DCS_APPLINFO_ALL;


	getSnapshot(env, ma_ptr, snap);
}
예제 #14
0
   string Solver::convet2CaffeFormat()
   {
       string outStr = "";

       string netStrStart = "net: \"";
       string netStrEnd = "\"\n";

       string trainNetStrStart = "train_net: \"";
       string trainNetStrEnd = "\"\n";

       string testNetStrStart = "test_net: \"";
       string testNetStrEnd = "\"\n";

       string testIterStrStart = "test_iter: ";
       string testIterStrEnd = "\n";

       string testIntervalStrStart = "test_interval: ";
       string testIntervalStrEnd = "\n";

       string baseLrStrStart = "base_lr: ";
       string baseLrStrEnd = "\n";

       string momentumStrStart = "momentum: ";
       string momentumStrEnd = "\n";

       string weightDecayStrStart = "weight_decay: ";
       string weightDecayStrEnd = "\n";

       string lrPolicyStrStart = "lr_policy: \"";
       string lrPolicyStrEnd = "\"\n";

       string stepSizeStrStart = "stepsize: ";
       string stepSizeStrEnd = "\n";

       string gammaStrStart = "gamma: ";
       string gammaStrEnd = "\n";

       string powerStrStart = "power: ";
       string powerStrEnd = "\n";

       string stepValueStrStart = "stepvalue: ";
       string stepValueStrEnd = "\n";

       string displayStrStart = "display: ";
       string displayStrEnd = "\n";

       string maxIterStrStart = "max_iter: ";
       string maxIterStrEnd = "\n";

       string snapshotStrStart = "snapshot: ";
       string snapshotStrEnd = "\n";

       string snapshotPrefixStrStart = "snapshot_prefix: \"";
       string snapshotPrefixStrEnd = "\"\n";

       string typeStrStart = "type: \"";
       string typeStrEnd = "\"\n";

       string solveModeStrStart = "solver_mode: ";
       string solveModeStrEnd= "\n";

       if(getNet() != "")
       {
           outStr += netStrStart + getNet() + netStrEnd;
       }

       if(getTainNet() != "")
       {
           outStr += trainNetStrStart + getTainNet() + trainNetStrEnd;
       }

       if(getTestNet() != "")
       {
           outStr += testNetStrStart + getTestNet() + testNetStrEnd;
       }

       outStr += testIterStrStart + to_string(getTestIter()) + testIterStrEnd +
                        testIntervalStrStart + to_string(getTestInterval()) + testIntervalStrEnd +
                        baseLrStrStart + to_string(getBaseLr()) + baseLrStrEnd +
                        momentumStrStart + to_string(getMomentum()) + momentumStrEnd +
                        weightDecayStrStart + to_string(getWeightDecay()) + weightDecayStrEnd;

       switch(getLrPolicy())
       {
            case LrPolicy::LRPOLICY_FIXED:
            {
                outStr += lrPolicyStrStart + "fixed" + lrPolicyStrEnd;
                break;
            }
            case LrPolicy::LRPOLICY_STEP:
            {
                outStr += lrPolicyStrStart + "step" + lrPolicyStrEnd +
                        stepSizeStrStart + to_string(getStepSize()) + stepSizeStrEnd +
                        gammaStrStart + to_string(getGamma()) + gammaStrEnd;
                break;
            }
            case LrPolicy::LRPOLICY_EXP:
            {
                outStr += lrPolicyStrStart + "exp" + lrPolicyStrEnd +
                        gammaStrStart + to_string(getGamma()) + gammaStrEnd;
                break;
            }
            case LrPolicy::LRPOLICY_INV:
            {
                outStr += lrPolicyStrStart + "inv" + lrPolicyStrEnd +
                        gammaStrStart + to_string(getGamma()) + gammaStrEnd +
                        powerStrStart + to_string(getPower()) + powerStrEnd;
                break;
            }
            case LrPolicy::LRPOLICY_MULTISTEP:
            {
                outStr += lrPolicyStrStart + "multistep" + lrPolicyStrEnd;
                for(int i = 0 ; i < mParam->mStepValue.size(); i++)
                {
                    outStr += stepValueStrStart + to_string(getStepValue(i)) + stepValueStrEnd;
                }
                outStr += gammaStrStart + to_string(getGamma()) + gammaStrEnd;
                break;
            }
            case LrPolicy::LRPOLICY_POLY:
            {
                outStr += lrPolicyStrStart + "poly" + lrPolicyStrEnd +
                        powerStrStart + to_string(getPower()) + powerStrEnd;
                break;
            }
            case LrPolicy::LRPOLICY_SIGMOID:
            {
                outStr += lrPolicyStrStart + "sigmoid" + lrPolicyStrEnd +
                        stepSizeStrStart + to_string(getStepSize()) + stepSizeStrEnd +
                        gammaStrStart + to_string(getGamma()) + gammaStrEnd;
                break;
            }
       }

       outStr += displayStrStart + to_string(getDisplay()) + displayStrEnd +
               maxIterStrStart + to_string(getMaxIter()) + maxIterStrEnd +
               snapshotStrStart + to_string(getSnapshot()) + snapshotStrEnd;

       if(getSnapshotPrefix() != "")
       {
           outStr += snapshotPrefixStrStart + getSnapshotPrefix() + snapshotPrefixStrEnd;
       }

       switch(getType())
       {
            case SolverType::SGD:
            {
                outStr += typeStrStart + "SGD" + typeStrEnd;
                break;
            }
            case SolverType::NESTEROV:
            {
                outStr += typeStrStart + "Nesterov" + typeStrEnd;
                break;
            }
            case SolverType::ADAGRAD:
            {
                outStr += typeStrStart + "AdaGrad" + typeStrEnd;
                break;
            }
            case SolverType::RMSPROP:
            {
                outStr += typeStrStart + "RMSProp" + typeStrEnd;
                break;
            }
            case SolverType::ADADELTA:
            {
                outStr += typeStrStart + "AdaDelta" + typeStrEnd;
                break;
            }
            case SolverType::ADAM:
            {
                outStr += typeStrStart + "Adam" + typeStrEnd;
                break;
            }
       }

       switch(getSolverMode())
       {
            case SolverMode::CPU:
            {
                outStr += solveModeStrStart + "CPU" + solveModeStrEnd;
                break;
            }
            case SolverMode::GPU:
            {
                outStr += solveModeStrStart + "GPU" + solveModeStrEnd;
                break;
            }
       }

       return outStr;

   }
예제 #15
0
파일: undomanager.cpp 프로젝트: KDE/digikam
bool UndoManager::putImageDataAndHistory(DImg* const img, int stepsBack) const
{
    if (stepsBack <= 0 || stepsBack > d->undoActions.size())
    {
        return false;
    }

    /*
     * We need to find a snapshot, for the state the given number of steps back.
     * 0 steps back is the current state of the EditorCore.
     * 1 step back is the snapshot of the last undo action, at d->undoActions.size() - 1.
     * The next problem is that if the corresponding action is reversible,
     * we do not have a snapshot, but need to walk forward to the first snapshot (or current
     * state), then apply the reversible steps.
     */
    int step = d->undoActions.size() - stepsBack;
    int snapshot;

    for (snapshot = step; snapshot < d->undoActions.size(); ++snapshot)
    {
        if (dynamic_cast<UndoActionIrreversible*>(d->undoActions.at(snapshot)))
        {
            break;
        }
    }

    if (snapshot == step)
    {
        getSnapshot(step, img);
    }
    else
    {
        DImg reverting;

        // Get closest available snapshot
        if (snapshot < d->undoActions.size())
        {
            getSnapshot(snapshot, &reverting);
        }
        else
        {
            reverting = d->core->getImg()->copyImageData();
        }

        // revert reversible actions, until reaching desired step
        for (; snapshot > step; snapshot--)
        {
            UndoActionReversible* const reversible = dynamic_cast<UndoActionReversible*>(d->undoActions.at(snapshot - 1));
            if (!reversible) // would be a bug
            {
                continue;
            }
            reversible->getReverseFilter().apply(reverting);
        }

        img->putImageData(reverting.width(), reverting.height(), reverting.sixteenBit(),
                          reverting.hasAlpha(), reverting.stripImageData(), false);
    }

    // adjust history
    UndoAction* const action             = d->undoActions.at(step);
    UndoMetadataContainer dataBeforeStep = action->getMetadata();
    dataBeforeStep.toImage(*img);

    return true;
}
static RVOID
    userModeDiff
    (
        rEvent isTimeToStop
    )
{
    processEntry snapshot_1[ MAX_SNAPSHOT_SIZE ] = { 0 };
    processEntry snapshot_2[ MAX_SNAPSHOT_SIZE ] = { 0 };
    processEntry* currentSnapshot = snapshot_1;
    processEntry* previousSnapshot = snapshot_2;
    processEntry* tmpSnapshot = NULL;
    RBOOL isFirstSnapshots = TRUE;
    RU32 i = 0;
    RBOOL isFound = FALSE;
    RU32 nTmpElem = 0;
    RU32 nCurElem = 0;
    RU32 nPrevElem = 0;
    LibOsPerformanceProfile perfProfile = { 0 };

    perfProfile.enforceOnceIn = 1;
    perfProfile.sanityCeiling = MSEC_FROM_SEC( 10 );
    perfProfile.lastTimeoutValue = 100;
    perfProfile.targetCpuPerformance = 0;
    perfProfile.globalTargetCpuPerformance = GLOBAL_CPU_USAGE_TARGET;
    perfProfile.timeoutIncrementPerSec = 10;

    while( !rEvent_wait( isTimeToStop, 0 ) &&
           ( !kAcq_isAvailable() ||
             g_is_kernel_failure ) )
    {
        libOs_timeoutWithProfile( &perfProfile, FALSE );

        tmpSnapshot = currentSnapshot;
        currentSnapshot = previousSnapshot;
        previousSnapshot = tmpSnapshot;

        nTmpElem = nCurElem;
        nCurElem = nPrevElem;
        nPrevElem = nTmpElem;

        if( getSnapshot( currentSnapshot, &nCurElem ) )
        {
            if( isFirstSnapshots )
            {
                isFirstSnapshots = FALSE;
                continue;
            }

            // Diff to find new processes
            for( i = 0; i < nCurElem; i++ )
            {
                isFound = FALSE;

                if( (RU32)( -1 ) != rpal_binsearch_array( previousSnapshot,
                                                          nPrevElem,
                                                          sizeof( processEntry ),
                                                          &(currentSnapshot[ i ].pid),
                                                          (rpal_ordering_func)rpal_order_RU32 ) )
                {
                    isFound = TRUE;
                }

                if( !isFound )
                {
                    if( !notifyOfProcess( currentSnapshot[ i ].pid,
                                          currentSnapshot[ i ].ppid,
                                          TRUE,
                                          NULL,
                                          NULL,
                                          KERNEL_ACQ_NO_USER_ID,
                                          0 ) )
                    {
                        rpal_debug_warning( "error reporting new process: %d",
                                            currentSnapshot[ i ].pid );
                    }
                }
            }

            // Diff to find terminated processes
            for( i = 0; i < nPrevElem; i++ )
            {
                isFound = FALSE;

                if( (RU32)( -1 ) != rpal_binsearch_array( currentSnapshot,
                                                          nCurElem,
                                                          sizeof( processEntry ),
                                                          &(previousSnapshot[ i ].pid),
                                                          (rpal_ordering_func)rpal_order_RU32 ) )
                {
                    isFound = TRUE;
                }

                if( !isFound )
                {
                    if( !notifyOfProcess( previousSnapshot[ i ].pid,
                                          previousSnapshot[ i ].ppid,
                                          FALSE,
                                          NULL,
                                          NULL,
                                          KERNEL_ACQ_NO_USER_ID,
                                          0 ) )
                    {
                        rpal_debug_warning( "error reporting terminated process: %d",
                                            previousSnapshot[ i ].pid );
                    }
                }
            }
        }

        libOs_timeoutWithProfile( &perfProfile, TRUE );
    }
}
예제 #17
0
 void startTiming(int id) {
   entries.push_back(Entry(id)); 
   currentTimers.push(std::make_pair(&entries.back(), Snapshot()));  
   getSnapshot(currentTimers.top().second);
 }
CColorMerge::CColorMerge(const Uint8 speed) :
m_Speed(speed),
m_Alpha(0)
{
    getSnapshot();
}
Region* LayerRenderer::getRegion() const {
    if (getSnapshot()->flags & Snapshot::kFlagFboTarget) {
        return OpenGLRenderer::getRegion();
    }
    return &mLayer->region;
}
예제 #20
0
void Entity::interpolate(float time) {
	TransformSnapshot snapshot = getSnapshot(time);
	mPosition = snapshot.position;
}
예제 #21
0
	//--------------------------------------------------------------
	SnapshotRamses& SequenceRamses::getSnapshotForPercent(float percent)
	{
		setFrameAtPercent(percent);
		return getSnapshot();
	}
예제 #22
0
	//--------------------------------------------------------------
	SnapshotRamses& SequenceRamses::getSnapshotForTime(float time)
	{
		setFrameForTime(time);
		return getSnapshot();
	}
예제 #23
0
	//--------------------------------------------------------------
	SnapshotRamses& SequenceRamses::getSnapshotForFrame(int index)
	{
		setFrame(index);
		return getSnapshot();
	}
static RPVOID
    processDiffThread
    (
        rEvent isTimeToStop,
        RPVOID ctx
    )
{
    processEntry* currentSnapshot = g_snapshot_1;
    processEntry* previousSnapshot = g_snapshot_2;
    processEntry* tmpSnapshot = NULL;
    RBOOL isFirstSnapshots = TRUE;
    RU32 i = 0;
    RU32 j = 0;
    RBOOL isFound = FALSE;
    RU32 nThLoop = 0;
    RU32 currentTimeout = 0;
    UNREFERENCED_PARAMETER( ctx );

    while( !rEvent_wait( isTimeToStop, currentTimeout ) )
    {
        tmpSnapshot = currentSnapshot;
        currentSnapshot = previousSnapshot;
        previousSnapshot = tmpSnapshot;

        if( getSnapshot( currentSnapshot ) )
        {
            if( isFirstSnapshots )
            {
                isFirstSnapshots = FALSE;
                continue;
            }

            // Diff to find new processes
            for( i = 0; i < MAX_SNAPSHOT_SIZE; i++ )
            {
                isFound = FALSE;

                if( 0 == currentSnapshot[ i ].pid )
                {
                    break;
                }

                for( j = 0; j < MAX_SNAPSHOT_SIZE; j++ )
                {
                    if( 0 == previousSnapshot[ j ].pid )
                    {
                        break;
                    }

                    if( previousSnapshot[ j ].pid == currentSnapshot[ i ].pid )
                    {
                        isFound = TRUE;
                        break;
                    }
                }

                if( !isFound )
                {
                    if( !notifyOfProcess( currentSnapshot[ i ].pid, 
                                          currentSnapshot[ i ].ppid,
                                          TRUE ) )
                    {
                        rpal_debug_warning( "error reporting new process: %d", 
                                            currentSnapshot[ i ].pid );
                    }
                }
            }

            // Diff to find terminated processes
            for( i = 0; i < MAX_SNAPSHOT_SIZE; i++ )
            {
                isFound = FALSE;

                if( 0 == previousSnapshot[ i ].pid )
                {
                    break;
                }

                for( j = 0; j < MAX_SNAPSHOT_SIZE; j++ )
                {
                    if( 0 == currentSnapshot[ j ].pid )
                    {
                        break;
                    }

                    if( previousSnapshot[ i ].pid == currentSnapshot[ j ].pid )
                    {
                        isFound = TRUE;
                        break;
                    }
                }

                if( !isFound )
                {
                    if( !notifyOfProcess( previousSnapshot[ i ].pid,
                                          previousSnapshot[ i ].ppid,
                                          FALSE ) )
                    {
                        rpal_debug_warning( "error reporting terminated process: %d",
                                            previousSnapshot[ i ].pid );
                    }
                }
            }
        }

        nThLoop++;
        if( 0 == nThLoop % 20 )
        {
#ifdef RPAL_PLATFORM_WINDOWS
            // The Windows API is much more efficient than on Nix so we can affort
            // going faster between our diffs.
            currentTimeout = libOs_getUsageProportionalTimeout( 500 ) + 100;
#else
            currentTimeout = libOs_getUsageProportionalTimeout( 800 ) + 200;
#endif
        }
    }

    return NULL;
}