示例#1
0
文件: pool.c 项目: UNGLinux/Obase
void
showpool(int k)
{
	struct pool_info *p = pools + k;

	if (k < 0 || k >= num_pools)
		return;

	print_fld_str(FLD_POOL_NAME, p->name);
	print_fld_uint(FLD_POOL_SIZE, p->pool.pr_size);

	print_fld_size(FLD_POOL_REQS, p->pool.pr_nget);
	print_fld_size(FLD_POOL_FAIL, p->pool.pr_nfail);
	print_fld_ssize(FLD_POOL_INUSE, p->pool.pr_nget - p->pool.pr_nput);
	print_fld_size(FLD_POOL_PGREQ, p->pool.pr_npagealloc);
	print_fld_size(FLD_POOL_PGREL, p->pool.pr_npagefree);

	print_fld_size(FLD_POOL_NPAGE, p->pool.pr_npages);
	print_fld_size(FLD_POOL_HIWAT, p->pool.pr_hiwat);
	print_fld_size(FLD_POOL_MINPG, p->pool.pr_minpages);

	if (p->pool.pr_maxpages == UINT_MAX)
		print_fld_str(FLD_POOL_MAXPG, "inf");
	else
		print_fld_size(FLD_POOL_MAXPG, p->pool.pr_maxpages);

	print_fld_size(FLD_POOL_IDLE, p->pool.pr_nidle);

	end_line();
}
示例#2
0
文件: mbufs.c 项目: SylvestreG/bitrig
static void
showmbuf(struct if_info *ifi, int p, int showif)
{
	if (showif)
		print_fld_str(FLD_MB_IFACE, ifi->name);

	if (p == -1 && ifi == interfaces) {
		print_fld_uint(FLD_MB_LLOCKS, mcllivelocks_diff);
		print_fld_size(FLD_MB_MSIZE, mbpool.pr_size);
		print_fld_size(FLD_MB_MALIVE, mbpool.pr_nget - mbpool.pr_nput);
		print_fld_size(FLD_MB_MHWM, mbpool.pr_hiwat);
	}

	if (p >= 0 && p < mclpool_count) {
		struct if_rxring_info *ifr = &ifi->data.ifri_entries[p];
		struct if_rxring *rxr= &ifr->ifr_info;
		print_fld_uint(FLD_MB_MSIZE, ifr->ifr_size);
		print_fld_uint(FLD_MB_MALIVE, rxr->rxr_alive);
		if (rxr->rxr_lwm)
			print_fld_size(FLD_MB_MLWM, rxr->rxr_lwm);
		if (rxr->rxr_hwm)
			print_fld_size(FLD_MB_MHWM, rxr->rxr_hwm);
		if (rxr->rxr_cwm)
			print_fld_size(FLD_MB_MCWM, rxr->rxr_cwm);
	}

	end_line();
}
示例#3
0
void
showtotal(void)
{
	double rsum, wsum, rtsum, wtsum, mssum;
	int dn;

	rsum = wsum = rtsum = wtsum = mssum = 0.0;

	for (dn = 0; dn < cur.dk_ndrive; dn++) {
		rsum += cur.dk_rbytes[dn] / etime;
		wsum += cur.dk_wbytes[dn] / etime;
		rtsum += cur.dk_rxfer[dn] / etime;
		wtsum += cur.dk_wxfer[dn] / etime;
		mssum += ATIME(cur.dk_time, dn) / etime;
	}

	print_fld_str(FLD_IO_DEVICE, "Totals");
	print_fld_size(FLD_IO_READ, rsum);
	print_fld_size(FLD_IO_WRITE, wsum);
	print_fld_size(FLD_IO_RTPS, rtsum);
	print_fld_size(FLD_IO_WTPS, wtsum);
	print_fld_float(FLD_IO_SEC, mssum, 1);

	end_line();
}
示例#4
0
文件: netstat.c 项目: UNGLinux/Obase
void
print_ns(void)
{
	int n, count = 0;

	if (kd == NULL) {
		print_fld_str(FLD_NS_LOCAL, "Failed to initialize KVM!");
		print_fld_str(FLD_NS_FOREIGN, "Failed to initialize KVM!");
		end_line();
		return;
	}

	for (n = dispstart; n < num_disp; n++) {
		shownetstat(netinfos + n);
		count++;
		if (maxprint > 0 && count >= maxprint)
			break;
	}
}
示例#5
0
void
showbcache(void)
{
	print_fld_str(FLD_IO_SSTR, "total bufs");
	print_fld_ssize(FLD_IO_SVAL, bccur.numbufs);
	end_line();

	print_fld_str(FLD_IO_SSTR, "total pages");
	print_fld_ssize(FLD_IO_SVAL, bccur.numbufpages);
	end_line();

	print_fld_str(FLD_IO_SSTR, "dirty pages");
	print_fld_ssize(FLD_IO_SVAL, bccur.numdirtypages);
	end_line();

	print_fld_str(FLD_IO_SSTR, "delwri bufs");
	print_fld_ssize(FLD_IO_SVAL, bccur.delwribufs);
	end_line();

	print_fld_str(FLD_IO_SSTR, "busymap bufs");
	print_fld_ssize(FLD_IO_SVAL, bccur.busymapped);
	end_line();

	print_fld_str(FLD_IO_SSTR, "avail kvaslots");
	print_fld_ssize(FLD_IO_SVAL, bccur.kvaslots_avail);
	end_line();

	print_fld_str(FLD_IO_SSTR, "kvaslots");
	print_fld_ssize(FLD_IO_SVAL, bccur.kvaslots);
	end_line();

	print_fld_str(FLD_IO_SSTR, "pending writes");
	print_fld_ssize(FLD_IO_SVAL, bccur.pendingwrites);
	end_line();

	print_fld_str(FLD_IO_SSTR, "pending reads");
	print_fld_ssize(FLD_IO_SVAL, bccur.pendingreads);
	end_line();

	print_fld_str(FLD_IO_SSTR, "cache hits");
	print_fld_ssize(FLD_IO_SVAL, bccur.cachehits - bclast.cachehits);
	end_line();
}
示例#6
0
void
showtype(int k)
{
	struct type_info *t = types + k;

	if (k < 0 || k >= num_types)
		return;


	print_fld_str(FLD_TYPE_NAME, t->name ? t->name : "undefined");
	print_fld_size(FLD_TYPE_INUSE, t->stats.ks_inuse);
	print_fld_size(FLD_TYPE_MEMUSE, t->stats.ks_memuse);
	print_fld_size(FLD_TYPE_HIGHUSE, t->stats.ks_maxused);
	print_fld_size(FLD_TYPE_LIMIT, t->stats.ks_limit);
	print_fld_size(FLD_TYPE_REQUESTS, t->stats.ks_calls);
	print_fld_size(FLD_TYPE_TLIMIT, t->stats.ks_limblocks);
	print_fld_size(FLD_TYPE_KLIMIT, t->stats.ks_mapblocks);
	print_fld_str(FLD_TYPE_SIZES, t->buckets);

	end_line();
}
示例#7
0
void
showdrive(int dn)
{
	print_fld_str(FLD_IO_DEVICE, cur.dk_name[dn]);
	print_fld_size(FLD_IO_READ, cur.dk_rbytes[dn]/etime);
	print_fld_size(FLD_IO_WRITE, cur.dk_wbytes[dn]/ etime);
	print_fld_size(FLD_IO_RTPS, cur.dk_rxfer[dn] / etime);
	print_fld_size(FLD_IO_WTPS, cur.dk_wxfer[dn] / etime);
	print_fld_float(FLD_IO_SEC, ATIME(cur.dk_time, dn) / etime, 1);

	end_line();
}
示例#8
0
文件: if.c 项目: UNGLinux/Obase
static void
showifstat(struct ifstat *ifs)
{
	int conv = show_bits ? 8 : 1;
	int div = show_bits ? 1000 : 1024;

	print_fld_str(FLD_IF_IFACE, ifs->ifs_name);

	tb_start();
	tbprintf("%s", ifs->ifs_cur.ifc_flags & IFF_UP ?
		 "up" : "dn");

	switch (ifs->ifs_cur.ifc_state) {
	case LINK_STATE_UP:
	case LINK_STATE_HALF_DUPLEX:
	case LINK_STATE_FULL_DUPLEX:
		tbprintf(":U");
		break;
	case LINK_STATE_DOWN:
		tbprintf (":D");
		break;
	}

	print_fld_tb(FLD_IF_STATE);

	print_fld_str(FLD_IF_DESC, ifs->ifs_description);

	print_fld_sdiv(FLD_IF_IBYTES, ifs->ifs_cur.ifc_ib * conv, div);
	print_fld_size(FLD_IF_IPKTS, ifs->ifs_cur.ifc_ip);
	print_fld_size(FLD_IF_IERRS, ifs->ifs_cur.ifc_ie);

	print_fld_sdiv(FLD_IF_OBYTES, ifs->ifs_cur.ifc_ob * conv, div);
	print_fld_size(FLD_IF_OPKTS, ifs->ifs_cur.ifc_op);
	print_fld_size(FLD_IF_OERRS, ifs->ifs_cur.ifc_oe);

	print_fld_size(FLD_IF_COLLS, ifs->ifs_cur.ifc_co);

	end_line();
}
示例#9
0
文件: pf.c 项目: UNGLinux/Obase
void
print_fld_double(field_def *fld, double val)
{
	int len;

	if (fld == NULL)
		return;

	len = fld->width;
	if (len < 1)
		return;

	tb_start();
	if (tbprintf("%.2f", val) > len)
		print_fld_str(fld, "*");
	else
		print_fld_tb(fld);
	tb_end();
}
示例#10
0
文件: if.c 项目: UNGLinux/Obase
static void
showtotal(void)
{
	int conv = show_bits ? 8 : 1;
	int div = show_bits ? 1000 : 1024;

	print_fld_str(FLD_IF_IFACE, "Totals");

	print_fld_sdiv(FLD_IF_IBYTES, sum.ifc_ib * conv, div);
	print_fld_size(FLD_IF_IPKTS, sum.ifc_ip);
	print_fld_size(FLD_IF_IERRS, sum.ifc_ie);

	print_fld_sdiv(FLD_IF_OBYTES, sum.ifc_ob * conv, div);
	print_fld_size(FLD_IF_OPKTS, sum.ifc_op);
	print_fld_size(FLD_IF_OERRS, sum.ifc_oe);

	print_fld_size(FLD_IF_COLLS, sum.ifc_co);

	end_line();

}
示例#11
0
文件: netstat.c 项目: UNGLinux/Obase
static void
shownetstat(struct netinfo *p)
{
	switch (p->nif_family) {
	case AF_INET:
		inetprint(&p->nif_laddr, p->nif_lport,
			  p->nif_proto, FLD_NS_LOCAL);
		inetprint(&p->nif_faddr, p->nif_fport,
			  p->nif_proto, FLD_NS_FOREIGN);
		break;
	case AF_INET6:
		inet6print(&p->nif_laddr6, p->nif_lport,
			   p->nif_proto, FLD_NS_LOCAL);
		inet6print(&p->nif_faddr6, p->nif_fport,
			   p->nif_proto, FLD_NS_FOREIGN);
		break;
	}
 
	tb_start();
	tbprintf("%s", p->nif_proto);
	if (p->nif_family == AF_INET6)
		tbprintf("6");

	print_fld_tb(FLD_NS_PROTO);

	print_fld_size(FLD_NS_RECV_Q, p->nif_rcvcc);
	print_fld_size(FLD_NS_SEND_Q, p->nif_sndcc);

	if (streq(p->nif_proto, "tcp")) {
		if (p->nif_state < 0 || p->nif_state >= TCP_NSTATES)
			print_fld_uint(FLD_NS_STATE, p->nif_state);
		else
			print_fld_str(FLD_NS_STATE, tcpstates[p->nif_state]);
	}
	end_line();
}