bmcpt.c   bmcpt.c 
skipping to change at line 66 skipping to change at line 66
} \ } \
} while (0) } while (0)
static void bm_start(struct bm_ctx *ctx) static void bm_start(struct bm_ctx *ctx)
{ {
gettimeofday(&ctx->tv1, NULL); gettimeofday(&ctx->tv1, NULL);
} }
static void bm_finish(struct bm_ctx *ctx, const char *operation, int32_t si ze) static void bm_finish(struct bm_ctx *ctx, const char *operation, int32_t si ze)
{ {
float ops_per_sec;
float mbs_per_sec;
gettimeofday(&ctx->tv2, NULL); gettimeofday(&ctx->tv2, NULL);
timersub(&ctx->tv2, &ctx->tv1, &ctx->tv_elapsed); timersub(&ctx->tv2, &ctx->tv1, &ctx->tv_elapsed);
ops_per_sec = ctx->mbs =
((float)ctx->counter) / (((float)ctx->tv_elapsed.tv_sec) +
(((float)ctx->tv_elapsed.tv_usec) /
1000000.0));
mbs_per_sec =
((((float)ctx->counter) * size) / ((((float)ctx->counter) * size) /
(((float)ctx->tv_elapsed.tv_sec) + (((float)ctx->tv_elapsed.tv_sec) +
(((float)ctx->tv_elapsed.tv_usec) / 1000000.0))) / (1024.0 * (((float)ctx->tv_elapsed.tv_usec) / 1000000.0))) / (1024.0 *
1024.0); 1024.0);
ctx->mbs = ops_per_sec;
} }
static void bmc_connect(struct bm_ctx *ctx) static void bmc_connect(struct bm_ctx *ctx)
{ {
ctx->conn = qb_ipcc_connect("bm1", QB_MAX(1000 * (100 + THREADS), ctx->conn = qb_ipcc_connect("bm1", QB_MAX(1000 * (100 + THREADS),
1024*1024)); 1024*1024));
if (ctx->conn == NULL) { if (ctx->conn == NULL) {
perror("qb_ipcc_connect"); perror("qb_ipcc_connect");
exit(-1); exit(-1);
} }
} }
static void bmc_disconnect(struct bm_ctx *ctx) static void bmc_disconnect(struct bm_ctx *ctx)
{ {
qb_ipcc_disconnect(ctx->conn); qb_ipcc_disconnect(ctx->conn);
} }
static char buffer[1024 * 1024]; struct my_req {
struct qb_ipc_request_header hdr;
char message[1024 * 1024];
};
static struct my_req request;
static int32_t bmc_send_nozc(struct bm_ctx *ctx, uint32_t size) static int32_t bmc_send_nozc(struct bm_ctx *ctx, uint32_t size)
{ {
struct qb_ipc_request_header *req_header = (struct qb_ipc_request_he ader *)buffer;
struct qb_ipc_response_header res_header; struct qb_ipc_response_header res_header;
int32_t res; int32_t res;
req_header->id = QB_IPC_MSG_USER_START + 3; request.hdr.id = QB_IPC_MSG_USER_START + 3;
req_header->size = sizeof(struct qb_ipc_request_header) + size; request.hdr.size = sizeof(struct qb_ipc_request_header) + size;
repeat_send: repeat_send:
res = qb_ipcc_send(ctx->conn, req_header, req_header->size); res = qb_ipcc_send(ctx->conn, &request, request.hdr.size);
if (res < 0) { if (res < 0) {
if (res == -EAGAIN) { if (res == -EAGAIN) {
goto repeat_send; goto repeat_send;
} else if (res == -EINVAL || res == -EINTR) { } else if (res == -EINVAL || res == -EINTR) {
perror("qb_ipcc_send"); perror("qb_ipcc_send");
return -1; return -1;
} else { } else {
errno = -res; errno = -res;
perror("qb_ipcc_send"); perror("qb_ipcc_send");
goto repeat_send; goto repeat_send;
skipping to change at line 174 skipping to change at line 169
int32_t main(void) int32_t main(void)
{ {
struct bm_ctx bm_ctx[THREADS]; struct bm_ctx bm_ctx[THREADS];
pthread_t threads[THREADS]; pthread_t threads[THREADS];
pthread_attr_t thread_attr[THREADS]; pthread_attr_t thread_attr[THREADS];
int32_t i, j; int32_t i, j;
float total_mbs; float total_mbs;
void *retval; void *retval;
for (i = 0; i < THREADS; i++) {
bm_ctx[i].mbs = 0;
}
signal(SIGALRM, sigalrm_handler); signal(SIGALRM, sigalrm_handler);
for (j = 0; j < 500; j++) { for (j = 0; j < 500; j++) {
alarm_notice = 0; alarm_notice = 0;
alarm(3); alarm(3);
for (i = 0; i < THREADS; i++) { for (i = 0; i < THREADS; i++) {
bm_ctx[i].multi = j + 100; bm_ctx[i].multi = j + 100;
bm_ctx[i].counter = 0; bm_ctx[i].counter = 0;
pthread_attr_init(&thread_attr[i]); pthread_attr_init(&thread_attr[i]);
pthread_attr_setdetachstate(&thread_attr[i], pthread_attr_setdetachstate(&thread_attr[i],
 End of changes. 8 change blocks. 
16 lines changed or deleted 14 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/