Exemple #1
0
/*
 *  performance evaluation routine
 */
void
perf_eval(uint_t n)
{
	uint_t		i;
	intptr_t	data;
	PRI			pri;

	ini_pdq(PDQ1);
	init_hist(1, MAX_TIME, histarea1);

	for (i = 0; i < n; i++) {
		data = i;
		snd_pdq(PDQ1, data, 1);
	}

	for (i = 0; i < NO_MEASURE; i++) {
		data = i;
		begin_measure(1);
		snd_pdq(PDQ1, data, 2);
		end_measure(1);
		rcv_pdq(PDQ1, &data, &pri);
	}

	syslog_1(LOG_NOTICE, "Execution times of snd_pdq"
								" when %d data are queued.", n);
	print_hist(1);
	syslog_flush();
}
Exemple #2
0
/*
 *  システムログタスクの本体
 */
void
logtask_main(intptr_t exinf)
{
	SYSLOG	logbuf;
	uint_t	lostlog;
	ER_UINT	rercd;

	logtask_portid = (ID) exinf;
	(void) serial_opn_por(logtask_portid);
	(void) syslog_msk_log(LOG_UPTO(LOG_NOTICE), LOG_UPTO(LOG_EMERG));
	syslog_1(LOG_NOTICE, "System logging task is started on port %d.",
													logtask_portid);
	for (;;) {
		lostlog = 0U;
		while ((rercd = syslog_rea_log(&logbuf)) >= 0) {
			lostlog += (uint_t) rercd;
			if (logbuf.logtype >= LOG_TYPE_COMMENT) {
				if (lostlog > 0U) {
					syslog_lostmsg(lostlog, logtask_putc);
					lostlog = 0U;
				}
				syslog_print(&logbuf, logtask_putc);
				logtask_putc('\n');
			}
		}
		if (lostlog > 0U) {
			syslog_lostmsg(lostlog, logtask_putc);
		}
		(void) dly_tsk(LOGTASK_INTERVAL);
	}
}
Exemple #3
0
/*
 *  システムログタスクの本体
 */
void
logtask_main(intptr_t exinf)
{
	SYSLOG	syslog;
	uint_t	lost;
	ER_UINT	rercd;
	ID my_logtask_portid;

	my_logtask_portid = (ID) exinf;
	set_my_logtask_portid(my_logtask_portid);
	serial_opn_por(my_logtask_portid);
	syslog_msk_log(LOG_UPTO(LOG_NOTICE), LOG_UPTO(LOG_EMERG));
	syslog_1(LOG_NOTICE, "System logging task is started on port %d.",
													my_logtask_portid);
	for (;;) {
		lost = 0U;
		while ((rercd = syslog_rea_log(&syslog)) >= 0) {
			lost += (uint_t) rercd;
			if (syslog.logtype >= LOG_TYPE_COMMENT) {
				if (lost > 0U) {
					syslog_lostmsg(lost, logtask_putc);
					lost = 0U;
				}
				syslog_print(&syslog, logtask_putc);
				logtask_putc('\n');
			}
		}
		if (lost > 0U) {
			syslog_lostmsg(lost, logtask_putc);
		}
		if(E_OK != dly_tsk(LOGTASK_INTERVAL)){
			syslog_0(LOG_NOTICE, "syslog : Error dly_tsk() !");
		}
	}
}
Exemple #4
0
/*
 * 未定義の例外が入った場合の処理
 */
void
default_exc_handler(void){
	ID prc_id = ID_PRC(x_prc_index());

	syslog_1(LOG_EMERG, "Processor %d : Unregistered Exception occurs.", prc_id);
	target_exit();
}
Exemple #5
0
/*
 *  計測ルーチン
 */
void
perf_eval(uint_t n)
{
	uint_t		i, j;

	init_hist(1, MAX_TIME, histarea1);

	sus_tsk(LOGTASK);		/* システムログタスクの動作を止める */
	for (i = 0; i < NO_MEASURE; i++) {
		ini_flg(FLG1);
		for (j = 0; j < n; j++) {
			act_tsk(task_list[j]);
		}
		chg_pri(TSK_SELF, MAIN_PRIORITY_LOW);
		/* タスクが待ち状態に入るのを待つ */
		chg_pri(TSK_SELF, TPRI_INI);

		begin_measure(1);
		set_flg(FLG1, 0x01U);
		end_measure(1);

		chg_pri(TSK_SELF, MAIN_PRIORITY_LOW);
		/* タスクが終了するのを待つ */
		chg_pri(TSK_SELF, TPRI_INI);
	}
	rsm_tsk(LOGTASK);		/* システムログタスクの動作を再開する */

	syslog_1(LOG_NOTICE, "Execution times of set_flg"
							" when %d tasks are released from waiting.", n);
	print_hist(1);
	logtask_flush(0U);
}
/*
 *  アラームハンドラ
 */
void alarm_handler(intptr_t exinf)
{
	/*
	 *  アラームハンドラは実行されないはず
	 */
	syslog_1(LOG_NOTICE, "alarm handler %d executed.", exinf);
}
Exemple #7
0
/*
 *  FatFs用SDCARDIO制御関数
 */
DRESULT
disk_ioctl(BYTE Drive, BYTE Func, void* Buffer)
{
	StorageDevice_t *psdev = SDMGetStorageDevice(Drive);
	DRESULT         result;

	if(psdev == NULL)
		return RES_ERROR;
	if((psdev->_sdev_attribute & (SDEV_EMPLOY|SDEV_NOTUSE)) != SDEV_EMPLOY)
		return RES_ERROR;
	switch(Func){
	case CTRL_SYNC:
		result = RES_OK;			/* no action */
		break;
	case GET_SECTOR_COUNT:
		*((DWORD *)Buffer) = psdev->_sdev_maxsec;
		syslog_2(LOG_NOTICE, "ioctl notuse (%d)(%d) ", (int)Func, psdev->_sdev_maxsec);
		result = RES_OK;
		break;
	case GET_BLOCK_SIZE:
		*((DWORD *)Buffer) = 135;	/* ERASE_BLK */
		syslog_1(LOG_NOTICE, "call disk_ioctl(GET_BLOCK_SIZE, %08x)", (int)(*((DWORD *)Buffer)));
		result = RES_OK;
		break;
	default:
		syslog_2(LOG_NOTICE, "call disk_ioctl(%d, %08x)", (int)psdev->_sdev_devno, (int)Buffer);
		slp_tsk();
		result = RES_PARERR;
		break;
	}
	return result;
}
Exemple #8
0
/*
 *  performance evaluation routine
 */
void
perf_eval(uint_t n)
{
	uint_t		i, j;

	init_hist(1, MAX_TIME, histarea1);

	for (i = 0; i < NO_MEASURE; i++) {
		ini_flg(FLG1);
		for (j = 0; j < n; j++) {
			act_tsk(task_list[j]);
		}
		chg_pri(TSK_SELF, MAIN_PRIORITY_LOW);
		/* let the task in the waiting queue of the event flag */
		chg_pri(TSK_SELF, TPRI_INI);

		begin_measure(1);
		set_flg(FLG1, 0x01U);
		end_measure(1);

		chg_pri(TSK_SELF, MAIN_PRIORITY_LOW);
		/* wait the task exits */
		chg_pri(TSK_SELF, TPRI_INI);
	}

	syslog_1(LOG_NOTICE, "Execution times of set_flg"
							" when %d tasks are released from waiting.", n);
	print_hist(1);
	syslog_flush();
}
/*
 *	チェックポイント
 */
void
check_point(uint_t count)
{
	bool_t	errorflag = false;
	ER		rercd;
	SIL_PRE_LOC;

	/*
	 *  割込みロック状態に
	 */
	SIL_LOC_INT();

	/*
	 *  シーケンスチェック
	 */
	if (++check_count == count) {
		syslog_1(LOG_NOTICE, "Check point %d passed.", count);
	}
	else {
		syslog_1(LOG_ERROR, "## Unexpected check point %d.", count);
		errorflag = true;
	}

	/*
	 *  カーネルの内部状態の検査
	 */
	if (check_bit_func != NULL) {
		rercd = (*check_bit_func)();
		if (rercd < 0) {
			syslog_2(LOG_ERROR, "## Internal inconsistency detected (%s, %d).",
								itron_strerror(rercd), SERCD(rercd));
			errorflag = true;
		}
	}

	/*
	 *  エラーが検出された場合は,テストプログラムを終了する.
	 */
	if (errorflag) {
		test_finish();
	}

	/*
	 *  割込みロック状態を解除
	 */
	SIL_UNL_INT();
}
Exemple #10
0
/*
 *  実行時間分布計測の表示(受け口関数)
 */
ER
eHistogram_print(CELLIDX idx)
{
	CELLCB	*p_cellcb = GET_CELLCB(idx);
	uint_t	i;

	for (i = 0; i <= ATTR_maxTime; i++) {
		if (VAR_histarea[i] > 0) {
			syslog_2(LOG_NOTICE, "%d : %d", i, VAR_histarea[i]);
		}
	}
	if (VAR_over > 0) {
		syslog_2(LOG_NOTICE, "> %d : %d", ATTR_maxTime, VAR_over);
	}
	if (VAR_under > 0) {
		syslog_1(LOG_NOTICE, "> INT_MAX : %d", VAR_under);
	}
	return(E_OK);
}
Exemple #11
0
/*
 *	完了チェックポイント
 */
void
check_finish(uint_t count)
{
	volatile uint_t i, j;
	volatile uint_t flag;
	ID       prcid;

	/*
	 *  PRCID取得
	 */
	sil_get_pid(&prcid);

	check_point(count);
	syslog_1(LOG_NOTICE, "PE %d : All check points passed.", prcid);

	/*
	 * ext_ker()発行前に全プロセッサの同期をとる
	 */
	check_finish_enter[prcid - 1] = 1;

	if (prcid == TOPPERS_MASTER_PRCID) {
		do{
			flag = 0;
			for(i = 0; i < TNUM_PRCID; i++){
				if (check_finish_enter[i] == 1){
					flag++;
				}
			}
			for (j = 0; j < 100; j++);
		}while (flag < TNUM_PRCID);
		check_finish_leave = 1;
	}
	else {
		while (check_finish_leave != 1) {
			for (j = 0; j < 100; j++);
		}
	}

	test_finish();
}
Exemple #12
0
/*
 *  実行時間分布計測の表示
 */
void
print_hist(ID histid)
{
	HISTCB	*p_histcb;
	uint_t	i;

	assert(TMIN_HISTID <= histid && histid <= TMAX_HISTID);
	p_histcb = &(histcb_table[histid - TMIN_HISTID]);

	for (i = 0; i <= p_histcb->maxval; i++) {
		if (p_histcb->histarea[i] > 0) {
			syslog_2(LOG_NOTICE, "%d : %d", i, p_histcb->histarea[i]);
			syslog_flush();
		}
	}
	if (p_histcb->over > 0) {
		syslog_2(LOG_NOTICE, "> %d : %d", p_histcb->maxval, p_histcb->over);
	}
	if (p_histcb->under > 0) {
		syslog_1(LOG_NOTICE, "> INT_MAX : %d", p_histcb->under);
	}
	syslog_flush();
}