tools: display satisfied and unsatisfied interests counters
refs: #4720
Change-Id: I69c2400a558997ff48f2b66883cc680dc497360a
diff --git a/docs/_static/nfd-status.xsd b/docs/_static/nfd-status.xsd
index 89d07bb..0052162 100644
--- a/docs/_static/nfd-status.xsd
+++ b/docs/_static/nfd-status.xsd
@@ -43,6 +43,8 @@
<xs:element type="xs:nonNegativeInteger" name="nMeasurementsEntries"/>
<xs:element type="xs:nonNegativeInteger" name="nCsEntries"/>
<xs:element type="nfd:bidirectionalPacketCountersType" name="packetCounters"/>
+ <xs:element type="xs:nonNegativeInteger" name="nSatisfiedInterests"/>
+ <xs:element type="xs:nonNegativeInteger" name="nUnsatisfiedInterests"/>
</xs:sequence>
</xs:complexType>
diff --git a/tests/tools/nfdc/forwarder-general-module.t.cpp b/tests/tools/nfdc/forwarder-general-module.t.cpp
index b621bb4..ed87b71 100644
--- a/tests/tools/nfdc/forwarder-general-module.t.cpp
+++ b/tests/tools/nfdc/forwarder-general-module.t.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California,
+ * Copyright (c) 2014-2018, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -60,26 +60,30 @@
<nNacks>26762</nNacks>
</outgoingPackets>
</packetCounters>
+ <nSatisfiedInterests>123</nSatisfiedInterests>
+ <nUnsatisfiedInterests>321</nUnsatisfiedInterests>
</generalStatus>
)XML");
const std::string STATUS_TEXT = std::string(R"TEXT(
General NFD status:
- version=0.4.1-1-g704430c
- startTime=20160624T151346.856000
- currentTime=20160717T175554.109000
- uptime=1996927 seconds
- nNameTreeEntries=668
- nFibEntries=70
- nPitEntries=7
- nMeasurementsEntries=1
- nCsEntries=65536
- nInInterests=20699052
- nOutInterests=36501092
- nInData=5598070
- nOutData=5671942
- nInNacks=7230
- nOutNacks=26762
+ version=0.4.1-1-g704430c
+ startTime=20160624T151346.856000
+ currentTime=20160717T175554.109000
+ uptime=1996927 seconds
+ nNameTreeEntries=668
+ nFibEntries=70
+ nPitEntries=7
+ nMeasurementsEntries=1
+ nCsEntries=65536
+ nInInterests=20699052
+ nOutInterests=36501092
+ nInData=5598070
+ nOutData=5671942
+ nInNacks=7230
+ nOutNacks=26762
+ nSatisfiedInterests=123
+ nUnsatisfiedInterests=321
)TEXT").substr(1);
BOOST_AUTO_TEST_CASE(Status)
@@ -99,7 +103,9 @@
.setNInNacks(7230)
.setNOutInterests(36501092)
.setNOutData(5671942)
- .setNOutNacks(26762);
+ .setNOutNacks(26762)
+ .setNSatisfiedInterests(123)
+ .setNUnsatisfiedInterests(321);
this->sendDataset("/localhost/nfd/status/general", payload);
this->prepareStatusOutput();
diff --git a/tools/nfd-status-http-server-files/nfd-status.xsl b/tools/nfd-status-http-server-files/nfd-status.xsl
index d9a996c..0b50985 100644
--- a/tools/nfd-status-http-server-files/nfd-status.xsl
+++ b/tools/nfd-status-http-server-files/nfd-status.xsl
@@ -112,6 +112,8 @@
<th>Out Data</th>
<th>In Nacks</th>
<th>Out Nacks</th>
+ <th>Satisfied Interests</th>
+ <th>Unsatisfied Interests</th>
</tr>
</thead>
<tbody>
@@ -131,6 +133,8 @@
<td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nData"/></td>
<td><xsl:value-of select="nfd:packetCounters/nfd:incomingPackets/nfd:nNacks"/></td>
<td><xsl:value-of select="nfd:packetCounters/nfd:outgoingPackets/nfd:nNacks"/></td>
+ <td><xsl:value-of select="nfd:packetCounters/nfd:nSatisfiedInterests"/></td>
+ <td><xsl:value-of select="nfd:packetCounters/nfd:nUnsatisfiedInterests"/></td>
</tr>
</tbody>
</table>
diff --git a/tools/nfdc/forwarder-general-module.cpp b/tools/nfdc/forwarder-general-module.cpp
index e0d6b1b..417b346 100644
--- a/tools/nfdc/forwarder-general-module.cpp
+++ b/tools/nfdc/forwarder-general-module.cpp
@@ -88,6 +88,9 @@
<< "</outgoingPackets>";
os << "</packetCounters>";
+ os << "<nSatisfiedInterests>" << item.getNSatisfiedInterests() << "</nSatisfiedInterests>";
+ os << "<nUnsatisfiedInterests>" << item.getNUnsatisfiedInterests() << "</nUnsatisfiedInterests>";
+
os << "</generalStatus>";
}
@@ -102,7 +105,7 @@
void
ForwarderGeneralModule::formatItemText(std::ostream& os, const ForwarderStatus& item)
{
- text::ItemAttributes ia(true, 20);
+ text::ItemAttributes ia(true, 21);
os << ia("version") << item.getNfdVersion()
<< ia("startTime") << text::formatTimestamp(item.getStartTimestamp())
@@ -120,7 +123,9 @@
<< ia("nInData") << item.getNInData()
<< ia("nOutData") << item.getNOutData()
<< ia("nInNacks") << item.getNInNacks()
- << ia("nOutNacks") << item.getNOutNacks();
+ << ia("nOutNacks") << item.getNOutNacks()
+ << ia("nSatisfiedInterests") << item.getNSatisfiedInterests()
+ << ia("nUnsatisfiedInterests") << item.getNUnsatisfiedInterests();
os << ia.end();
}