@@ -182,6 +182,7 @@ struct LocalServiceInfo {
182182
183183extern CCriticalSection cs_mapLocalHost;
184184extern std::map<CNetAddr, LocalServiceInfo> mapLocalHost;
185+ typedef std::map<std::string, uint64_t > mapMsgCmdSize; // command, total bytes
185186
186187class CNodeStats
187188{
@@ -199,7 +200,9 @@ class CNodeStats
199200 bool fInbound ;
200201 int nStartingHeight;
201202 uint64_t nSendBytes;
203+ mapMsgCmdSize mapSendBytesPerMsgCmd;
202204 uint64_t nRecvBytes;
205+ mapMsgCmdSize mapRecvBytesPerMsgCmd;
203206 bool fWhitelisted ;
204207 double dPingTime;
205208 double dPingWait;
@@ -373,6 +376,9 @@ class CNode
373376 static std::vector<CSubNet> vWhitelistedRange;
374377 static CCriticalSection cs_vWhitelistedRange;
375378
379+ mapMsgCmdSize mapSendBytesPerMsgCmd;
380+ mapMsgCmdSize mapRecvBytesPerMsgCmd;
381+
376382 // Basic fuzz-testing
377383 void Fuzz (int nChance); // modifies ssSend
378384
@@ -525,7 +531,7 @@ class CNode
525531 void AbortMessage () UNLOCK_FUNCTION(cs_vSend);
526532
527533 // TODO: Document the precondition of this function. Is cs_vSend locked?
528- void EndMessage () UNLOCK_FUNCTION(cs_vSend);
534+ void EndMessage (const char * pszCommand ) UNLOCK_FUNCTION(cs_vSend);
529535
530536 void PushVersion ();
531537
@@ -535,7 +541,7 @@ class CNode
535541 try
536542 {
537543 BeginMessage (pszCommand);
538- EndMessage ();
544+ EndMessage (pszCommand );
539545 }
540546 catch (...)
541547 {
@@ -551,7 +557,7 @@ class CNode
551557 {
552558 BeginMessage (pszCommand);
553559 ssSend << a1;
554- EndMessage ();
560+ EndMessage (pszCommand );
555561 }
556562 catch (...)
557563 {
@@ -567,7 +573,7 @@ class CNode
567573 {
568574 BeginMessage (pszCommand);
569575 ssSend << a1 << a2;
570- EndMessage ();
576+ EndMessage (pszCommand );
571577 }
572578 catch (...)
573579 {
@@ -583,7 +589,7 @@ class CNode
583589 {
584590 BeginMessage (pszCommand);
585591 ssSend << a1 << a2 << a3;
586- EndMessage ();
592+ EndMessage (pszCommand );
587593 }
588594 catch (...)
589595 {
@@ -599,7 +605,7 @@ class CNode
599605 {
600606 BeginMessage (pszCommand);
601607 ssSend << a1 << a2 << a3 << a4;
602- EndMessage ();
608+ EndMessage (pszCommand );
603609 }
604610 catch (...)
605611 {
@@ -615,7 +621,7 @@ class CNode
615621 {
616622 BeginMessage (pszCommand);
617623 ssSend << a1 << a2 << a3 << a4 << a5;
618- EndMessage ();
624+ EndMessage (pszCommand );
619625 }
620626 catch (...)
621627 {
@@ -631,7 +637,7 @@ class CNode
631637 {
632638 BeginMessage (pszCommand);
633639 ssSend << a1 << a2 << a3 << a4 << a5 << a6;
634- EndMessage ();
640+ EndMessage (pszCommand );
635641 }
636642 catch (...)
637643 {
@@ -647,7 +653,7 @@ class CNode
647653 {
648654 BeginMessage (pszCommand);
649655 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7;
650- EndMessage ();
656+ EndMessage (pszCommand );
651657 }
652658 catch (...)
653659 {
@@ -663,7 +669,7 @@ class CNode
663669 {
664670 BeginMessage (pszCommand);
665671 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8;
666- EndMessage ();
672+ EndMessage (pszCommand );
667673 }
668674 catch (...)
669675 {
@@ -679,7 +685,7 @@ class CNode
679685 {
680686 BeginMessage (pszCommand);
681687 ssSend << a1 << a2 << a3 << a4 << a5 << a6 << a7 << a8 << a9;
682- EndMessage ();
688+ EndMessage (pszCommand );
683689 }
684690 catch (...)
685691 {
0 commit comments