Esempio n. 1
0
File: i8x9x.c Progetto: opicron/mame
void i8x9x_device::internal_update(UINT64 current_time)
{
	UINT16 current_timer1 = timer_value(1, current_time);
	UINT16 current_timer2 = timer_value(2, current_time);

	for(int i=0; i<8; i++)
		if(hso_info[i].active) {
			UINT8 cmd = hso_info[i].command;
			UINT16 t = hso_info[i].time;
			if(((cmd & 0x40) && t == current_timer2) ||
				(!(cmd & 0x40) && t == current_timer1)) {
				if(cmd != 0x18 && cmd != 0x19)
					logerror("%s: hso cam %02x %04x in slot %d triggered\n",
								tag(), cmd, t, i);
				trigger_cam(i, current_time);
			}
		}

	if(current_time == ad_done) {
		ad_done = 0;
		ad_result &= ~8;
	}

	if(current_time == serial_send_timer)
		serial_send_done();

	UINT64 event_time = 0;
	for(int i=0; i<8; i++) {
		if(!hso_info[i].active && hso_cam_hold.active) {
			hso_info[i] = hso_cam_hold;
			hso_cam_hold.active = false;
			logerror("%s: hso cam %02x %04x in slot %d from hold\n", tag(), hso_cam_hold.command, hso_cam_hold.time, i);
		}
		if(hso_info[i].active) {
			UINT64 new_time = timer_time_until(hso_info[i].command & 0x40 ? 2 : 1, current_time, hso_info[i].time);
			if(!event_time || new_time < event_time)
				event_time = new_time;
		}
	}

	if(ad_done && ad_done < event_time)
		event_time = ad_done;

	if(serial_send_timer && serial_send_timer < event_time)
		event_time = serial_send_timer;

	recompute_bcount(event_time);
}
Esempio n. 2
0
int usb_putchar_timed(char ch, uint16_t delay)
{
	uint8_t timer_id = 0;
	
	if (!usb_on)
		return 0;
		
	timer_id = start_timer(delay);
	
	while (TESTBIT(USB_STATUS, USB_TXE))
		if (timer_id)
			if (!timer_value(timer_id))
			{
				stop_timer(timer_id);
				timer_id = 0;
				usb_on = 0;
				return 0;
			}
	
	stop_timer(timer_id);
	timer_id = 0;
	
	USB_DATA = ch;
	return 0;
}
Esempio n. 3
0
static int run_exec_timeout(shell_t *shell, shell_argv_t *cmd_argv, char *tag)
{
  int argc = cmd_argv->argc;
  char **argv = cmd_argv->argv;

  /* Check arguments */
  if ( argc > 3 ) {
    shell_error(shell, "%s: too many arguments\n", argv[0]);
    shell_std_help(shell, argv[0]);
    return -1;
  }

  /* Setup new timeout value if supplied */
  if ( argc > 1 ) {
    if ( timer_value(shell, argv[1], argv[2], &run_timeout) )
      return -1;
  }

  /* Write info to result file */
  if ( run_timeout > 0 )
    result_dump_engine(tag, "%ld.%03ld s", run_timeout / 1000, run_timeout % 1000);
  else
    result_dump_engine(tag, "No timeout defined");

  return 0;
}
Esempio n. 4
0
void do_adc(void)
{
	uint8_t	channel = adc_work_channels[adc_current_channel];
	
	if (ADC_USE_INTERRUPT == g_use_interrupt)
		return;
	
	if ((0 == adc[channel].timer_id) ||
		(0 == timer_value(adc[channel].timer_id)))
	{
		adc[channel].new_value += adc_single_value(channel);
		adc[channel].count++;
		if (adc[channel].count > adc[channel].max_count - 1)
		{
			adc[channel].count = 0;
			adc[channel].mean_value = 
				(int16_t)(adc[channel].new_value / adc[channel].max_count);
			adc[channel].new_value = 0;
		}
		
		stop_timer(adc[channel].timer_id);
		adc[channel].timer_id = start_timer(adc[channel].delay);
	}
	
	adc_current_channel++;
	if (-1 == adc_work_channels[adc_current_channel])
		adc_current_channel = 0;
}
Esempio n. 5
0
File: i8x9x.c Progetto: opicron/mame
UINT16 i8x9x_device::io_r16(UINT8 adr)
{
	switch(adr) {
	case 0x00:
		return 0x0000;
	case 0x02:
		return ad_result;
	case 0x04:
		logerror("%s: read hsi time (%04x)\n", tag(), PPC);
		return 0x0000;
	case 0x0a:
		return timer_value(1, get_cycle());
	case 0x0c:
		logerror("%s: read timer2 (%04x)\n", tag(), PPC);
		return timer_value(2, get_cycle());
	default:
		return io_r8(adr) | (io_r8(adr+1) << 8);
	}
}
Esempio n. 6
0
void process_siren(void)
{
	static uint16_t timer_id = 0;
	static uint8_t step = 0;
	
	uint8_t mode;
	
	mode = GET_SIREN_MODE;
	
	if (0 == mode)
	{
		if (timer_id)
			stop_timer(timer_id);
			
		timer_id = 0;
		step = 0;
		CONTROL_OFF(CONTROL_SIREN);
		CONTROL_OFF(LAMP_RED);
	}
	else
	{
		CONTROL_ON(LAMP_RED);
		
		if (0 == timer_id)
		{
			timer_id = start_timer(siren_program[mode - 1][step]);

			if (step & 0x01)
				CONTROL_OFF(CONTROL_SIREN);
			else
				CONTROL_ON(CONTROL_SIREN);
		}
		else
			if (!timer_value(timer_id))
			{
				stop_timer(timer_id);
				timer_id = 0;
				
				step++;
				if (step > siren_step_count[mode - 1])
					step = 0;
					
			}
	}	
}
Esempio n. 7
0
result_e usb_cmd(uint8_t * req, uint8_t * ack, size_t ack_size, uint16_t delay)
{
	result_e		res;
	uint8_t			timer_id;
	uint8_t			idx;
	
	if (!usb_on)
		return RESULT_TIMEOUT;
	
	for (idx = 0; req[idx] != '\n'; idx++)
		usb_putchar(req[idx]);
	usb_putchar('\n');
		
	if (NULL == ack)
		return RESULT_OK;
	
	res = RESULT_TIMEOUT;
		
	timer_id = start_timer(delay);
		
	while (timer_value(timer_id))
	{
		usb_getmsg();
		if (usb_msg_ready)
		{
			res = RESULT_OK;
			usb_msg_ready = 0;
			memcpy(ack, usb_inbuf, (ack_size < USB_INBUF_SIZE)?ack_size:USB_INBUF_SIZE);
			stop_timer(timer_id);
			break;
		}
	}
	
	stop_timer(timer_id);
	
	return res;
}
Esempio n. 8
0
void StreamTimerListe::SerializeAjax( Json::Value& root )
{
   // serialize primitives
	int size = LD_StreamListe.size();

	Json::Value timer_value(Json::arrayValue); // []
	Json::Value row(Json::arrayValue);
	Json::Value rowitem(Json::arrayValue);
	Json::Value rowdata(Json::arrayValue);
	Json::Value ledvalues(Json::arrayValue);
	Json::Value zeile(Json::objectValue);
	//arr_value.append("Test1");
	//arr_value.append("Test2");
	Json::Value obj_value(Json::objectValue);
	for(int i=0; i<size; i++)
	{
		for (int ii=0;ii<TIMERSTORECOUNT;ii++)
		{
			ledvalues.append(LD_StreamListe[i].getLdTimeArray()[ii]);
		}
		zeile["id"]   = LD_StreamListe[i].getLdNumber();
		rowitem.append(LD_StreamListe[i].getLdNumber());
		rowitem.append(LD_StreamListe[i].getLdName());
		rowitem.append(LD_StreamListe[i].getLdI2cChannel());
		rowitem.append(ledvalues);
		rowitem.append(LD_StreamListe[i].getChartColor());
		zeile["cell"] = rowitem;

		root["StreamListe"].append(zeile);
		ledvalues.clear();
		rowitem.clear();
	}
	// version tag into stream
	root["version"] = "2.0";
	root["fooddelay"] = FOOD_DELAY;								// Time in Sec that the streams are in food mode
	root["foodpower"] = FOOD_MIN_POWER;
}
Esempio n. 9
0
int usb_getchar_timed(uint16_t delay)
{
	uint8_t timer_id = 0;

	if (!usb_on)
		return -1;

	timer_id = start_timer(delay);
	
	while (TESTBIT(USB_STATUS, USB_RXE))
		if (timer_id)
			if (!timer_value(timer_id))
			{
				stop_timer(timer_id);
				timer_id = 0;
//				usb_on = 0;
				return -1;
			}

	stop_timer(timer_id);
	timer_id = 0;

	return USB_DATA;
}
Esempio n. 10
0
File: i8x9x.c Progetto: opicron/mame
UINT8 i8x9x_device::io_r8(UINT8 adr)
{
	switch(adr) {
	case 0x00:
		return 0x00;
	case 0x01:
		return 0x00;
	case 0x02:
		return ad_result;
	case 0x03:
		return ad_result >> 8;
	case 0x04:
		logerror("%s: read hsi time l (%04x)\n", tag(), PPC);
		return 0x00;
	case 0x05:
		logerror("%s: read hsi time h (%04x)\n", tag(), PPC);
		return 0x00;
	case 0x06:
		logerror("%s: read hsi status (%04x)\n", tag(), PPC);
		return 0x00;
	case 0x07:
		logerror("%s: read sbuf %02x (%04x)\n", tag(), sbuf, PPC);
		return sbuf;
	case 0x08:
		return PSW;
	case 0x09:
		logerror("%s: read int pending (%04x)\n", tag(), PPC);
		return pending_irq;
	case 0x0a:
		logerror("%s: read timer1 l (%04x)\n", tag(), PPC);
		return timer_value(1, get_cycle());
	case 0x0b:
		logerror("%s: read timer1 h (%04x)\n", tag(), PPC);
		return timer_value(1, get_cycle()) >> 8;
	case 0x0c:
		logerror("%s: read timer2 l (%04x)\n", tag(), PPC);
		return timer_value(2, get_cycle());
	case 0x0d:
		logerror("%s: read timer2 h (%04x)\n", tag(), PPC);
		return timer_value(2, get_cycle()) >> 8;
	case 0x0e: {
		static int last = -1;
		if(io->read_word(P0*2) != last) {
			last = io->read_word(P0*2);
			logerror("%s: read p0 %02x\n", tag(), io->read_word(P0*2));
		}
		return io->read_word(P0*2);
	}
	case 0x0f:
		return io->read_word(P1*2);
	case 0x10:
		return io->read_word(P2*2);
	case 0x11: {
		UINT8 res = sp_stat;
		sp_stat &= 0x80;
		logerror("%s: read sp stat %02x (%04x)\n", tag(), res, PPC);
		return res;
	}
	case 0x15:
		logerror("%s: read ios 0 %02x (%04x)\n", tag(), ios0, PPC);
		return ios0;
	case 0x16: {
		UINT8 res = ios1;
		ios1 = ios1 & 0xc0;
		return res;
	}
	default:
		logerror("%s: io_r8 %02x (%04x)\n", tag(), adr, PPC);
		return 0x00;
	}
}
Esempio n. 11
0
void menu_scan_sensors(void)
{
	static uint8_t scan_mode_on = 1;
	static uint8_t sensor = 0;
	static uint8_t timer_id = 0;

	if (KEY_PRESSED(KEY_ENTER))
	{
		CLEAR_KEY_PRESSED(KEY_ENTER);
		scan_mode_on ^= 0x01;
		beep_ms(50);
	}

	if ((scan_mode_on) && (0 == timer_id))
			timer_id = start_timer(1000);


	if (0 != timer_id)
	{
		if (!timer_value(timer_id))
		{
			stop_timer(timer_id);
			timer_id = 0;

			if (scan_mode_on)
				sensor++;

			if (SENSOR_COUNT <= sensor)
				sensor = 0;
		}
	}

	if (!scan_mode_on)
	{
		if (KEY_PRESSED(KEY_UP))
		{
			CLEAR_KEY_PRESSED(KEY_UP);

			if (0 == sensor)
				sensor = SENSOR_COUNT;

			sensor--;

			beep_ms(50);
		}

		if (KEY_PRESSED(KEY_DOWN))
		{
			CLEAR_KEY_PRESSED(KEY_DOWN);

			sensor++;

			if (SENSOR_COUNT <= sensor)
				sensor = 0;

			beep_ms(50);
		}
	}

	sprintf(lcd_line0, "%s               ", sensor_text[sensor][0]);

	if (SENSOR_FOIL_ENCODER == sensor_id[sensor])
		sprintf(lcd_line1, "%s %u              ",
			(TEST_SENSOR(sensor_id[sensor]))?sensor_text[sensor][1]:sensor_text[sensor][2],
			max_time_counter);

	else if (sensor_id[sensor] < 24) // 24 = primary sensors count
		sprintf(lcd_line1, "%s               ",
			(TEST_SENSOR(sensor_id[sensor]))?sensor_text[sensor][1]:sensor_text[sensor][2]);

	else
		sprintf(lcd_line1, "%s               ",
			(TESTBIT(secondary_sensors, sensor_id[sensor] - 24))?sensor_text[sensor][1]:sensor_text[sensor][2]);

	menu_common();
}
Esempio n. 12
0
static int run_exec_wait(shell_t *shell, shell_argv_t *cmd_argv, char *tag)
{
  int argc = cmd_argv->argc;
  char **argv = cmd_argv->argv;
  listener_t *listener;
  char *s;
  struct timeval tv0;
  long sec, usec;
  int unblock, timeout, error;

  /* Set and check wait timeout */
  run_wait_timeout = run_timeout;
  if ( (argc > 1) && (argv[1][0] == '-') ) {
    if ( timer_value(shell, &(argv[1][1]), NULL, &run_wait_timeout) )
      return -1;
    argv++;
    argc--;
  }

  if ( run_wait_timeout == -1 ) {
    shell_error(shell, "No timeout value initialized. Please use command 'timeout' before 'wait'\n");
    return -1;
  }

  /* Setup wait conditions */
  argv++;
  argc--;
  if ( (listener = listener_new(argc, argv)) == NULL )
    return -1;

  /* Report what we are waiting for */
  s = listener_str(listener);

  if ( debug_flag ) { /* For speedup in non-debug mode */
    debug("Wait: '%s'\n", s);
  }

  result_puts(result_header_engine(tag));
  result_puts(s);
  result_puts("\n");

  free(s);

  /* Init timeout counter */
  gettimeofday(&tv0, NULL);
  sec = run_wait_timeout / 1000;
  usec = (run_wait_timeout % 1000) * 1000;

  /* Wait until an unblocking condition is met */
  unblock = 0;
  timeout = 0;
  error = 0;
  while ( ! (unblock || timeout || error) ) {
    /* Check unblocking conditions */
    if ( listener_check(listener) ) {
      unblock = 1;
    }
    else {
      struct timeval tv1, tv;

      /* Update timeout counter */
      gettimeofday(&tv1, NULL);
      tv_sub(&tv1, &tv0);
      /*fprintf(stderr, "** %ld.%06ld\n", tv1.tv_sec, tv1.tv_usec);*/

      tv.tv_sec = sec;
      tv.tv_usec = usec;
      if ( tv_sub(&tv, &tv1) ) {
        timeout = 1;
      }
      else {
        /*fprintf(stderr, "   %ld.%06ld\n", tv.tv_sec, tv.tv_usec);*/
        /* Wait for events to arrive, and process incoming data */
        switch ( run_wait_event(shell, tag, &tv) ) {
        case -1:
          error = 1;
          break;
        case 0:
          timeout = 1;
          break;
        default :
          break;
        }
      }
    }
  }

  if ( unblock ) {
    run_wait_event_unblock(shell, tag, listener);
  }
  else if ( timeout ) {
    run_wait_event_timeout(shell, tag);
  }

  /* Clear wait conditions */
  listener_destroy(listener);

  return error ? -1 : 0;
}
Esempio n. 13
0
void process_foil(void)
{
	static uint16_t	timer_id = 0;
	

	if (TEST_SOFT_CONTROL(SOFT_CONTROL_FOIL_LED))
	{
		if (0 == timer_id)
		{
			timer_id = start_timer(FOIL_TIMEOUT);
			
			if (TEST_CONTROL(CONTROL_FOIL_LED))
				CONTROL_OFF(CONTROL_FOIL_LED);
			else
				CONTROL_ON(CONTROL_FOIL_LED);
		}
		else
		{
			if (0 == timer_value(timer_id))
			{
				stop_timer(timer_id);
				timer_id = 0;
			}
			else if (timer_value(timer_id) < FOIL_TIMEOUT / 2)
			{
				if (TEST_CONTROL(CONTROL_FOIL_LED))
				{
					if (TEST_SENSOR(SENSOR_END_OF_FOIL))
						SETBIT(soft_sensors, SENSOR_END_OF_FOIL);
					else
						CLEARBIT(soft_sensors, SENSOR_END_OF_FOIL);
				
					if (TEST_SENSOR(SENSOR_PRI_REEL))
						SETBIT(soft_sensors, SENSOR_PRI_REEL);
					else
						CLEARBIT(soft_sensors, SENSOR_PRI_REEL);

					if (TEST_SENSOR(SENSOR_SEC_REEL))
						SETBIT(soft_sensors, SENSOR_SEC_REEL);
					else
						CLEARBIT(soft_sensors, SENSOR_SEC_REEL);
				}
				else
				{
					if (TEST_SENSOR(SENSOR_END_OF_FOIL))
						SETBIT(soft_sensors, ERROR_SENSOR_END_OF_FOIL);
				
					if (TEST_SENSOR(SENSOR_PRI_REEL))
						SETBIT(soft_sensors, ERROR_SENSOR_PRI_REEL);

					if (TEST_SENSOR(SENSOR_SEC_REEL))
						SETBIT(soft_sensors, ERROR_SENSOR_SEC_REEL);
				}
			}
		}
	}
	else
	{
		CONTROL_OFF(CONTROL_FOIL_LED);
		soft_sensors = sensors;
		
		if (0 != timer_id)
			stop_timer(timer_id);
		timer_id = 0;
		
		CLEARBIT(soft_sensors, ERROR_SENSOR_END_OF_FOIL);
		CLEARBIT(soft_sensors, ERROR_SENSOR_PRI_REEL);
		CLEARBIT(soft_sensors, ERROR_SENSOR_SEC_REEL);
	}
}
Esempio n. 14
0
static void __init sun4m_init_timers(void)
{
	struct device_node *dp = of_find_node_by_name(NULL, "counter");
	int i, err, len, num_cpu_timers;
	unsigned int irq;
	const u32 *addr;

	if (!dp) {
		printk(KERN_ERR "sun4m_init_timers: No 'counter' node.\n");
		return;
	}

	addr = of_get_property(dp, "address", &len);
	of_node_put(dp);
	if (!addr) {
		printk(KERN_ERR "sun4m_init_timers: No 'address' prop.\n");
		return;
	}

	num_cpu_timers = (len / sizeof(u32)) - 1;
	for (i = 0; i < num_cpu_timers; i++) {
		timers_percpu[i] = (void __iomem *)
			(unsigned long) addr[i];
	}
	timers_global = (void __iomem *)
		(unsigned long) addr[num_cpu_timers];

	/* Every per-cpu timer works in timer mode */
	sbus_writel(0x00000000, &timers_global->timer_config);

#ifdef CONFIG_SMP
	sparc_config.cs_period = SBUS_CLOCK_RATE * 2;  /* 2 seconds */
	sparc_config.features |= FEAT_L14_ONESHOT;
#else
	sparc_config.cs_period = SBUS_CLOCK_RATE / HZ; /* 1/HZ sec  */
	sparc_config.features |= FEAT_L10_CLOCKEVENT;
#endif
	sparc_config.features |= FEAT_L10_CLOCKSOURCE;
	sbus_writel(timer_value(sparc_config.cs_period),
	            &timers_global->l10_limit);

	master_l10_counter = &timers_global->l10_count;

	irq = sun4m_build_device_irq(NULL, SUN4M_TIMER_IRQ);

	err = request_irq(irq, timer_interrupt, IRQF_TIMER, "timer", NULL);
	if (err) {
		printk(KERN_ERR "sun4m_init_timers: Register IRQ error %d.\n",
			err);
		return;
	}

	for (i = 0; i < num_cpu_timers; i++)
		sbus_writel(0, &timers_percpu[i]->l14_limit);
	if (num_cpu_timers == 4)
		sbus_writel(SUN4M_INT_E14, &sun4m_irq_global->mask_set);

#ifdef CONFIG_SMP
	{
		unsigned long flags;
		struct tt_entry *trap_table = &sparc_ttable[SP_TRAP_IRQ1 + (14 - 1)];

		/* For SMP we use the level 14 ticker, however the bootup code
		 * has copied the firmware's level 14 vector into the boot cpu's
		 * trap table, we must fix this now or we get squashed.
		 */
		local_irq_save(flags);
		trap_table->inst_one = lvl14_save[0];
		trap_table->inst_two = lvl14_save[1];
		trap_table->inst_three = lvl14_save[2];
		trap_table->inst_four = lvl14_save[3];
		local_ops->cache_all();
		local_irq_restore(flags);
	}
#endif
}
Esempio n. 15
0
static void sun4m_load_profile_irq(int cpu, unsigned int limit)
{
	unsigned int value = limit ? timer_value(limit) : 0;
	sbus_writel(value, &timers_percpu[cpu]->l14_limit);
}
Esempio n. 16
0
//
// Gathering results from all threads and reporting them back to Iometer.
//
void Manager::Report_Results(int which_perf)
{
	if ((which_perf < 0) || (which_perf >= MAX_PERF))
		return;

	// Shortcut pointers to where results are stored.
	Worker_Results *worker_results;

	// If recording, update the ending results for the system performance.
	if (record) {
		Get_Performance(which_perf, LAST_SNAPSHOT);
	}
	// Copy the current system results into a message.
	memcpy((void *)&data_msg.data.manager_results, (void *)
	       &(manager_performance[which_perf]), sizeof(Manager_Results));
	if (IsBigEndian()) {
		(void)reorder(data_msg, DATA_MESSAGE_MANAGER_RESULTS, SEND);
	}
#if defined (IOMTR_OS_LINUX) && defined (IOMTR_CPU_XSCALE)
	Manager_Results_double_swap(&data_msg.data.manager_results);
#endif
	prt->Send(&data_msg, DATA_MESSAGE_SIZE);

	// Sending back a result message for each worker thread.  Using multiple
	// messages keeps the message size down to a reasonable limit.
	worker_results = &(data_msg.data.worker_results);
	for (int g = 0; g < grunt_count; g++) {
		// Only send results for grunts that are running.
		if (grunts[g]->target_count && !grunts[g]->idle) {
#ifdef _DEBUG
			cout << "Reporting results for grunt " << g << " ...";
#endif
			// Copying worker's results into the message.
			memcpy((void *)worker_results, (void *)&(grunts[g]->worker_performance),
			       sizeof(Worker_Results));
			worker_results->target_results.count = grunts[g]->target_count;

			// If recording, update the ending results for the worker's drive performance.
			if (grunts[g]->grunt_state == TestRecording) {
				worker_results->time[LAST_SNAPSHOT] = timer_value();
			}

			if (which_perf == LAST_UPDATE_PERF) {
				// Subtract previous update's results from current results to give 
				// results since last update.

				Raw_Result *target_result;
				Raw_Result *prev_target_result;
				int i;

				worker_results->time[FIRST_SNAPSHOT] =
				    grunts[g]->prev_worker_performance.time[LAST_SNAPSHOT];

				for (i = 0; i < worker_results->target_results.count; i++) {
					target_result = &(worker_results->target_results.result[i]);
					prev_target_result
					    = &(grunts[g]->prev_worker_performance.target_results.result[i]);

					// Subtract current result from each counter.
					target_result->bytes_read -= prev_target_result->bytes_read;
					target_result->bytes_written -= prev_target_result->bytes_written;
					target_result->read_count -= prev_target_result->read_count;
					target_result->write_count -= prev_target_result->write_count;
					target_result->transaction_count -= prev_target_result->transaction_count;
					target_result->connection_count -= prev_target_result->connection_count;
					target_result->read_errors -= prev_target_result->read_errors;
					target_result->write_errors -= prev_target_result->write_errors;
					target_result->read_latency_sum -= prev_target_result->read_latency_sum;
					target_result->write_latency_sum -= prev_target_result->write_latency_sum;
					target_result->transaction_latency_sum
					    -= prev_target_result->transaction_latency_sum;
					target_result->connection_latency_sum
					    -= prev_target_result->connection_latency_sum;
					target_result->counter_time -= prev_target_result->counter_time;

					// Use values from prev_worker_performance for "max_" values.
					target_result->max_raw_read_latency = prev_target_result->max_raw_read_latency;
					target_result->max_raw_write_latency
					    = prev_target_result->max_raw_write_latency;
					target_result->max_raw_transaction_latency
					    = prev_target_result->max_raw_transaction_latency;
					target_result->max_raw_connection_latency
					    = prev_target_result->max_raw_connection_latency;
				}

				// Store away a copy of the current results for next time.
				memcpy(&(grunts[g]->prev_worker_performance), &(grunts[g]->worker_performance),
				       sizeof(Worker_Results));

				// Record time of last update.
				grunts[g]->prev_worker_performance.time[LAST_SNAPSHOT] = timer_value();

				// Clear "max_" values in prev_worker_performance.
				for (i = 0; i < worker_results->target_results.count; i++) {
					Raw_Result *prev_target_result
					    = &(grunts[g]->prev_worker_performance.target_results.result[i]);

					prev_target_result->max_raw_read_latency = 0;
					prev_target_result->max_raw_write_latency = 0;
					prev_target_result->max_raw_transaction_latency = 0;
					prev_target_result->max_raw_connection_latency = 0;
				}
			}
			// Sending results to Iometer.
			if (IsBigEndian()) {
				(void)reorder(data_msg, DATA_MESSAGE_WORKER_RESULTS, SEND);
			}
			prt->Send(&data_msg, DATA_MESSAGE_SIZE);
#ifdef _DEBUG
			cout << "sent." << endl;
#endif
		}
	}

	if (record && (which_perf == LAST_UPDATE_PERF)) {
		// Store current performance counters as baseline for next update.
		Get_Performance(LAST_UPDATE_PERF, FIRST_SNAPSHOT);
	}
#ifdef _DEBUG
	cout << "   Finished reporting results." << endl;
#endif
}