Ejemplo n.º 1
0
/* Adjusts default_width for fields with potentially large numbers */
void adjust_field_widths(xenstat_domain *domain)
{
	unsigned int length;

	if (show_full_name) {
		length = strlen(xenstat_domain_name(domain));
		if (length > fields[FIELD_NAME-1].default_width)
			fields[FIELD_NAME-1].default_width = length;
	}

	length = INT_FIELD_WIDTH((tot_net_bytes(domain, FALSE)/1024) + 1);
	if (length > fields[FIELD_NET_TX-1].default_width)
		fields[FIELD_NET_TX-1].default_width = length;

	length = INT_FIELD_WIDTH((tot_net_bytes(domain, TRUE)/1024) + 1);
	if (length > fields[FIELD_NET_RX-1].default_width)
		fields[FIELD_NET_RX-1].default_width = length;

	length = INT_FIELD_WIDTH((tot_vbd_reqs(domain, FIELD_VBD_RD)) + 1);
	if (length > fields[FIELD_VBD_RD-1].default_width)
		fields[FIELD_VBD_RD-1].default_width = length;

	length = INT_FIELD_WIDTH((tot_vbd_reqs(domain, FIELD_VBD_WR)) + 1);
	if (length > fields[FIELD_VBD_WR-1].default_width)
		fields[FIELD_VBD_WR-1].default_width = length;

	length = INT_FIELD_WIDTH((tot_vbd_reqs(domain, FIELD_VBD_RSECT)) + 1);
	if (length > fields[FIELD_VBD_RSECT-1].default_width)
		fields[FIELD_VBD_RSECT-1].default_width = length;

	length = INT_FIELD_WIDTH((tot_vbd_reqs(domain, FIELD_VBD_WSECT)) + 1);
	if (length > fields[FIELD_VBD_WSECT-1].default_width)
		fields[FIELD_VBD_WSECT-1].default_width = length;
}
Ejemplo n.º 2
0
/* Prints number of total network rx bytes statistic */
static void print_net_rx(xenstat_domain *domain)
{
	print("%8llu", tot_net_bytes(domain, TRUE)/1024);
}
Ejemplo n.º 3
0
/* Compares number of total network rx bytes of two domains, returning -1,0,1
 * for <,=,> */
static int compare_net_rx(xenstat_domain *domain1, xenstat_domain *domain2)
{
	return -compare(tot_net_bytes(domain1, TRUE),
	                tot_net_bytes(domain2, TRUE));
}
Ejemplo n.º 4
0
/* Prints number of total network tx bytes statistic */
static void print_net_tx(xenstat_domain *domain)
{
	print("%8llu", tot_net_bytes(domain, FALSE)/1024);
}
Ejemplo n.º 5
0
/* Compares number of total network tx bytes of two domains, returning -1,0,1
 * for <,=,> */
static int compare_net_tx(xenstat_domain *domain1, xenstat_domain *domain2)
{
	return -compare(tot_net_bytes(domain1, FALSE),
	                tot_net_bytes(domain2, FALSE));
}
Ejemplo n.º 6
0
/* Prints number of total network rx bytes statistic */
static void print_net_rx(xenstat_domain *domain)
{
	print("%*llu", fields[FIELD_NET_RX-1].default_width, tot_net_bytes(domain, TRUE)/1024);
}