Commit 8e5bbd43b0e92bf8843bd3bf96a2fd15abc4883f
1 parent
c49e1c132d
Exists in
master
Fixed pit entry counter.
Showing 4 changed files with 11 additions and 9 deletions Side-by-side Diff
NFD/daemon/table/pit-entry.cpp
View file @
8e5bbd4
... | ... | @@ -36,6 +36,8 @@ |
36 | 36 | const Name Entry::LOCALHOST_NAME("ndn:/localhost"); |
37 | 37 | const Name Entry::LOCALHOP_NAME("ndn:/localhop"); |
38 | 38 | |
39 | +uint32_t Entry::n_pit_entries = 0; | |
40 | + | |
39 | 41 | Entry::Entry(const Interest& interest) |
40 | 42 | : m_interest(interest.shared_from_this()) |
41 | 43 | , m_shadowEntry(false) |
... | ... | @@ -147,10 +149,6 @@ |
147 | 149 | InRecordCollection::iterator |
148 | 150 | Entry::insertOrUpdateInRecord(shared_ptr<Face> face, const Interest& interest, bool isShadowRecord=false) |
149 | 151 | { |
150 | - if (!isShadowRecord) | |
151 | - { | |
152 | - n_pit_entries++; | |
153 | - } | |
154 | 152 | bool newRecord = false; |
155 | 153 | auto it = std::find_if(m_inRecords.begin(), m_inRecords.end(), |
156 | 154 | [&face] (const InRecord& inRecord) { return inRecord.getFace() == face; }); |
... | ... | @@ -164,6 +162,10 @@ |
164 | 162 | it->setShadowRecord(isShadowRecord); |
165 | 163 | if(newRecord) { |
166 | 164 | it->setIBF(BloomFilter::merge(it->getIBF(), interest.getIBF())); |
165 | + | |
166 | + if (!isShadowRecord) { | |
167 | + Entry::n_pit_entries++; | |
168 | + } | |
167 | 169 | } else { |
168 | 170 | it->setIBF(interest.getIBF()); |
169 | 171 | } |
... | ... | @@ -180,7 +182,7 @@ |
180 | 182 | void |
181 | 183 | Entry::deleteInRecords() |
182 | 184 | { |
183 | - //n_pit_entries--; | |
185 | + //Entry::n_pit_entries--; | |
184 | 186 | m_inRecords.clear(); |
185 | 187 | } |
186 | 188 |
NFD/daemon/table/pit-entry.hpp
View file @
8e5bbd4
... | ... | @@ -40,8 +40,6 @@ |
40 | 40 | |
41 | 41 | namespace pit { |
42 | 42 | |
43 | -static uint32_t n_pit_entries = 0; | |
44 | - | |
45 | 43 | /** \brief represents an unordered collection of InRecords |
46 | 44 | */ |
47 | 45 | typedef std::list< InRecord> InRecordCollection; |
... | ... | @@ -69,6 +67,8 @@ |
69 | 67 | class Entry : public StrategyInfoHost, noncopyable |
70 | 68 | { |
71 | 69 | public: |
70 | + static uint32_t n_pit_entries; | |
71 | + | |
72 | 72 | explicit |
73 | 73 | Entry(const Interest& interest); |
74 | 74 |
examples/ndn-congestion-alt-topo-plugin.cpp
View file @
8e5bbd4
... | ... | @@ -185,7 +185,7 @@ |
185 | 185 | std::cout << "Total Average excluding Zero : " << (double)pitSize / K << std::endl; |
186 | 186 | std::cout << "Total Interests : " << ti << std::endl; |
187 | 187 | std::cout << "Additional Interests added : " << ia << std::endl; |
188 | - std::cout << "Global PIT counter : " <<ndn::nfd::pit::n_pit_entries << std::endl; | |
188 | + std::cout << "Global PIT counter : " <<ndn::nfd::pit::Entry::n_pit_entries << std::endl; | |
189 | 189 | |
190 | 190 | Simulator::Destroy(); |
191 | 191 |
examples/ndn-grid.cpp
View file @
8e5bbd4
... | ... | @@ -136,7 +136,7 @@ |
136 | 136 | std::cout << "Total Average excluding zeroes : " << (double)pitSize / k <<std::endl; |
137 | 137 | std::cout << "Total Interests : " << ti << std::endl; |
138 | 138 | std::cout << "Additional Interests added : " << ia << std::endl; |
139 | - std::cout << "Global PIT counter : " <<ndn::nfd::pit::n_pit_entries << std::endl; | |
139 | + std::cout << "Global PIT counter : " <<ndn::nfd::pit::Entry::n_pit_entries << std::endl; | |
140 | 140 | |
141 | 141 | Simulator::Destroy(); |
142 | 142 |