Beispiel #1
0
void NetRunInfo::show()
{
	struct timeval cur_timeval;
	gettimeofday(&cur_timeval, NULL);

	//total:%d(updata:%d, online:%d, commret:%d), fail total:%d, current average:%d/s
	//µ¥Î»ÊÇms
	long long timeval = (cur_timeval.tv_sec - _btimeval.tv_sec) * 1000
			+ ((cur_timeval.tv_usec - _btimeval.tv_usec) / 1000) + 1;

	long long avg_send_num = _cur_send_num.value() * 1000 / timeval;
	long long avg_recv_num = _cur_recv_num.value() * 1000 / timeval;
	long long avg_send_total = _cur_send_total_size.value() * 1000 / timeval;
	long long avg_recv_total = _cur_recv_total_size.value() * 1000 / timeval;

	_cur_send_num.reset();
	_cur_recv_num.reset();
	_cur_send_total_size.reset();
	_cur_recv_total_size.reset();
	gettimeofday(&_btimeval, NULL);

	char buffer[256] = { 0 };
	snprintf(buffer, sizeof(buffer) - 1,
			"send(avg:%lld/s flux %s/s, total:%lld, send size:%s), recv(avg:%lld/s flux %s/s, total:%lld, recv size:%s)", avg_send_num,
			host_size(avg_send_total).c_str(), _send_num.value(), host_size(_send_total_size.value()).c_str(),
			avg_recv_num, host_size(avg_recv_total).c_str(), _recv_num.value(),
			host_size(_recv_total_size.value()).c_str());



	dlog1("%s", buffer);
}
Beispiel #2
0
	CUGIP_DECL_HYBRID int
	size()
	{
		#if __CUDA_ARCH__
			return device_size();
		#else
			return host_size();
		#endif
	}