This commit is contained in:
aozhiwei 2024-09-26 15:53:03 +08:00
parent c99c33e2e9
commit 5e891d67a7
2 changed files with 28 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#include <netinet/tcp.h>
#include <a8/a8.h>
#include <a8/perfmonitor.h>
#include <a8/tcpclient.h>
const int MAX_RECV_BUFFERSIZE = 1024 * 64;
@ -80,6 +81,9 @@ namespace a8
}
send_buffer_mutex_->unlock();
NotifySendCond();
#ifdef MMCHK
a8::PerfMonitor::Instance()->AddV("a8.TcpClient.count", 1);
#endif
}
}
@ -228,6 +232,9 @@ namespace a8
worknode = worknode->next;
free(currnode->buff);
free(currnode);
#ifdef MMCHK
a8::PerfMonitor::Instance()->SubV("a8.TcpClient.count", 1);
#endif
}
}
@ -241,6 +248,9 @@ namespace a8
worknode = worknode->next;
free(currnode->buff);
free(currnode);
#ifdef MMCHK
a8::PerfMonitor::Instance()->SubV("a8.TcpClient.count", 1);
#endif
}
}

View File

@ -24,10 +24,16 @@ namespace a8
{
INIT_LIST_HEAD(&session_entry);
max_packet_len_ = DEFAULT_MAX_PACKET_LEN;
#ifdef MMCHK
a8::PerfMonitor::Instance()->AddV("a8.TcpSession.count", 1);
#endif
}
TcpSession::~TcpSession()
{
#ifdef MMCHK
a8::PerfMonitor::Instance()->SubV("a8.TcpSession.count", 1);
#endif
}
void TcpSession::SetMaxPacketLen(int max_packet_len)
@ -86,6 +92,9 @@ namespace a8
}
send_buffer_mutex_.unlock();
++master->send_node_num;
#ifdef MMCHK
a8::PerfMonitor::Instance()->AddV("a8.TcpSession.sendBuf", 1);
#endif
}
}
@ -266,6 +275,9 @@ namespace a8
}
free(pdelnode);
--master->send_node_num;
#ifdef MMCHK
a8::PerfMonitor::Instance()->SubV("a8.TcpSession.sendBuf", 1);
#endif
}
}
@ -279,6 +291,9 @@ namespace a8
}
free(pdelnode);
--master->send_node_num;
#ifdef MMCHK
a8::PerfMonitor::Instance()->SubV("a8.TcpSession.sendBuf", 1);
#endif
}
}
@ -303,6 +318,9 @@ namespace a8
a8::SendQueueNode *pdelnode = work_node_;
work_node_ = work_node_->next;
--master->send_node_num;
#ifdef MMCHK
a8::PerfMonitor::Instance()->SubV("a8.TcpSession.sendBuf", 1);
#endif
++master->sent_node_num;
master->sent_bytes_num += pdelnode->sent_bytes;
if (!work_node_) {