65 lines
2.3 KiB
C++
65 lines
2.3 KiB
C++
#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 "
|
|
"cache_friend_num:%d alloc_node_total_times:%d alloc_node_ok_times:%d "
|
|
"alloc_node_fail_times:%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()->alloc_node_total_times,
|
|
PerfMonitor::Instance()->alloc_node_ok_times,
|
|
PerfMonitor::Instance()->alloc_node_fail_times
|
|
});
|
|
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;
|
|
}
|
|
|
|
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()
|
|
{
|
|
|
|
}
|