Skip to content
This repository was archived by the owner on Mar 20, 2023. It is now read-only.

Commit 154ec44

Browse files
authored
Remove queue statistics related (dead) code (#375)
- histotically queue stats related code was added to get an idea of number of events in the particular simulation - we haven't used this for years and I haven't found this anything useful anyway.
1 parent 89653bd commit 154ec44

File tree

5 files changed

+0
-220
lines changed

5 files changed

+0
-220
lines changed

coreneuron/network/netcvode.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,6 @@ void NetCvodeThreadData::enqueue(NetCvode* nc, NrnThread* nt) {
171171
for (size_t i = 0; i < inter_thread_events_.size(); ++i) {
172172
InterThreadEvent ite = inter_thread_events_[i];
173173
nc->bin_event(ite.t_, ite.de_, nt);
174-
#if COLLECT_TQueue_STATISTICS
175-
/// TQueue::qtype::ite = 2
176-
tqe_->record_stat_event(2, ite.t_);
177-
#endif
178174
}
179175
inter_thread_events_.clear();
180176
MUTUNLOCK
@@ -525,11 +521,6 @@ void InputPreSyn::send(double tt, NetCvode* ns, NrnThread* nt) {
525521
if (d->active_ && d->target_) {
526522
NrnThread* n = PP2NT(d->target_);
527523

528-
#if COLLECT_TQueue_STATISTICS
529-
/// TQueue::qtype::spike = 1
530-
ns->p[nt->id].tqe_->record_stat_event(1, tt);
531-
#endif
532-
533524
if (nt == n)
534525
ns->bin_event(tt + d->delay_, d, n);
535526
else
@@ -769,11 +760,6 @@ void NetCvode::deliver_net_events(NrnThread* nt) { // for default method
769760
}
770761
#endif
771762

772-
#if COLLECT_TQueue_STATISTICS
773-
/// TQueue::qtype::deq = 3
774-
p[tid].tqe_->record_stat_event(3, q->t_);
775-
#endif
776-
777763
delete q;
778764
db->deliver(nt->_t, this, nt);
779765
}

coreneuron/network/tqueue.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
3434
#include "coreneuron/sim/multicore.hpp"
3535
#include "coreneuron/network/tqueue.hpp"
3636

37-
#if COLLECT_TQueue_STATISTICS
38-
#define STAT(arg) ++arg;
39-
#else
40-
#define STAT(arg) /**/
41-
#endif
4237
namespace coreneuron {
4338
// splay tree + bin queue limited to fixed step method
4439
// for event-sets or priority queues
@@ -65,9 +60,6 @@ BinQ::BinQ() {
6560
}
6661
qpt_ = 0;
6762
tt_ = 0.;
68-
#if COLLECT_TQueue_STATISTICS
69-
nfenq = nfdeq = 0;
70-
#endif
7163
}
7264

7365
BinQ::~BinQ() {
@@ -115,17 +107,11 @@ void BinQ::enqueue(double td, TQItem* q) {
115107
q->cnt_ = idt; // only for iteration
116108
q->left_ = bins_[idt];
117109
bins_[idt] = q;
118-
#if COLLECT_TQueue_STATISTICS
119-
++nfenq;
120-
#endif
121110
}
122111
TQItem* BinQ::dequeue() {
123112
TQItem* q = bins_[qpt_];
124113
if (q) {
125114
bins_[qpt_] = q->left_;
126-
#if COLLECT_TQueue_STATISTICS
127-
++nfdeq;
128-
#endif
129115
}
130116
return q;
131117
}

coreneuron/network/tqueue.hpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
5656
#include "coreneuron/utils/nrnmutdec.h"
5757

5858
namespace coreneuron {
59-
#define COLLECT_TQueue_STATISTICS 0
6059
#define STRCMP(a, b) (a - b)
6160

6261
class TQItem;
@@ -134,10 +133,6 @@ class BinQ {
134133
TQItem* next(TQItem*);
135134
void remove(TQItem*);
136135
void resize(int);
137-
#if COLLECT_TQueue_STATISTICS
138-
public:
139-
int nfenq, nfdeq;
140-
#endif
141136
private:
142137
double tt_; // time at beginning of qpt_ interval
143138
int nbin_, qpt_;
@@ -172,21 +167,13 @@ class TQueue {
172167
inline TQItem* atomic_dq(double til);
173168
inline void remove(TQItem*);
174169
inline void move(TQItem*, double tnew);
175-
#if COLLECT_TQueue_STATISTICS
176-
inline void statistics();
177-
inline void record_stat_event(int type, double time);
178-
#endif
179170
int nshift_;
180171

181172
/// Priority queue of vectors for queuing the events. enqueuing for move() and
182173
/// move_least_nolock() is not implemented
183174
std::priority_queue<TQPair, std::vector<TQPair>, less_time> pq_que_;
184175
/// Types of queuing statistics
185176
enum qtype { enq = 0, spike, ite, deq };
186-
#if COLLECT_TQueue_STATISTICS
187-
/// Map for queuing statistics
188-
std::map<double, long> time_map_events[4];
189-
#endif
190177

191178
private:
192179
double least_t_nolock() {
@@ -208,10 +195,6 @@ class TQueue {
208195
return TQPair(p->t_, p);
209196
}
210197
MUTDEC
211-
#if COLLECT_TQueue_STATISTICS
212-
unsigned long ninsert, nrem, nleast, nbal, ncmplxrem;
213-
unsigned long ncompare, nleastsrch, nfind, nfindsrch, nmove, nfastmove;
214-
#endif
215198
};
216199
} // namespace coreneuron
217200
#include "coreneuron/network/tqueue.ipp"

coreneuron/network/tqueue.ipp

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,6 @@ THE POSSIBILITY OF SUCH DAMAGE.
3737
#include "coreneuron/sim/multicore.hpp"
3838
#include "coreneuron/network/tqueue.hpp"
3939

40-
#if COLLECT_TQueue_STATISTICS
41-
#define STAT(arg) ++arg;
42-
#else
43-
#define STAT(arg) /**/
44-
#endif
4540
namespace coreneuron {
4641
// splay tree + bin queue limited to fixed step method
4742
// for event-sets or priority queues
@@ -62,11 +57,6 @@ TQueue<C>::TQueue() {
6257
spinit(sptree_);
6358
binq_ = new BinQ;
6459
least_ = 0;
65-
66-
#if COLLECT_TQueue_STATISTICS
67-
nmove = ninsert = nrem = nleast = nbal = ncmplxrem = 0;
68-
nfastmove = ncompare = nleastsrch = nfind = nfindsrch = 0;
69-
#endif
7060
}
7161

7262
template <container C>
@@ -102,10 +92,6 @@ TQueue<C>::~TQueue() {
10292
template <container C>
10393
TQItem* TQueue<C>::enqueue_bin(double td, void* d) {
10494
MUTLOCK
105-
#if COLLECT_TQueue_STATISTICS
106-
STAT(ninsert);
107-
record_stat_event(enq, td);
108-
#endif
10995
TQItem* i = new TQItem;
11096
i->data_ = d;
11197
i->t_ = td;
@@ -114,24 +100,6 @@ TQItem* TQueue<C>::enqueue_bin(double td, void* d) {
114100
return i;
115101
}
116102

117-
#if COLLECT_TQueue_STATISTICS
118-
template <container C>
119-
void TQueue<C>::record_stat_event(int type, double time) {
120-
if (time_map_events[type].find(time) == time_map_events[type].end())
121-
time_map_events[type][time] = 1;
122-
else
123-
++time_map_events[type][time];
124-
}
125-
126-
template <container C>
127-
void TQueue<C>::statistics() {
128-
printf("insertions=%lu moves=%lu removals=%lu calls to least=%lu\n", ninsert, nmove, nrem,
129-
nleast);
130-
printf("calls to find=%lu\n", nfind);
131-
printf("comparisons=%d\n", sptree_->enqcmps);
132-
}
133-
#endif
134-
135103
/// Splay tree priority queue implementation
136104
template <>
137105
inline void TQueue<spltree>::move_least_nolock(double tnew) {
@@ -167,7 +135,6 @@ inline void TQueue<pq_que>::move_least_nolock(double tnew) {
167135
template <>
168136
inline void TQueue<spltree>::move(TQItem* i, double tnew) {
169137
MUTLOCK
170-
STAT(nmove)
171138
if (i == least_) {
172139
move_least_nolock(tnew);
173140
} else if (tnew < least_->t_) {
@@ -187,7 +154,6 @@ inline void TQueue<spltree>::move(TQItem* i, double tnew) {
187154
template <>
188155
inline void TQueue<pq_que>::move(TQItem* i, double tnew) {
189156
MUTLOCK
190-
STAT(nmove)
191157
if (i == least_) {
192158
move_least_nolock(tnew);
193159
} else if (tnew < least_->t_) {
@@ -213,10 +179,6 @@ inline void TQueue<pq_que>::move(TQItem* i, double tnew) {
213179
template <>
214180
inline TQItem* TQueue<spltree>::insert(double tt, void* d) {
215181
MUTLOCK
216-
#if COLLECT_TQueue_STATISTICS
217-
STAT(ninsert);
218-
record_stat_event(enq, tt);
219-
#endif
220182
TQItem* i = new TQItem;
221183
i->data_ = d;
222184
i->t_ = tt;
@@ -242,10 +204,6 @@ inline TQItem* TQueue<spltree>::insert(double tt, void* d) {
242204
template <>
243205
inline TQItem* TQueue<pq_que>::insert(double tt, void* d) {
244206
MUTLOCK
245-
#if COLLECT_TQueue_STATISTICS
246-
STAT(ninsert);
247-
record_stat_event(enq, tt);
248-
#endif
249207
TQItem* i = new TQItem;
250208
i->data_ = d;
251209
i->t_ = tt;
@@ -271,10 +229,6 @@ inline TQItem* TQueue<pq_que>::insert(double tt, void* d) {
271229
template <>
272230
inline void TQueue<spltree>::remove(TQItem* q) {
273231
MUTLOCK
274-
#if COLLECT_TQueue_STATISTICS
275-
STAT(nrem);
276-
record_stat_event(deq, q->t_);
277-
#endif
278232
if (q) {
279233
if (q == least_) {
280234
if (sptree_->root) {
@@ -294,10 +248,6 @@ inline void TQueue<spltree>::remove(TQItem* q) {
294248
template <>
295249
inline void TQueue<pq_que>::remove(TQItem* q) {
296250
MUTLOCK
297-
#if COLLECT_TQueue_STATISTICS
298-
STAT(nrem);
299-
record_stat_event(deq, q->t_);
300-
#endif
301251
if (q) {
302252
if (q == least_) {
303253
if (pq_que_.size()) {
@@ -320,10 +270,6 @@ inline TQItem* TQueue<spltree>::atomic_dq(double tt) {
320270
MUTLOCK
321271
if (least_ && least_->t_ <= tt) {
322272
q = least_;
323-
#if COLLECT_TQueue_STATISTICS
324-
STAT(nrem);
325-
record_stat_event(deq, tt);
326-
#endif
327273
if (sptree_->root) {
328274
least_ = spdeq(&sptree_->root);
329275
} else {
@@ -341,10 +287,6 @@ inline TQItem* TQueue<pq_que>::atomic_dq(double tt) {
341287
MUTLOCK
342288
if (least_ && least_->t_ <= tt) {
343289
q = least_;
344-
#if COLLECT_TQueue_STATISTICS
345-
STAT(nrem);
346-
record_stat_event(deq, tt);
347-
#endif
348290
// int qsize = pq_que_.size();
349291
// printf("map size: %d\n", msize);
350292
/// This while loop is to delete events whose times have been moved with the ::move

0 commit comments

Comments
 (0)