@@ -465,6 +465,7 @@ struct LocalServiceInfo {
465465
466466extern RecursiveMutex cs_mapLocalHost;
467467extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
468+ typedef std::map<std::string, uint64_t > mapMsgCmdSize; // command, total bytes
468469
469470class CNodeStats
470471{
@@ -481,7 +482,9 @@ class CNodeStats
481482 bool fInbound ;
482483 int nStartingHeight;
483484 uint64_t nSendBytes;
485+ mapMsgCmdSize mapSendBytesPerMsgCmd;
484486 uint64_t nRecvBytes;
487+ mapMsgCmdSize mapRecvBytesPerMsgCmd;
485488 bool fWhitelisted ;
486489 double dPingTime;
487490 double dPingWait;
@@ -587,6 +590,9 @@ class CNode
587590
588591 const uint64_t nKeyedNetGroup;
589592protected:
593+ mapMsgCmdSize mapSendBytesPerMsgCmd;
594+ mapMsgCmdSize mapRecvBytesPerMsgCmd;
595+
590596 std::vector<std::string> vecRequestsFulfilled; // keep track of what client has asked for
591597
592598 // Basic fuzz-testing
@@ -732,7 +738,7 @@ class CNode
732738 void AbortMessage () UNLOCK_FUNCTION(cs_vSend);
733739
734740 // TODO: Document the precondition of this function. Is cs_vSend locked?
735- void EndMessage () UNLOCK_FUNCTION(cs_vSend);
741+ void EndMessage (const char * pszCommand ) UNLOCK_FUNCTION(cs_vSend);
736742
737743 void PushVersion ();
738744
@@ -741,7 +747,7 @@ class CNode
741747 {
742748 try {
743749 BeginMessage (pszCommand);
744- EndMessage ();
750+ EndMessage (pszCommand );
745751 } catch (...) {
746752 AbortMessage ();
747753 throw ;
@@ -754,7 +760,7 @@ class CNode
754760 try {
755761 BeginMessage (pszCommand);
756762 ssSend << a1;
757- EndMessage ();
763+ EndMessage (pszCommand );
758764 } catch (...) {
759765 AbortMessage ();
760766 throw ;
@@ -767,7 +773,7 @@ class CNode
767773 try {
768774 BeginMessage (pszCommand);
769775 ssSend << a1 << a2;
770- EndMessage ();
776+ EndMessage (pszCommand );
771777 } catch (...) {
772778 AbortMessage ();
773779 throw ;
@@ -780,7 +786,7 @@ class CNode
780786 try {
781787 BeginMessage (pszCommand);
782788 ssSend << a1 << a2 << a3;
783- EndMessage ();
789+ EndMessage (pszCommand );
784790 } catch (...) {
785791 AbortMessage ();
786792 throw ;
@@ -793,7 +799,7 @@ class CNode
793799 try {
794800 BeginMessage (pszCommand);
795801 ssSend << a1 << a2 << a3 << a4;
796- EndMessage ();
802+ EndMessage (pszCommand );
797803 } catch (...) {
798804 AbortMessage ();
799805 throw ;
@@ -806,7 +812,7 @@ class CNode
806812 try {
807813 BeginMessage (pszCommand);
808814 ssSend << a1 << a2 << a3 << a4 << a5;
809- EndMessage ();
815+ EndMessage (pszCommand );
810816 } catch (...) {
811817 AbortMessage ();
812818 throw ;
@@ -819,7 +825,7 @@ class CNode
819825 try {
820826 BeginMessage (pszCommand);
821827 ssSend << a1 << a2 << a3 << a4 << a5 << a6;
822- EndMessage ();
828+ EndMessage (pszCommand );
823829 } catch (...) {
824830 AbortMessage ();
825831 throw ;
@@ -832,7 +838,7 @@ class CNode
832838 try {
833839 BeginMessage (pszCommand);
834840 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7;
835- EndMessage ();
841+ EndMessage (pszCommand );
836842 } catch (...) {
837843 AbortMessage ();
838844 throw ;
@@ -845,7 +851,7 @@ class CNode
845851 try {
846852 BeginMessage (pszCommand);
847853 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8;
848- EndMessage ();
854+ EndMessage (pszCommand );
849855 } catch (...) {
850856 AbortMessage ();
851857 throw ;
@@ -858,7 +864,7 @@ class CNode
858864 try {
859865 BeginMessage (pszCommand);
860866 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9;
861- EndMessage ();
867+ EndMessage (pszCommand );
862868 } catch (...) {
863869 AbortMessage ();
864870 throw ;
@@ -871,7 +877,7 @@ class CNode
871877 try {
872878 BeginMessage (pszCommand);
873879 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10;
874- EndMessage ();
880+ EndMessage (pszCommand );
875881 } catch (...) {
876882 AbortMessage ();
877883 throw ;
@@ -884,7 +890,7 @@ class CNode
884890 try {
885891 BeginMessage (pszCommand);
886892 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10 << a11;
887- EndMessage ();
893+ EndMessage (pszCommand );
888894 } catch (...) {
889895 AbortMessage ();
890896 throw ;
@@ -897,7 +903,7 @@ class CNode
897903 try {
898904 BeginMessage (pszCommand);
899905 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9 << a10 << a11 << a12;
900- EndMessage ();
906+ EndMessage (pszCommand );
901907 } catch (...) {
902908 AbortMessage ();
903909 throw ;
0 commit comments