Exemplo n.º 1
0
void out_t::helper_t<sizeval_t>::print(
	out_t &out, sizeval_t const &s, char const *fmt
) {
	unsigned short int prec = 63;

	if(fmt) {
		if(*fmt == '.') {
			prec = 0;
			++fmt;
			while(*fmt >= '0' && *fmt <= '9') (prec *= 10) += (*(fmt++) - '0');
		}
		if(!prec) prec = 63;
	}
	else {
		out.print((uint64_t)s);
		return;
	}

	if(s == sizeval::unlimited) {
		out(CSTR("unlimited"));
	} else if(s) {
		if(((s - (s % sizeval::exa)) >> prec) >= (s % sizeval::exa)) {
			out.print((uint64_t)(s / sizeval::exa))('E');
		}
		else if(((s - (s % sizeval::peta)) >> prec) >= (s % sizeval::peta)) {
			out.print((uint64_t)(s / sizeval::peta))('P');
		}
		else if(((s - (s % sizeval::tera)) >> prec) >= (s % sizeval::tera)) {
Exemplo n.º 2
0
void phantom_t::config_t::stat_print(out_t &out, bool force_total) {
	bool stat_clear = stat.clear && !force_total;

	out(CSTR("time\t")).print(
		timeval_current(), stat.time_format == full ? "+dz" : "+"
	);

	if(!stat_clear)
		out(CSTR("\t(total)"));

	out.lf();

	for(typeof(stat.list.ptr()) ptr = stat.list; ptr; ++ptr) {
		obj_t *obj = ptr.val();
		out.lf()(CSTR("** "))(obj->name).lf();
		obj->stat(out, stat_clear);
		out.lf();
	}

/*
	if(stat.system) {
		bq_stack_pool_info_t info = bq_stack_pool_get_info();

		out
			.lf()
			(CSTR("stack pool: "))
			.print(info.wsize)('/')
			.print(info.size).lf().lf()
		;
	}
 */
}
Exemplo n.º 3
0
void out_t::helper_t<netaddr_ipv4_t>::print(
	out_t &out, netaddr_ipv4_t const &netaddr, char const *
) {
	if(netaddr)
		out.print(netaddr.address())(':').print(netaddr.port());
	else
		out(CSTR("<unset>"));
}
Exemplo n.º 4
0
void out_t::helper_t<string_t>::print(
    out_t &out, string_t const &string, char const *fmt
) {
    out.print(string.str(), fmt);
}
Exemplo n.º 5
0
void netaddr_ipv4_t::print(out_t &out, char const *) const {
	out.print(*this);
}