예제 #1
0
파일: ipcclient.c 프로젝트: beekhof/libqb
static void
do_throughput_benchmark(qb_ipcc_connection_t *conn)
{
	ssize_t size = 64;
	int i;

	signal (SIGALRM, sigalrm_handler);

	for (i = 0; i < 10; i++) { /* number of repetitions - up to 50k */
		_benchmark (conn, size);
		signal (SIGALRM, sigalrm_handler);
		size *= 5;
		if (size >= (ONE_MEG - 100)) {
			break;
		}
	}
}
예제 #2
0
파일: rbwriter.c 프로젝트: AnchorCat/libqb
static void
do_throughput_benchmark(void)
{
	ssize_t size = 64;
	int i;

	signal (SIGALRM, sigalrm_handler);
	sw =  qb_util_stopwatch_create();

	for (i = 0; i < 10; i++) { /* number of repetitions - up to 50k */
		_benchmark(size);
		signal (SIGALRM, sigalrm_handler);
		size *= 5;
		if (size >= ONE_MEG) {
			break;
		}
	}
}
예제 #3
0
static void
_game_init()
{
    r_console_print(PACKAGE_STRING " linux x-86\n");
    r_console_print(R_CONSOLE_PROMPT);

    r_game_window_set_title(TITLE);
    r_game_window_set_resizeable(TRUE);
    r_game_window_set_grab_input(FALSE);
    r_game_window_resize(WIDTH, HEIGHT);

    r_game_signal_connect(
        "game_quit",
        (RGameCallback)_quit
        );
    r_game_signal_connect(
        "console_quit",
        (RGameCallback) _quit
        );
    r_game_signal_connect(
        "resource_manager_load",
        (RGameCallback) resources_load
        );
    r_game_signal_connect(
        "renderer_scene_setup",
        (RGameCallback) renderer_scene_setup
        );
    r_game_signal_connect(
        "renderer_scene_render",
        (RGameCallback) renderer_scene_render
        );

    g_timeout_add(20, engine, NULL);
    g_timeout_add(20, ai, NULL);
    g_timeout_add(10, physic, NULL);

    g_idle_add(_nice, NULL);

    _benchmark(NULL);
    g_timeout_add_seconds(5, _benchmark, NULL);
}
예제 #4
0
INT_PTR CALLBACK
_benchmark_dlg_proc(
		HWND	hwnd,
		UINT	message,
		WPARAM	wparam,
		LPARAM	lparam
	)
{
	switch ( message )
	{
		case WM_CLOSE :
		{
			__lists[HBENCHMARK] = HWND_NULL;

			EndDialog( hwnd, 0 );
			return 0L;
		}
		break;

		case WM_COMMAND :
		{
			int code = HIWORD(wparam);			
			int id = LOWORD(wparam);

			if ( ( id == IDOK ) || ( id == IDCANCEL ) )
			{
				EndDialog( hwnd, 0 );
			}
			if ( id == IDB_REFRESH_TEST )
			{
				HWND h_button = GetDlgItem( hwnd, IDB_REFRESH_TEST );

				SetCursor( __cur_wait );
				EnableWindow( h_button, FALSE );
				{
					bench_item bench[CF_CIPHERS_NUM];

					wchar_t s_speed[50];
					int cnt;

					int lvcount = 0;
					int k = 0;

					cnt  = _benchmark(pv(&bench));
					ListView_DeleteAllItems( __lists[HBENCHMARK] );
						
					for ( k = 0; k < cnt; k++ )
					{
						_list_insert_item( __lists[HBENCHMARK], lvcount, 0, bench[k].alg, 0 );
						_list_set_item( __lists[HBENCHMARK], lvcount, 1, STR_EMPTY );

						_snwprintf( s_speed, sizeof_w(s_speed), L"%-.2f mb/s", bench[k].speed );
						_list_set_item( __lists[HBENCHMARK], lvcount++, 2, s_speed );
					}
				}
				EnableWindow( h_button, TRUE );
				SetCursor( __cur_arrow );
			}
		}
		break;

		case WM_INITDIALOG : 
		{
			__lists[HBENCHMARK] = GetDlgItem( hwnd, IDC_LIST_BENCHMARK );
			_init_list_headers( __lists[HBENCHMARK], _benchmark_headers );

			ListView_SetBkColor( __lists[HBENCHMARK], GetSysColor(COLOR_BTNFACE) );
			ListView_SetTextBkColor( __lists[HBENCHMARK], GetSysColor(COLOR_BTNFACE) );
			ListView_SetExtendedListViewStyle( __lists[HBENCHMARK], LVS_EX_FLATSB | LVS_EX_FULLROWSELECT );

			SetForegroundWindow(hwnd);

			_sub_class(GetDlgItem(hwnd, IDC_BUTTON), SUB_STATIC_PROC, HWND_NULL);
			return 1L;
		}
		break;

		case WM_CTLCOLOREDIT :
		{
			return (
				_ctl_color(wparam, _cl(COLOR_BTNFACE, LGHT_CLR))
			);
		}
		break;

		default:
		{
			int rlt = _draw_proc(message, lparam);
			if (rlt != -1)
			{
				return rlt;
			}
		}
	}
	return 0L;

}