コード例 #1
0
ファイル: tiletimes.cpp プロジェクト: rubenvereecken/PyALE
int main(void)
{
    timeval t1, t2;
    float t;
    timetest(runit, runit_ct, "Standard test", "2 floats",100,4);
    timetest(runit2,runit2_ct, "Testing with more input variables","4 floats, 2 ints", 100, 3, 32768);
    timetest(runitw,runitw_ct, "WRAP version", "2 floats",100,4);
    timetest(runitl,runitl_ct, "Load version", "2 floats", 10, 4); //# only do 10 x 10 calls, but with 4 tilings each
    timetest(runitlw,runitlw_ct, "Load WRAP version", "2 floats", 10, 4);
    return 0;
}
コード例 #2
0
ファイル: stopwatch_test.c プロジェクト: charlesxiong/algo-ds
/**
 * 重复测试: 运行大量的测试数,减小系统本身的误差
 * 测试次数越多,每次测试所需的平均时间就越接近于真实的平均数据
 */
double multitests(char *alg,int n,int tests){
   double total=0.0;
   int i;
   for(i=0;i<tests;i++){
      total +=timetest(alg,n);
   }
   return total/tests;
}
コード例 #3
0
ファイル: binsearch_test.c プロジェクト: nsbcnjsbc/algo-ds
/*多次测试*/
double multitests(char *alg,item_t *arr,int len,item_t x,int tests){
	double total=0.0;
	int i;
    for(i=0;i<tests;i++){
      total += timetest(alg,arr,len,x);
    }
   return total;
}
コード例 #4
0
ファイル: testtime.c プロジェクト: Gnomik2004/libnet
int main()
{
  timetest();
  return 0;
}
コード例 #5
0
ファイル: replay.c プロジェクト: clockfort/bingehack4
void
replay_commandloop(int fd)
{
    int key, move, count;
    char buf[BUFSZ], qbuf[BUFSZ];
    nh_bool ret, firsttime = TRUE;
    struct nh_replay_info rinfo;
    struct nh_cmd_arg noarg;
    struct nh_cmd_desc *cmd;

    create_game_windows();
    if (!nh_view_replay_start(fd, &curses_replay_windowprocs, &rinfo))
        return;
    load_keymap();

    while (1) {
        draw_msgwin();
        curses_update_status(NULL);
        draw_sidebar();
        draw_replay_info(&rinfo);
        if (firsttime)
            show_replay_help();
        firsttime = FALSE;

        key = get_map_key(TRUE);
        switch (key) {
            /* step forward */
        case KEY_RIGHT:
        case ' ':
            ret = nh_view_replay_step(&rinfo, REPLAY_FORWARD, 1);
            draw_replay_info(&rinfo);
            if (ret == FALSE) {
                key =
                    curses_msgwin("You have reached the end of this game. "
                                  "Go back or press ESC to exit.");
                if (key == KEY_ESC)
                    goto out;
            }
            break;

            /* step backward */
        case KEY_LEFT:
            nh_view_replay_step(&rinfo, REPLAY_BACKWARD, 1);
            draw_replay_info(&rinfo);
            break;

        case KEY_ESC:
            goto out;

        case 'g':
            strncpy(qbuf, "What move do you want to jump to?", BUFSZ);
            if (rinfo.max_moves > 0)
                sprintf(qbuf + strlen(qbuf), " (Max: %d)", rinfo.max_moves);

            curses_getline(qbuf, buf);
            if (buf[0] == '\033' || !(move = atoi(buf)))
                break;
            nh_view_replay_step(&rinfo, REPLAY_GOTO, move);
            break;

        case KEY_F(12):        /* timetest! */
            if (allow_timetest())
                timetest(fd, &rinfo);
            break;

        default:
            count = 0;
            noarg.argtype = CMD_ARG_NONE;
            cmd = keymap[key];
            if (!cmd)
                break;
            if (cmd->flags & CMD_UI)
                handle_internal_cmd(&cmd, &noarg, &count);
            if (cmd)
                nh_command(cmd->name, count, &noarg);
            break;
        }
    }

out:
    nh_view_replay_finish();
    free_keymap();
    destroy_game_windows();
    cleanup_messages();
}
コード例 #6
0
ファイル: ltest.c プロジェクト: cbh34680/tmb
void timetest()
{

// 調査時刻
	time_t chktime;

	struct tm tt =
	{
	// 1
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=59, .tm_sec=55,
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=59, .tm_sec=56,
	// 2
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=59, .tm_sec=55,
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=59, .tm_sec=56,
	// 3
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=59, .tm_sec=55,
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=59, .tm_sec=56,
	// 4
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=11, .tm_hour=23, .tm_min=59, .tm_sec=55,
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=11, .tm_hour=23, .tm_min=59, .tm_sec=56,
	// 5
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=30, .tm_sec=25,
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=30, .tm_sec=26,
	// 6
		//.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=30, .tm_sec=25,
		.tm_year=2015-1900, .tm_mon=5-1, .tm_mday=2, .tm_hour=2, .tm_min=30, .tm_sec=26,
	};

	chktime = mktime(&tt);

printtime("chk", chktime);

// 予約時刻
	struct tmb_frame_t frame =
	{
		.frametype=TMB_FRAMETYPE_REPT,
		.cyctm=
		{
		// 1
			//.cycletype=TMB_CYCLETYPE_YEARLY, .dt={ .mon=5, .day=2, .hour=3, .min=0, .sec=0, },
		// 2
			//.cycletype=TMB_CYCLETYPE_MONTHLY, .dt={ .day=2, .hour=3, .min=0, .sec=0, },
		// 3
			//.cycletype=TMB_CYCLETYPE_DAILY, .dt={ .hour=3, .min=0, .sec=0, },
		// 4
			//.cycletype=TMB_CYCLETYPE_WEEKLY, .dt={ .day=2, .hour=0, .min=0, .sec=0, },
		// 5
			//.cycletype=TMB_CYCLETYPE_HOURLY, .dt={ .min=30, .sec=30, },
		// 6
			.cycletype=TMB_CYCLETYPE_PERMINUTE, .dt={ .sec=30, },
		},
	};

//
	time_t nexttime = tmb_calc_nexttime(&frame, chktime);

printtime("nxt", nexttime);
}

int main()
{
	//strtest();
	timetest();

	return 0;
}