1
This commit is contained in:
parent
d8a2bcbafe
commit
8a86a795cd
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include <a8/singleton.h>
|
||||
|
||||
namespace a8
|
||||
@ -20,6 +22,10 @@ namespace a8
|
||||
long long recv_eagain_times = 0;
|
||||
long long max_send_time = 0;
|
||||
long long max_recv_time = 0;
|
||||
std::atomic<long long> server_send_bytes = {0};
|
||||
std::atomic<long long> server_consume_bytes = {0};
|
||||
std::atomic<long long> conn_send_bytes = {0};
|
||||
std::atomic<long long> conn_consume_bytes = {0};
|
||||
|
||||
};
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <a8/a8.h>
|
||||
#include <a8/tcpclient.h>
|
||||
#include <a8/perfmonitor.h>
|
||||
|
||||
const int MAX_RECV_BUFFERSIZE = 1024 * 64;
|
||||
|
||||
@ -65,6 +66,9 @@ namespace a8
|
||||
void TcpClient::SendBuff(const char* buff, unsigned int bufflen)
|
||||
{
|
||||
if (bufflen > 0) {
|
||||
#ifdef A8_PERFT
|
||||
PerfMonitor::Instance()->conn_send_bytes += bufflen;
|
||||
#endif
|
||||
a8::SendQueueNode* p = (a8::SendQueueNode*)malloc(sizeof(a8::SendQueueNode));
|
||||
memset(p, 0, sizeof(SendQueueNode));
|
||||
p->buff = (char*)malloc(bufflen);
|
||||
@ -217,6 +221,9 @@ namespace a8
|
||||
currnode->buff + currnode->sent_bytes,
|
||||
currnode->bufflen - currnode->sent_bytes,
|
||||
0);
|
||||
#ifdef A8_PERFT
|
||||
PerfMonitor::Instance()->conn_send_bytes += len;
|
||||
#endif
|
||||
if (len > 0) {
|
||||
currnode->sent_bytes += len;
|
||||
} else {
|
||||
|
@ -68,6 +68,9 @@ namespace a8
|
||||
return;
|
||||
}
|
||||
if (bufflen > 0) {
|
||||
#ifdef A8_PERFT
|
||||
PerfMonitor::Instance()->conn_send_bytes += bufflen;
|
||||
#endif
|
||||
a8::SendQueueNode* p = (a8::SendQueueNode*)malloc(sizeof(a8::SendQueueNode));
|
||||
memset(p, 0, sizeof(a8::SendQueueNode));
|
||||
p->buff = (char*)malloc(bufflen);
|
||||
@ -299,6 +302,9 @@ namespace a8
|
||||
}
|
||||
}
|
||||
work_node_->sent_bytes += sentbytes;
|
||||
#ifdef A8_PERFT
|
||||
PerfMonitor::Instance()->server_consume_bytes += sentbytes;
|
||||
#endif
|
||||
if (work_node_->sent_bytes >= work_node_->bufflen) {
|
||||
a8::SendQueueNode *pdelnode = work_node_;
|
||||
work_node_ = work_node_->next;
|
||||
|
Loading…
x
Reference in New Issue
Block a user