tools: Visualize per-face link-layer byte counts in nfd-status
refs #1768
Change-Id: Ic70567501903f6d386a9dc5fdc81e70eeb8c5fd7
diff --git a/tools/nfd-status-http-server-files/nfd-status.xsl b/tools/nfd-status-http-server-files/nfd-status.xsl
index 37038c5..e7cc55a 100644
--- a/tools/nfd-status-http-server-files/nfd-status.xsl
+++ b/tools/nfd-status-http-server-files/nfd-status.xsl
@@ -143,8 +143,10 @@
<th>Local URI</th>
<th>In Interests</th>
<th>In Data</th>
+ <th>In Bytes</th>
<th>Out Interests</th>
<th>Out Data</th>
+ <th>Out Bytes</th>
</tr>
</thead>
<tbody>
@@ -163,8 +165,10 @@
<td><xsl:value-of select="nfd:localUri"/></td>
<td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nInterests"/></td>
<td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nDatas"/></td>
+ <td><xsl:value-of select="nfd:byteCounters/nfd:incomingBytes"/></td>
<td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nInterests"/></td>
<td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nDatas"/></td>
+ <td><xsl:value-of select="nfd:byteCounters/nfd:outgoingBytes"/></td>
</tr>
</xsl:for-each>
</tbody>
diff --git a/tools/nfd-status.cpp b/tools/nfd-status.cpp
index affd2d8..3262a28 100644
--- a/tools/nfd-status.cpp
+++ b/tools/nfd-status.cpp
@@ -401,6 +401,13 @@
std::cout << "</outgoingPackets>";
std::cout << "</packetCounters>";
+ std::cout << "<byteCounters>";
+ std::cout << "<incomingBytes>" << faceStatus.getNInBytes()
+ << "</incomingBytes>";
+ std::cout << "<outgoingBytes>" << faceStatus.getNOutBytes()
+ << "</outgoingBytes>";
+ std::cout << "</byteCounters>";
+
if (faceStatus.getFlags() != 0) {
std::cout << "<flags>";
if (faceStatus.isLocal()) {
@@ -444,9 +451,11 @@
}
std::cout << " counters={"
<< "in={" << faceStatus.getNInInterests() << "i "
- << faceStatus.getNInDatas() << "d}"
+ << faceStatus.getNInDatas() << "d "
+ << faceStatus.getNInBytes() << "B}"
<< " out={" << faceStatus.getNOutInterests() << "i "
- << faceStatus.getNOutDatas() << "d}"
+ << faceStatus.getNOutDatas() << "d "
+ << faceStatus.getNOutBytes() << "B}"
<< "}";
if (faceStatus.isLocal())
std::cout << " local";