完善性能监控日志添加保护
This commit is contained in:
parent
e256b557b4
commit
0a4b2392e1
@ -3,6 +3,8 @@
|
||||
#include "framework/cpp/protoutils.h"
|
||||
#include "framework/cpp/netmsghandler.h"
|
||||
|
||||
#include "perfmonitor.h"
|
||||
|
||||
namespace a8
|
||||
{
|
||||
class AsyncTcpClient;
|
||||
@ -30,6 +32,7 @@ class MSConn
|
||||
{
|
||||
static int msgid = f8::Net_GetMessageId(msg);
|
||||
f8::Net_SendMsg(tcp_client_, 0, msgid, msg);
|
||||
++PerfMonitor::Instance()->ms_send_times;
|
||||
#ifdef DEBUG
|
||||
f8::DumpMsgToLog(msg, "<<<<<<<MSC ");
|
||||
#endif
|
||||
@ -37,6 +40,7 @@ class MSConn
|
||||
void SendMsg(int msgid, ::google::protobuf::Message& msg)
|
||||
{
|
||||
f8::Net_SendMsg(tcp_client_, 0, msgid, msg);
|
||||
++PerfMonitor::Instance()->ms_send_times;
|
||||
#ifdef DEBUG
|
||||
f8::DumpMsgToLog(msg, "<<<<<<<IMC ");
|
||||
#endif
|
||||
|
@ -16,7 +16,8 @@ static void SavePerfLog()
|
||||
("max_run_delay_time:%d max_timer_idle:%d "
|
||||
"in_data_size:%d out_data_size:%d msgnode_size:%d read_count:%d max_login_time:%d "
|
||||
"login_ok_time:%d login_error_time:%d online_num:%d watch_num:%d cache_users_num:%d "
|
||||
"send_ws_count:%d db.total_query_num:%d db.exec_query_num:%d db.run_loop_num:%d ",
|
||||
"send_ws_count:%d db.total_query_num:%d db.exec_query_num:%d db.run_loop_num:%d "
|
||||
"ms_send_times:%d ms_recv_times:%d ",
|
||||
{
|
||||
PerfMonitor::Instance()->max_run_delay_time,
|
||||
PerfMonitor::Instance()->max_timer_idle,
|
||||
@ -33,7 +34,9 @@ static void SavePerfLog()
|
||||
PerfMonitor::Instance()->send_ws_count,
|
||||
(long long)f8::DBPool::Instance()->total_query_num,
|
||||
(long long)f8::DBPool::Instance()->exec_query_num,
|
||||
(long long)f8::DBPool::Instance()->run_loop_num
|
||||
(long long)f8::DBPool::Instance()->run_loop_num,
|
||||
PerfMonitor::Instance()->ms_send_times,
|
||||
PerfMonitor::Instance()->ms_recv_times
|
||||
});
|
||||
a8::UdpLog::Instance()->Info
|
||||
("run_times:%d timer_times:%d event_times:%d free_times:%d "
|
||||
|
@ -17,6 +17,8 @@ class PerfMonitor : public a8::Singleton<PerfMonitor>
|
||||
long long in_data_size = 0;
|
||||
long long read_count = 0;
|
||||
long long send_ws_count = 0;
|
||||
long long ms_send_times = 0;
|
||||
long long ms_recv_times = 0;
|
||||
|
||||
void Init();
|
||||
void UnInit();
|
||||
|
@ -87,6 +87,7 @@ void PlayerMgr::_SS_IM_FriendApply(f8::MsgHdr& hdr, const ss::SS_IM_FriendApply&
|
||||
|
||||
void PlayerMgr::_SS_IM_OnUserOnline(f8::MsgHdr& hdr, const ss::SS_IM_OnUserOnline& msg)
|
||||
{
|
||||
int times = 0;
|
||||
for (auto& account_id : msg.account_ids()) {
|
||||
auto itr = watch_players_.find(account_id);
|
||||
if (itr != watch_players_.end()) {
|
||||
@ -94,6 +95,16 @@ void PlayerMgr::_SS_IM_OnUserOnline(f8::MsgHdr& hdr, const ss::SS_IM_OnUserOnlin
|
||||
list_for_each_entry_safe(node, tmp, &itr->second, watch_node) {
|
||||
node->base_data.online = true;
|
||||
node->hum->NotifyUserInfoUpdate(node);
|
||||
++times;
|
||||
if (times > 100) {
|
||||
a8::UdpLog::Instance()->Warning
|
||||
("OnUserOnLine watch account_id:%s times:%d ",
|
||||
{
|
||||
account_id,
|
||||
times
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -101,6 +112,7 @@ void PlayerMgr::_SS_IM_OnUserOnline(f8::MsgHdr& hdr, const ss::SS_IM_OnUserOnlin
|
||||
|
||||
void PlayerMgr::_SS_IM_OnUserOffline(f8::MsgHdr& hdr, const ss::SS_IM_OnUserOffline& msg)
|
||||
{
|
||||
int times = 0;
|
||||
for (auto& account_id : msg.account_ids()) {
|
||||
auto itr = watch_players_.find(account_id);
|
||||
if (itr != watch_players_.end()) {
|
||||
@ -108,6 +120,16 @@ void PlayerMgr::_SS_IM_OnUserOffline(f8::MsgHdr& hdr, const ss::SS_IM_OnUserOffl
|
||||
list_for_each_entry_safe(node, tmp, &itr->second, watch_node) {
|
||||
node->base_data.online = false;
|
||||
node->hum->NotifyUserInfoUpdate(node);
|
||||
++times;
|
||||
if (times > 100) {
|
||||
a8::UdpLog::Instance()->Warning
|
||||
("OnUserOffLine watch account_id:%s times:%d ",
|
||||
{
|
||||
account_id,
|
||||
times
|
||||
});
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
third_party/a8engine
vendored
2
third_party/a8engine
vendored
@ -1 +1 @@
|
||||
Subproject commit 645913c9d4cc7126475f110b3c7d55bc2f4bc5f0
|
||||
Subproject commit d6786bcdb167afad09bcad7d34e247879dfc735a
|
Loading…
x
Reference in New Issue
Block a user