Beispiel #1
0
int main (void) {
	cpg_handle_t handle;
	unsigned int size;
	int i;
	unsigned int res;

	size = 1000;
	signal (SIGALRM, sigalrm_handler);
	res = cpg_initialize (&handle, &callbacks);
	if (res != CS_OK) {
		printf ("cpg_initialize failed with result %d\n", res);
		exit (1);
	}

	res = cpg_join (handle, &group_name);
	if (res != CS_OK) {
		printf ("cpg_join failed with result %d\n", res);
		exit (1);
	}

	for (i = 0; i < 50; i++) { /* number of repetitions - up to 50k */
		cpg_benchmark (handle, size);
		signal (SIGALRM, sigalrm_handler);
		size += 1000;
	}

	res = cpg_finalize (handle);
	if (res != CS_OK) {
		printf ("cpg_join failed with result %d\n", res);
		exit (1);
	}
	return (0);
}
Beispiel #2
0
int main (void) {
	unsigned int size;
	int i;
	unsigned int res;

	qb_util_set_log_function(libqb_log_writer);

	size = 64;
	signal (SIGALRM, sigalrm_handler);
	res = cpg_initialize (&handle, &callbacks);
	if (res != CS_OK) {
		printf ("cpg_initialize failed with result %d\n", res);
		exit (1);
	}
	pthread_create (&thread, NULL, dispatch_thread, NULL);

	res = cpg_join (handle, &group_name);
	if (res != CS_OK) {
		printf ("cpg_join failed with result %d\n", res);
		exit (1);
	}

	for (i = 0; i < 10; i++) { /* number of repetitions - up to 50k */
		cpg_benchmark (handle, size);
		signal (SIGALRM, sigalrm_handler);
		size *= 8;
		if (size >= (ONE_MEG - 100)) {
			break;
		}
	}

	res = cpg_finalize (handle);
	if (res != CS_OK) {
		printf ("cpg_finalize failed with result %d\n", res);
		exit (1);
	}
	return (0);
}