Skip to content

Commit

Permalink
Remove verbose debug messages from busy poll loops
Browse files Browse the repository at this point in the history
These are extremely noisy as they are called from busy polling loops,
and don't really display any internal state, just that the loop is
looping.
  • Loading branch information
nickbroon committed Feb 14, 2018
1 parent 7355b6f commit cebc685
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 19 deletions.
6 changes: 0 additions & 6 deletions src/common/ConcurrentQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class ConcurrentQueue
(ownerName.empty() ? "<owner not set>" : ownerName.c_str()),
maxEntries-pushSemaphore.getCount());
if (!popSemaphore.wait()) {
DPRINTF_INFO("(%s) failed to pop element, program is being shut down?", ownerName.c_str());
return false;
}

Expand All @@ -102,11 +101,9 @@ class ConcurrentQueue
// of the timeout has been reached, res will be set to NULL and false will be returned
inline bool pop(long timeout_ms, T *res)
{
DPRINTF_DEBUG( "(%s) trying to pop element (%d elements in queue)", ownerName.c_str(), count);
// try to get an item from the queue
if(!popSemaphore.wait(timeout_ms)) {
// timeout occured
DPRINTF_DEBUG( "(%s) timeout", ownerName.c_str());
return false;
}

Expand All @@ -129,8 +126,6 @@ class ConcurrentQueue
// use this instead of the above, makes things easier!
inline bool popAbs(const struct timespec& timeout, T *res)
{
DPRINTF_DEBUG( "(%s) trying to pop element (%d elements in queue)", ownerName.c_str(), count);

if (popSemaphore.waitAbs(timeout)) {
// popSemaphore.wait() succeeded, now pop the frontmost element
lock.lock();
Expand All @@ -148,7 +143,6 @@ class ConcurrentQueue
}
else {
// timeout occured
DPRINTF_DEBUG( "(%s) timeout or program shutdown", ownerName.c_str());
*res = 0;

return false;
Expand Down
9 changes: 1 addition & 8 deletions src/common/TimeoutSemaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ class TimeoutSemaphore
return false;
break;
default:
// semaphore could not be aquired because of several reasons, but none are fatal
DPRINTF_DEBUG( "timedwait (<0) returned with %d (%s)", errno, strerror(errno));
return false;
}
}
Expand All @@ -120,7 +118,6 @@ class TimeoutSemaphore
retval = sem_timedwait(sem, &timeout);
#endif
if (retval != 0 && errno != ETIMEDOUT) {
DPRINTF_DEBUG( "timedwait (>=0) returned with %d: %s", errno, strerror(errno));
switch (errno) {
case EINVAL:
/*
Expand All @@ -141,8 +138,7 @@ class TimeoutSemaphore
return false;
break;
default:
// semaphore could not be aquired because of several reasons, but none are fatal
DPRINTF_DEBUG( "timedwait (>=0) returned with %d", errno);
break;
}
}
if (errno == ETIMEDOUT) {
Expand Down Expand Up @@ -201,9 +197,6 @@ class TimeoutSemaphore
return false;
break;
default:
// semaphore not acquired for non-fatal reasons
DPRINTF_DEBUG( "timedwait returned with %s",
strerror(errno));
return false;
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/core/ConnectionQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,10 @@ class ConnectionQueue : public Adapter<T>, public Timer
struct timespec nexttimeout;
if (!processTimeouts(nexttimeout)) {
if (!queue.pop(&element)) {
DPRINTF_INFO("queue.pop failed - timeout?");
continue;
}
} else {
if (!queue.popAbs(nexttimeout, &element)) {
DPRINTF_INFO("queue.pop failed - timeout?");
continue;
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/modules/ipfix/aggregator/BaseAggregator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,12 @@ void BaseAggregator::exporterThread()
}

gettimeofday(&curtime, 0);
DPRINTF_DEBUG("Aggregator: starting Export");
for (size_t i = 0; i < rules->count; i++) {
rules->rule[i]->hashtable->expireFlows();
}
struct timeval endtime;
gettimeofday(&endtime, 0);
timeval_subtract(&difftime, &endtime, &curtime);

DPRINTF_DEBUG("Aggregator: export took %.03f secs", (float)difftime.tv_usec/1000000+difftime.tv_sec);
}

if (getShutdownProperly()) {
Expand Down

0 comments on commit cebc685

Please sign in to comment.