void WebMemorySampler::start(const double interval) 
{
    if (m_isRunning) 
        return;
    
    initializeTempLogFile();
    initializeTimers(interval);
}
AmesosLinearOpWithSolveFactory::AmesosLinearOpWithSolveFactory(
  const Amesos::ESolverType                            solverType
  ,const Amesos::ERefactorizationPolicy                refactorizationPolicy
  ,const bool                                          throwOnPrecInput
    )
  :epetraFwdOpViewExtractor_(Teuchos::rcp(new EpetraOperatorViewExtractorStd()))
  ,solverType_(solverType)
  ,refactorizationPolicy_(refactorizationPolicy)
  ,throwOnPrecInput_(throwOnPrecInput)
{
  initializeTimers();
}
void WebMemorySampler::start(const SandboxExtension::Handle& sampleLogFileHandle, const String& sampleLogFilePath, const double interval) 
{
    if (m_isRunning) 
        return;
    
    // If we are on a system without SandboxExtension the handle and filename will be empty
    if (sampleLogFilePath.isEmpty()) {
        start(interval);
        return;
    }
        
    initializeSandboxedLogFile(sampleLogFileHandle, sampleLogFilePath);
    initializeTimers(interval);
   
}
Esempio n. 4
0
void AmbulanceC::reset(void){

digitalWrite(o_StatusLED,HIGH);

initializeTimers();

resetScene();

resetAl();

resetSrn();

resetInterrupts();

digitalWrite(o_StatusLED,LOW);
}
Esempio n. 5
0
int main(void) {
    initializePlatform();
    initializeLogging();
    initializeTimers();
    initializePower();
    initializeUsb(listener.usb);
    initializeSerial(listener.serial);
    initializeEthernet(listener.ethernet);
    initializeLights();
    initializeBluetooth();

    debug("Initializing as %s", getMessageSet());
    setup();

    for (;;) {
        loop();
        processListenerQueues(&listener);
        updateInterfaceLight();
        updatePower();
    }

    return 0;
}
/*===============================================================================*/
int main(int argc, char **argv)
{
	FILE *ofile;
	FILE *fp;								    	/* File handler */
	bool endOfFile;							   		/* End of file variable */
	bool futureRequest  	 = FALSE;				/* The CPU request is for future time. It also makes "inputBuffer hold-On" call */
	currentCPUTick     	  	 = 0;					/* Start of the simulation */
	int addMax = 0;
	
	int i;
	
	for (i = 0; i < 16; ++i)
	{
		requestQueue[i].occupied = FALSE;
		requestQueue[i].finished = FALSE;
	}
	
	initializeTimers();

	/*================================================================================*/
	/* Open the file */
     if (argc != 3)
     {
      	printf("You must enter a testfile to use, and output file name.\n");
        return -1;
      }
 		
	 if ((fp = fopen(argv[1],"r")) == NULL)
     {
         printf("Could not open file: %s\n", argv[1]);
         return -1;
     }
     
    if((ofile = fopen(argv[2],"w"))== NULL)
    {
		printf("File open not successful. \n");
		return -1;
	}
	
	/*====================================================================================*/
	/* This is a big while loop that is exited only when there is no more CPU requests (in other
	 * words end-of-file reached) and the queue is completely empty */
	/*===================================================================================*/
	
	/*Examine if there is anything in the file. If nothing is in the file, no more program
	 * execution needed */
	endOfFile = loadInputBuffer(fp);
	if(!endOfFile)
		futureRequest = YES;
	else
		printf("File is empty!\n");
	
	while (!endOfFile || (countSlotsOccupied !=0))
	{
		/* Call a function to see if any request has been completed */
		
		
		addMax = ARRAY_SIZE - countSlotsOccupied + 1;
		examineQueueForCompletion(&countSlotsOccupied);
		
		/*====================================================================*/
		while (!endOfFile && countSlotsOccupied != ARRAY_SIZE && !issueTimeErrorFlag)   
		{
			/* Check this section again */
			/*==============================================*/
			if(futureRequest == YES)
			{
				/* CASE 1: Queue is empty */
				if(countSlotsOccupied == 0)
				{
					if(inputBuffer.timeIssued >currentCPUTick)
					{
						incrementTimers((inputBuffer.timeIssued + (4 - inputBuffer.timeIssued % 4)) - currentCPUTick);
						currentCPUTick = inputBuffer.timeIssued + (4 - inputBuffer.timeIssued % 4);
					}
				}
				
				if(inputBuffer.timeIssued > currentCPUTick)
					break;  		/* It's not yet time to enqueue. So break the loop */
				
				futureRequest = enqueue(&countSlotsOccupied, addMax);	/* Queue in the first open slot found */
			}
			
			/* Load another image from */

			else if(!endOfFile)
				{
					/* Load another request from the file */
					endOfFile=loadInputBuffer(fp);     /* Fill the temporary buffer */
					if(!endOfFile)
						futureRequest = YES;
					
				}
			/*========================================================*/
								
		}

		/* Error in CPU request time sequence or two requests at the same time */
		if(issueTimeErrorFlag)
			break;
		
		
		/* Call a function to see if any request has been completed */
			
	/* Do the DRAM service */

		policyManager(ofile);
		
	/*=========================================================================*/
	/* Service the DRAM */
	
		currentCPUTick += 4;

	}  
	/*========================================================================*/
	
return 0;
}