diff options
author | Rastislav Szabo <raszabo@cisco.com> | 2017-07-07 12:36:17 +0200 |
---|---|---|
committer | Rastislav Szabo <raszabo@cisco.com> | 2017-07-11 15:42:39 +0200 |
commit | 982b8703a757e5a91aa6451fd26593a065f8a452 (patch) | |
tree | d4f43a227ef789a04aa8bad9efa9ed71a417e646 /core | |
parent | 2d07847237e754d9050f06f565baa430c70ed937 (diff) |
added performance benchmark example
Change-Id: Ia0fea0569be3da7fadac9ef32d5f12c0b6de0089
Signed-off-by: Rastislav Szabo <raszabo@cisco.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/request_handler.go | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/core/request_handler.go b/core/request_handler.go index f4f5e92..e0235b9 100644 --- a/core/request_handler.go +++ b/core/request_handler.go @@ -79,13 +79,15 @@ func (c *Connection) processRequest(ch *api.Channel, chMeta *channelMetadata, re return error } - // send the message - log.WithFields(logger.Fields{ - "context": chMeta.id, - "msg_id": msgID, - "msg_size": len(data), - }).Debug("Sending a message to VPP.") + if log.Level == logger.DebugLevel { // for performance reasons - logrus does some processing even if debugs are disabled + log.WithFields(logger.Fields{ + "context": chMeta.id, + "msg_id": msgID, + "msg_size": len(data), + }).Debug("Sending a message to VPP.") + } + // send the message if req.Multipart { // expect multipart response atomic.StoreUint32(&chMeta.multipart, 1) @@ -121,11 +123,13 @@ func msgCallback(context uint32, msgID uint16, data []byte) { return } - log.WithFields(logger.Fields{ - "context": context, - "msg_id": msgID, - "msg_size": len(data), - }).Debug("Received a message from VPP.") + if log.Level == logger.DebugLevel { // for performance reasons - logrus does some processing even if debugs are disabled + log.WithFields(logger.Fields{ + "context": context, + "msg_id": msgID, + "msg_size": len(data), + }).Debug("Received a message from VPP.") + } if context == 0 || conn.isNotificationMessage(msgID) { // process the message as a notification |