int i, j;
struct stats_net_dev *sndc, *sndp;
int sep = FALSE;
+ double rxkb, txkb, ifutil;
if (!IS_SELECTED(a->options) || (a->nr <= 0))
goto close_json_markup;
}
sep = TRUE;
+ rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
+ txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
+ ifutil = compute_ifutil(sndc, rxkb, txkb);
+
xprintf0(tab, "{\"iface\": \"%s\", "
"\"rxpck\": %.2f, "
"\"txpck\": %.2f, "
"\"txkB\": %.2f, "
"\"rxcmp\": %.2f, "
"\"txcmp\": %.2f, "
- "\"rxmcst\": %.2f}",
+ "\"rxmcst\": %.2f, "
+ "\"ifutil-percent\": %.2f}",
sndc->interface,
S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
- S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv) / 1024,
- S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv) / 1024,
+ rxkb / 1024,
+ txkb / 1024,
S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
- S_VALUE(sndp->multicast, sndc->multicast, itv));
+ S_VALUE(sndp->multicast, sndc->multicast, itv),
+ ifutil);
}
printf("\n");
{
int i, j;
struct stats_net_dev *sndc, *sndp;
+ double rxkb, txkb, ifutil;
int pt_newlin
= (DISPLAY_HORIZONTALLY(flags) ? PT_NOFLAG : PT_NEWLIN);
S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
NULL);
+ rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
render(isdb, pre, PT_NOFLAG,
"%s\trxkB/s", NULL,
cons(sv, sndc->interface, NULL),
NOVAL,
- S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv) / 1024,
+ rxkb / 1024,
NULL);
+ txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
render(isdb, pre, PT_NOFLAG,
"%s\ttxkB/s", NULL,
cons(sv, sndc->interface, NULL),
NOVAL,
- S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv) / 1024,
+ txkb / 1024,
NULL);
render(isdb, pre, PT_NOFLAG,
S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
NULL);
- render(isdb, pre, pt_newlin,
+ render(isdb, pre, PT_NOFLAG,
"%s\trxmcst/s", NULL,
cons(sv, sndc->interface, NULL),
NOVAL,
S_VALUE(sndp->multicast, sndc->multicast, itv),
NULL);
+
+ ifutil = compute_ifutil(sndc, rxkb, txkb);
+ render(isdb, pre, pt_newlin,
+ "%s\t%%ifutil", NULL,
+ cons(sv, sndc->interface, NULL),
+ NOVAL,
+ ifutil,
+ NULL);
}
}
#include "sa.h"
/* DTD version for XML output */
-#define XML_DTD_VERSION "2.16"
+#define XML_DTD_VERSION "2.17"
/* Possible actions for functions used to display reports */
#define F_BEGIN 0x01
<?xml version="1.0" encoding="UTF-8"?>
-<!--DTD v2.16 for sysstat. See sadf.h -->
+<!--DTD v2.17 for sysstat. See sadf.h -->
<!ELEMENT sysstat (sysdata-version, host)>
rxcmp CDATA #REQUIRED
txcmp CDATA #REQUIRED
rxmcst CDATA #REQUIRED
+ ifutil-percent CDATA #REQUIRED
>
<!ELEMENT net-edev EMPTY>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://pagesperso-orange.fr/sebastien.godard/sysstat" targetNamespace="http://pagesperso-orange.fr/sebastien.godard/sysstat" elementFormDefault="qualified">
<xs:annotation>
- <xs:appinfo>-- XML Schema v2.16 for sysstat. See sadf.h --</xs:appinfo>
+ <xs:appinfo>-- XML Schema v2.17 for sysstat. See sadf.h --</xs:appinfo>
</xs:annotation>
<xs:element name="sysstat" type="sysstat-type"></xs:element>
<xs:attribute name="rxcmp" type="hundredth-type"></xs:attribute>
<xs:attribute name="txcmp" type="hundredth-type"></xs:attribute>
<xs:attribute name="rxmcst" type="hundredth-type"></xs:attribute>
+ <xs:attribute name="ifutil-percent" type="hundredth-type"></xs:attribute>
</xs:complexType>
<xs:element name="net-edev" type="net-edev-type"></xs:element>
{
int i, j;
struct stats_net_dev *sndc, *sndp;
+ double rxkb, txkb, ifutil;
if (!IS_SELECTED(a->options) || (a->nr <= 0))
goto close_xml_markup;
j = check_net_dev_reg(a, curr, !curr, i);
sndp = (struct stats_net_dev *) ((char *) a->buf[!curr] + j * a->msize);
+ rxkb = S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv);
+ txkb = S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv);
+ ifutil = compute_ifutil(sndc, rxkb, txkb);
+
xprintf(tab, "<net-dev iface=\"%s\" "
"rxpck=\"%.2f\" "
"txpck=\"%.2f\" "
"txkB=\"%.2f\" "
"rxcmp=\"%.2f\" "
"txcmp=\"%.2f\" "
- "rxmcst=\"%.2f\"/>",
+ "rxmcst=\"%.2f\" "
+ "ifutil-percent=\"%.2f\"/>",
sndc->interface,
S_VALUE(sndp->rx_packets, sndc->rx_packets, itv),
S_VALUE(sndp->tx_packets, sndc->tx_packets, itv),
- S_VALUE(sndp->rx_bytes, sndc->rx_bytes, itv) / 1024,
- S_VALUE(sndp->tx_bytes, sndc->tx_bytes, itv) / 1024,
+ rxkb / 1024,
+ txkb / 1024,
S_VALUE(sndp->rx_compressed, sndc->rx_compressed, itv),
S_VALUE(sndp->tx_compressed, sndc->tx_compressed, itv),
- S_VALUE(sndp->multicast, sndc->multicast, itv));
+ S_VALUE(sndp->multicast, sndc->multicast, itv),
+ ifutil);
}
tab--;