diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-12-07 13:53:40 +0100 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-12-07 13:54:22 +0100 |
| commit | dc0305d15aa02819cd4763e1efe3876d674faea7 (patch) | |
| tree | 6b2fb1f7d8a3d1806fdc6cabac656cb98e262db8 /src/rpcnet.cpp | |
| parent | Merge pull request #7171 (diff) | |
| parent | log bytes recv/sent per command (diff) | |
| download | discoin-dc0305d15aa02819cd4763e1efe3876d674faea7.tar.xz discoin-dc0305d15aa02819cd4763e1efe3876d674faea7.zip | |
Merge pull request #6589
ca188c6 log bytes recv/sent per command (Jonas Schnelli)
Diffstat (limited to 'src/rpcnet.cpp')
| -rw-r--r-- | src/rpcnet.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp index 257884889..0ce108b06 100644 --- a/src/rpcnet.cpp +++ b/src/rpcnet.cpp @@ -111,6 +111,14 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp) " n, (numeric) The heights of blocks we're currently asking from this peer\n" " ...\n" " ]\n" + " \"bytessent_per_msg\": {\n" + " \"addr\": n, (numeric) The total bytes sent aggregated by message type\n" + " ...\n" + " }\n" + " \"bytesrecv_per_msg\": {\n" + " \"addr\": n, (numeric) The total bytes received aggregated by message type\n" + " ...\n" + " }\n" " }\n" " ,...\n" "]\n" @@ -165,6 +173,20 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp) } obj.push_back(Pair("whitelisted", stats.fWhitelisted)); + UniValue sendPerMsgCmd(UniValue::VOBJ); + BOOST_FOREACH(const mapMsgCmdSize::value_type &i, stats.mapSendBytesPerMsgCmd) { + if (i.second > 0) + sendPerMsgCmd.push_back(Pair(i.first, i.second)); + } + obj.push_back(Pair("bytessent_per_msg", sendPerMsgCmd)); + + UniValue recvPerMsgCmd(UniValue::VOBJ); + BOOST_FOREACH(const mapMsgCmdSize::value_type &i, stats.mapRecvBytesPerMsgCmd) { + if (i.second > 0) + recvPerMsgCmd.push_back(Pair(i.first, i.second)); + } + obj.push_back(Pair("bytesrecv_per_msg", recvPerMsgCmd)); + ret.push_back(obj); } |