This commit is contained in:
aozhiwei 2019-06-24 10:30:02 +08:00
parent b9a9306b98
commit 380d07fb5d
6 changed files with 24 additions and 5 deletions

View File

@ -16,8 +16,8 @@ else()
endif()
set(CMAKE_BUILD_TYPE "Debug")
#set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1")
set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID} -DMASTER_MODE=${MASTER_MODE} -DA8_TCP_SESSION2=1")
include_directories(

View File

@ -161,3 +161,8 @@ long long GCListener::GetSendNodeNum()
{
return tcp_listener_->send_node_num;
}
long long GCListener::GetSentBytesNum()
{
return tcp_listener_->sent_bytes_num;
}

View File

@ -32,6 +32,7 @@ class GCListener : public a8::Singleton<GCListener>
void ForceCloseClient(unsigned short sockhandle);
void MarkClient(unsigned short sockhandle, bool is_active);
long long GetSendNodeNum();
long long GetSentBytesNum();
private:
a8::TcpListener *tcp_listener_ = nullptr;

View File

@ -64,11 +64,12 @@ static void SavePerfLog()
App::Instance()->perf.read_count,
});
if (App::Instance()->HasFlag(2)) {
a8::XPrintf("mainloop_time:%d netmsg_time:%d send_node_num:%d\n",
a8::XPrintf("mainloop_time:%d netmsg_time:%d send_node_num:%d sent_bytes_num:%d\n",
{
App::Instance()->perf.max_run_delay_time,
App::Instance()->perf.max_dispatchmsg_time,
GCListener::Instance()->GetSendNodeNum()
GCListener::Instance()->GetSendNodeNum(),
GCListener::Instance()->GetSentBytesNum()
});
}
#if 1
@ -156,6 +157,17 @@ bool App::Init(int argc, char* argv[])
}
);
}
if (HasFlag(4)) {
a8::Timer::Instance()->AddDeadLineTimer(
1000 * 30,
a8::XParams(),
[] (const a8::XParams& param)
{
App::Instance()->shutdowned = true;
a8::XPrintf("shutdowned\n", {});
}
);
}
return true;
}

View File

@ -57,6 +57,7 @@ private:
int argc = 0;
char** argv = nullptr;
volatile bool terminated = false;
volatile bool shutdowned = false;
std::set<int> flags;
PerfMonitor perf;
a8::uuid::SnowFlake uuid;

@ -1 +1 @@
Subproject commit f9222e376f8a678a252932c4a3fb93860d7625f2
Subproject commit ca4bcdb5e2f8b32a637629f83ef152b321d97bf6