Пример #1
0
static void svr_finalize(
    svr_state * ns,
    tw_lp * lp)
{
    printf("server %llu : size:%d requests:%d time:%lf rate:%lf\n",
           (unsigned long long)lp->gid,
           PAYLOAD_SZ,
           NUM_REQS,
           ns_to_s((tw_now(lp)-ns->start_ts)),
           (double)(PAYLOAD_SZ*NUM_REQS)/(1024.0*1024.0)/ns_to_s((tw_now(lp)-ns->start_ts)));
    return;
}
Пример #2
0
static void node_finalize(node_state *ns, tw_lp *lp) {
  int node_dim_id[3];
  int dim_lens[3] = {10, 10, 10};
  model_net_torus_get_dim_id(codes_mapping_get_lp_relative_id(lp->gid, 0, 1), 3, dim_lens, node_dim_id); //hard-coded
  int dist = find_node_distance(node_dim_id, ns->dest_dim_id);
  printf("^ node %llu received %d bytes in %lf seconds, %lf MiB/s sent_count %d recvd_count %d avgLatency %lf sent to a server %d hops away \n",
	 (unsigned long long)(codes_mapping_get_lp_relative_id(lp->gid,0,1)),
	 payload_sz*ns->msg_recvd_count,
	 ns_to_s(ns->end_ts-ns->start_ts),
	 ((double)(payload_sz*num_reqs)/(double)(1024*1024)/ns_to_s(ns->end_ts-ns->start_ts)),
	 ns->msg_sent_count,
	 ns->msg_recvd_count,
	 ns->total_ts/((double)ns->msg_sent_count)/1000.0, 
	 dist);
  return;
}
static void svr_finalize(
    svr_state * ns,
    tw_lp * lp)
{
    printf("server %llu recvd %d bytes in %f seconds, %f MiB/s sent_count %d recvd_count %d local_count %d \n", (unsigned long long)lp->gid, PAYLOAD_SZ*ns->msg_recvd_count, ns_to_s(ns->end_ts-ns->start_ts), 
        ((double)(PAYLOAD_SZ*NUM_REQS)/(double)(1024*1024)/ns_to_s(ns->end_ts-ns->start_ts)), ns->msg_sent_count, ns->msg_recvd_count, ns->local_recvd_count);
    return;
}
Пример #4
0
void SleepFor(Duration d) noexcept {
    if (d <= 0) {
        return;
    }
    long long s = ns_to_s(d);
    timespec ts;
    ts.tv_sec = static_cast<time_t>(s);
    ts.tv_nsec = static_cast<long>(d - s_to_ns(s));
    while (nanosleep(&ts, &ts) == -1 && errno == EINTR);
}
/**
 * Check the number of requests processed (TODO) and computes write overhead for storage and BB
 * @Params ns node state
 * 		   m message
 * 		   lp LP
 */
void node_finalize(node_state * ns, tw_lp * lp) {
	// do some error checking - here, we ensure we got the expected number of
	// messages
	printf("In node_finalize\n");
	int mult;
	if (ns->is_in_client) {
		mult = 1;
	} else /*if(ns->is_in_server)*/{
		//printf("num_svr_nodes is %d\n",num_svr_nodes);
		mult = (num_client_nodes / num_svr_nodes)
				+ ((num_client_nodes % num_svr_nodes) > ns->id_clust);
	}
	if (ns->num_processed != num_reqs * mult) {
		fprintf(stderr, "%s node %d, lp %lu: processed %d (expected %d)\n",
				ns->is_in_client ? "client" : "svr", ns->id_clust, lp->gid,
				ns->num_processed, num_reqs * mult);
	}

	//float io_noise = 0.05 * tw_rand_integer(lp->rng,ns->pvfs_ts_remote_write,ns->pvfs_ts_remote_write);
	float io_noise = ns->pvfs_ts_remote_write
			* ((float) tw_rand_integer(lp->rng, 0.0, 5.0)) / 100.0;

	/*  printf("--------	Random number : %f	------\n",((float) tw_rand_integer(lp->rng,0.0,100.0))/100.0);
	 printf("--------	Remote write latecy : %f	-------\n",(float) ns->pvfs_ts_remote_write );
	 printf("--------	IO Noise : %f	------\n",io_noise);*/
	float io_noise_bb = 0.05
			* tw_rand_integer(lp->rng, ns->bb_ts_local_write,
					ns->bb_ts_local_write);

	long rand_idx = 0;
	//printf("num_svr_nodes is %d\n",num_svr_nodes);
	int dest_id = (lp->gid + rand_idx * 2) % (num_svr_nodes * 2);
	printf("Server %llu time = %f seconds.\n", (unsigned long long) lp->gid,
			ns_to_s(tw_now(lp) - ns->start_ts) + io_noise);

	return;
}