优化saveperf
This commit is contained in:
parent
1ea33dd844
commit
76fdb020f8
@ -51,43 +51,6 @@ struct IMMsgNode
|
||||
const char* const PROJ_LOG_ROOT_FMT = "/data/logs/%s/logs";
|
||||
const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log";
|
||||
|
||||
static void SavePerfLog()
|
||||
{
|
||||
a8::UdpLog::Instance()->Info(" 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 "
|
||||
"max_join_time:%d",
|
||||
{
|
||||
PerfMonitor::Instance()->max_run_delay_time,
|
||||
PerfMonitor::Instance()->max_timer_idle,
|
||||
PerfMonitor::Instance()->in_data_size,
|
||||
PerfMonitor::Instance()->out_data_size,
|
||||
App::Instance()->msgnode_size_,
|
||||
PerfMonitor::Instance()->read_count,
|
||||
PerfMonitor::Instance()->max_login_time,
|
||||
PerfMonitor::Instance()->max_join_time,
|
||||
});
|
||||
a8::UdpLog::Instance()->Info(" run_times:%d timer_times:%d event_times:%d free_times:%d "
|
||||
" shutdown_times:%d connect_times:%d close_times:%d "
|
||||
" send_times:%d recv_times:%d error_times:%d immsg_times:%d",
|
||||
{
|
||||
(long long)a8::IoLoop::Instance()->run_times,
|
||||
(long long)a8::IoLoop::Instance()->timer_times,
|
||||
(long long)a8::IoLoop::Instance()->event_times,
|
||||
(long long)a8::IoLoop::Instance()->free_times,
|
||||
(long long)a8::IoLoop::Instance()->shutdown_times,
|
||||
(long long)a8::IoLoop::Instance()->connect_times,
|
||||
(long long)a8::IoLoop::Instance()->close_times,
|
||||
(long long)a8::IoLoop::Instance()->send_times,
|
||||
(long long)a8::IoLoop::Instance()->recv_times,
|
||||
(long long)a8::IoLoop::Instance()->error_times,
|
||||
(long long)a8::IoLoop::Instance()->immsg_times
|
||||
});
|
||||
PerfMonitor::Instance()->max_run_delay_time = 0;
|
||||
PerfMonitor::Instance()->max_timer_idle = 0;
|
||||
PerfMonitor::Instance()->max_login_time = 0;
|
||||
PerfMonitor::Instance()->max_join_time = 0;
|
||||
}
|
||||
|
||||
bool App::Init(int argc, char* argv[])
|
||||
{
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
@ -134,18 +97,6 @@ bool App::Init(int argc, char* argv[])
|
||||
instance_id,
|
||||
getpid(),
|
||||
});
|
||||
{
|
||||
int perf_log_time = 1000 * 60 * 5;
|
||||
if (getenv("is_dev_env")) {
|
||||
perf_log_time = 1000 * 10;
|
||||
}
|
||||
a8::Timer::Instance()->AddRepeatTimer(perf_log_time,
|
||||
a8::XParams(),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
SavePerfLog();
|
||||
});
|
||||
}
|
||||
if (HasFlag(1)) {
|
||||
a8::Timer::Instance()->AddDeadLineTimer(
|
||||
1000 * 60,
|
||||
@ -189,14 +140,10 @@ void App::UnInit()
|
||||
|
||||
FreeSocketMsgQueue();
|
||||
FreeIMMsgQueue();
|
||||
delete im_msg_mutex_;
|
||||
im_msg_mutex_ = nullptr;
|
||||
delete msg_mutex_;
|
||||
msg_mutex_ = nullptr;
|
||||
delete loop_cond_;
|
||||
loop_cond_ = nullptr;
|
||||
delete loop_mutex_;
|
||||
loop_mutex_ = nullptr;
|
||||
A8_SAFE_DELETE(im_msg_mutex_);
|
||||
A8_SAFE_DELETE(msg_mutex_);
|
||||
A8_SAFE_DELETE(loop_cond_);
|
||||
A8_SAFE_DELETE(loop_mutex_);
|
||||
a8::XPrintf("friend_imserver terminated instance_id:%d pid:%d\n", {instance_id, getpid()});
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,59 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <a8/timer.h>
|
||||
#include <a8/ioloop.h>
|
||||
|
||||
#include "perfmonitor.h"
|
||||
#include "app.h"
|
||||
|
||||
static void SavePerfLog()
|
||||
{
|
||||
a8::UdpLog::Instance()->Info(" 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 "
|
||||
"max_join_time:%d",
|
||||
{
|
||||
PerfMonitor::Instance()->max_run_delay_time,
|
||||
PerfMonitor::Instance()->max_timer_idle,
|
||||
PerfMonitor::Instance()->in_data_size,
|
||||
PerfMonitor::Instance()->out_data_size,
|
||||
App::Instance()->msgnode_size_,
|
||||
PerfMonitor::Instance()->read_count,
|
||||
PerfMonitor::Instance()->max_login_time,
|
||||
PerfMonitor::Instance()->max_join_time,
|
||||
});
|
||||
a8::UdpLog::Instance()->Info(" run_times:%d timer_times:%d event_times:%d free_times:%d "
|
||||
" shutdown_times:%d connect_times:%d close_times:%d "
|
||||
" send_times:%d recv_times:%d error_times:%d immsg_times:%d",
|
||||
{
|
||||
(long long)a8::IoLoop::Instance()->run_times,
|
||||
(long long)a8::IoLoop::Instance()->timer_times,
|
||||
(long long)a8::IoLoop::Instance()->event_times,
|
||||
(long long)a8::IoLoop::Instance()->free_times,
|
||||
(long long)a8::IoLoop::Instance()->shutdown_times,
|
||||
(long long)a8::IoLoop::Instance()->connect_times,
|
||||
(long long)a8::IoLoop::Instance()->close_times,
|
||||
(long long)a8::IoLoop::Instance()->send_times,
|
||||
(long long)a8::IoLoop::Instance()->recv_times,
|
||||
(long long)a8::IoLoop::Instance()->error_times,
|
||||
(long long)a8::IoLoop::Instance()->immsg_times
|
||||
});
|
||||
PerfMonitor::Instance()->max_run_delay_time = 0;
|
||||
PerfMonitor::Instance()->max_timer_idle = 0;
|
||||
PerfMonitor::Instance()->max_login_time = 0;
|
||||
PerfMonitor::Instance()->max_join_time = 0;
|
||||
}
|
||||
|
||||
void PerfMonitor::Init()
|
||||
{
|
||||
|
||||
{
|
||||
int perf_log_time = 1000 * 60 * 5;
|
||||
a8::Timer::Instance()->AddRepeatTimer(perf_log_time,
|
||||
a8::XParams(),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
SavePerfLog();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void PerfMonitor::UnInit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user