1
This commit is contained in:
parent
25f4901a8a
commit
acc1a6b46f
42
server/robotserver/perf.cc
Normal file
42
server/robotserver/perf.cc
Normal file
@ -0,0 +1,42 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "perf.h"
|
||||
|
||||
#include <f8/timer.h>
|
||||
#include <f8/udplog.h>
|
||||
|
||||
void Perf::Init()
|
||||
{
|
||||
f8::Timer::Instance()->SetInterval
|
||||
(1000 *5,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
Output();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void Perf::UnInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Perf::Output()
|
||||
{
|
||||
f8::UdpLog::Instance()->Info
|
||||
("perf entity:%d buff:%d bt_co:%d agent:%d c_w_c:%d c_w:%d o_w_c:%d o_w:%d e_w_c:%d e_c:%d e_h:%d",
|
||||
{
|
||||
entity_num,
|
||||
buff_num,
|
||||
bt_co_num,
|
||||
agent_num,
|
||||
c_wptr_chunk_num,
|
||||
c_wptr_num,
|
||||
o_wptr_chunk_num,
|
||||
o_wptr_num,
|
||||
e_wptr_chunk_num,
|
||||
e_wptr_num,
|
||||
event_handler_num
|
||||
});
|
||||
}
|
32
server/robotserver/perf.h
Normal file
32
server/robotserver/perf.h
Normal file
@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#define PERF 1
|
||||
|
||||
#include <a8/singleton.h>
|
||||
|
||||
class Perf : public a8::Singleton<Perf>
|
||||
{
|
||||
private:
|
||||
Perf() {};
|
||||
friend class a8::Singleton<Perf>;
|
||||
public:
|
||||
void Init();
|
||||
void UnInit();
|
||||
|
||||
long long entity_num = 0;
|
||||
long long buff_num = 0;
|
||||
long long bt_co_num = 0;
|
||||
long long agent_num = 0;
|
||||
long long c_wptr_chunk_num = 0;
|
||||
long long c_wptr_num = 0;
|
||||
long long o_wptr_chunk_num = 0;
|
||||
long long o_wptr_num = 0;
|
||||
long long e_wptr_chunk_num = 0;
|
||||
long long e_wptr_num = 0;
|
||||
long long event_handler_num = 0;
|
||||
int traversing_cell_creature_count = 0;
|
||||
|
||||
private:
|
||||
void Output();
|
||||
|
||||
};
|
@ -42,7 +42,7 @@ void PlayerMgr::Init()
|
||||
account_id_hash_[hum->GetAccountId()] = hum;
|
||||
socket_id_hash_[hum->GetSocketId()] = hum;
|
||||
++count;
|
||||
if (count >= 2000) {
|
||||
if (count >= 19) {
|
||||
f8::Timer::Instance()->DeleteCurrentTimer();
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user