Example #1
0
void wff2obdd_init()
{
    stat_init();
    init_stopwatch("compilation time", "propositional Wff to OBDD conversion time: %d s %d.%d ms", "compilation");
    init_int_counter("cache hits", "cache hits: %d", "internals");
    init_int_counter("nodes", "OBDD nodes: %d", "output");
}
Example #2
0
void gotcha_init(diagnostic_problem problem,
                 const_tv_dnf_hierarchy input,
                 const_node root)
{
    stat_init();

    gotcha_set_input(problem, input, root);

    init_int_counter("inconsistent", "inconsistent states: %d", "search tree");
    init_int_counter("forward inconsistent", "unit check inconsistent states: %d", "search tree");
    init_int_counter("pushed", "nodes pushed: %d", "opened queue");
    init_int_counter("max", "maximum size: %d nodes", "opened queue");

    init_stopwatch("search time", "search time: %d s %d.%d ms", "dynamics");
    init_stopwatch("preprocessing time", "preprocessing time: %d s %d.%d ms", "dynamics");
    init_stopwatch("observation filtering time", "observation filtering time: %d s %d.%d ms", "dynamics");
}
// *************************************************************************************************
// @fn          mx_stopwatch
// @brief       Stopwatch set routine. Mx stops stopwatch and resets count.
// @param       u8 line	LINE2
// @return      none
// *************************************************************************************************
void mx_stopwatch(u8 line)
{
	// Stop stopwatch
	stop_stopwatch();
			
	// Reset stopwatch count
	init_stopwatch();	
	LAP_TimeFlag = LAP_CATCHED;
	
	// Set mode
	set_stopwatchmode();
	
	// Display "00:00:00"
	display_stopwatch(line, DISPLAY_LINE_UPDATE_FULL);
}
// *************************************************************************************************
// @fn          stopwatch_tick
// @brief       Called by 1/100Hz interrupt handler. 
//				Increases stopwatch counter and triggers display update.
// @param       none
// @return      none
// *************************************************************************************************
void stopwatch_tick(void)
{
  //Make sure Stopwatch is running before we do anything else (this might slightly mess up my timing, but oh well)
  if(sStopwatch.state == STOPWATCH_RUN){
	static u8 delay = 0;
	
	// Default view (< 20 minutes): display and count MM:SS:hh
	if (sStopwatch.viewStyle == DISPLAY_DEFAULT_VIEW)
	{
		// Add 1/100 sec 
		sStopwatch.time[7]++;
				
		// Draw flag minimizes display update activity
		//
		// swt.drawFlag = 1: second L
		// swt.drawFlag = 2: second H/L
		// swt.drawFlag = 3: minutes L, second H/L
		// swt.drawFlag = 4: minutes H/L, second H/L
		// swt.drawFlag = 5: hours L, minutes H/L, second H/L
		// swt.drawFlag = 6: hours H/L, minutes H/L, second H/L
		// swt.drawFlag = 7: 1/10 sec, 1/100 sec
		// swt.drawFlag = 8: 1/100 sec (every 17/100 sec to reduce display draw activity)
		if (delay++ > 17) 
		{
			sStopwatch.drawFlag = 8;
			delay = 0;
		}
	
		// Add 1/10 sec 
		if (sStopwatch.time[7] == 0x3A)
		{
			sStopwatch.time[7]='0';
			sStopwatch.time[6]++;
			
			// 1/10Hz trigger 
			sStopwatch.swtIs10Hz = 1;
			
			// Update draw flag
			sStopwatch.drawFlag = 7;
		}
	} 
	else // Alternative view (20 minutes .. 20 hours): display and count HH:MM:SS
	{
		// Just add 1 second
		sStopwatch.time[6] = 0x3A;
	}
			
	// Second overflow?
	if (sStopwatch.time[6] == 0x3A)
	{
		// Reset draw flag
		sStopwatch.drawFlag = 1;

		// 1Hz trigger 
		sStopwatch.swtIs1Hz = 1;
		
		// Add data
		sStopwatch.time[6]='0';
		sStopwatch.time[5]++;							// second  L (0 - 9)
		if (sStopwatch.time[5] == 0x3A) 
		{
			sStopwatch.drawFlag++;						// 2
			sStopwatch.time[5] = '0';
			sStopwatch.time[4]++;						// second  H (0 - 5)
			if (sStopwatch.time[4] == '6') 
			{
				sStopwatch.drawFlag ++;					// 3
				sStopwatch.time[4] = '0';
				sStopwatch.time[3]++;					// minutes L (0 - 9)
				if (sStopwatch.time[3] == 0x3A) 
				{
					sStopwatch.drawFlag++;				// 4
					sStopwatch.time[3] = '0';
					sStopwatch.time[2]++;				// minutes H (0 - 5)
					if (sStopwatch.time[2] == '2')
					{
						// SWT display changes from MM:SS:hh to HH:MM:SS when reaching 20 minutes 
						sStopwatch.viewStyle = DISPLAY_ALTERNATIVE_VIEW;
						display_stopwatch(LINE2, DISPLAY_LINE_UPDATE_FULL);
						
	   				} 
					else if (sStopwatch.time[2] == '6') 
					{
						sStopwatch.drawFlag++;				// 5
						sStopwatch.time[2] = '0';
						sStopwatch.time[1]++;				// hours L (0-9)	

						if (sStopwatch.time[1] == 0x3A) 
						{
							sStopwatch.drawFlag++;			// 6
							sStopwatch.time[1] = '0';
							sStopwatch.time[0]++;			// hours H (0-1)	

							if (sStopwatch.time[0] == '2') 
							{
								// When reaching 20 hours, start over 
								init_stopwatch();
								sStopwatch.state = STOPWATCH_RUN;
								display_stopwatch(LINE2, DISPLAY_LINE_UPDATE_FULL);
							}
		   				} 
	   				} 
				}
			}
		}
	}		
	
	// Always set display update flag
	display.flag.update_stopwatch = 1;
  }
}
// *************************************************************************************************
// @fn          reset_stopwatch
// @brief       Init stopwatch and sets mode & LAP flag.
// @param       none
// @return      none
// *************************************************************************************************
void reset_stopwatch(void)
{
	init_stopwatch();
	StopwatchMode = MODE_STOPTIMER; 
	LAP_TimeFlag  = LAP_CATCHED;
}