添加统计信息

This commit is contained in:
aozhiwei 2019-05-27 09:33:00 +08:00
parent e3f4586442
commit dd33c2b995
14 changed files with 30 additions and 12 deletions

View File

@ -9,7 +9,7 @@ else()
endif()
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_RELEASE "-std=gnu++11 -fsanitize=address -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++11 -DGAME_ID=${GAME_ID}")
include_directories(

View File

@ -4,6 +4,7 @@
#include "metamgr.h"
#include "android.ai.h"
#include "room.h"
#include "app.h"
Android::Android():Human()
{
@ -11,12 +12,14 @@ Android::Android():Human()
entity_subtype = EST_Android;
ai = new AndroidAI;
ai->owner = this;
++App::Instance()->perf.entity_num[ET_Android];
}
Android::~Android()
{
delete ai;
ai = nullptr;
--App::Instance()->perf.entity_num[ET_Android];
}
void Android::Initialize()

View File

@ -75,12 +75,6 @@ static void SavePerfLog()
void App::Init(int argc, char* argv[])
{
#if 0
{
Vector2D dir;
dir.Normalize();
}
#endif
signal(SIGPIPE, SIG_IGN);
this->argc = argc;
this->argv = argv;

View File

@ -5,14 +5,17 @@
#include "metamgr.h"
#include "room.h"
#include "loot.h"
#include "app.h"
Building::Building():Entity()
{
entity_type = ET_Building;
++App::Instance()->perf.entity_num[ET_Building];
}
Building::~Building()
{
--App::Instance()->perf.entity_num[ET_Building];
}
void Building::Initialize()

View File

@ -6,14 +6,17 @@
#include "collider.h"
#include "obstacle.h"
#include "player.h"
#include "app.h"
Bullet::Bullet():Entity()
{
entity_type = ET_Bullet;
++App::Instance()->perf.entity_num[ET_Bullet];
}
Bullet::~Bullet()
{
--App::Instance()->perf.entity_num[ET_Bullet];
}
void Bullet::Initialize()

View File

@ -24,6 +24,7 @@ enum EntityType_e
ET_Bullet = 20,
ET_Android = 30,
ET_MAX
};

View File

@ -1456,7 +1456,9 @@ void Human::SendUpdateMsg()
msg->clear_active_player_data();
}
}
#if 1
observer->SendNotifyMsg(*msg);
#endif
}
delete msg;

View File

@ -5,14 +5,17 @@
#include "room.h"
#include "collider.h"
#include "entity.h"
#include "app.h"
Loot::Loot():Entity()
{
entity_type = ET_Loot;
++App::Instance()->perf.entity_num[ET_Loot];
}
Loot::~Loot()
{
--App::Instance()->perf.entity_num[ET_Loot];
}
void Loot::Initialize()

View File

@ -6,14 +6,17 @@
#include "collider.h"
#include "building.h"
#include "human.h"
#include "app.h"
Obstacle::Obstacle():Entity()
{
entity_type = ET_Obstacle;
--App::Instance()->perf.entity_num[ET_Obstacle];
}
Obstacle::~Obstacle()
{
--App::Instance()->perf.entity_num[ET_Obstacle];
}
void Obstacle::Initialize()

View File

@ -11,16 +11,18 @@
#include "obstacle.h"
#include "building.h"
#include "loot.h"
#include "app.h"
Player::Player():Human()
{
entity_type = ET_Player;
entity_subtype = EST_Player;
++App::Instance()->perf.entity_num[ET_Player];
}
Player::~Player()
{
--App::Instance()->perf.entity_num[ET_Player];
}
void Player::Initialize()

View File

@ -699,6 +699,9 @@ bool Room::CanJoin(const std::string& accountid)
if (gas_data.gas_mode != GasInactive) {
return false;
}
if (accountid_hash_.find(accountid) != accountid_hash_.end()) {
return false;
}
if (App::Instance()->HasFlag(5)) {
return accountid_hash_.size() < 1;
} else {

View File

@ -74,12 +74,12 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
inactive_room_hash_[room->room_uuid] = room;
room_hash_[room->room_uuid] = room;
}
Player* hum = PlayerMgr::Instance()->CreatePlayerByCMJoin(hdr.socket_handle + i * 10, msg);
if (i == 0) {
{
Player* hum = PlayerMgr::Instance()->CreatePlayerByCMJoin(hdr.socket_handle, msg);
hum->meta = hum_meta;
room->AddPlayer(hum);
if (i == 0) {
{
cs::SMJoinedNotify notifymsg;
notifymsg.set_error_code(0);
room->FillSMJoinedNotify(hum, notifymsg);

View File

@ -8,6 +8,7 @@ struct PerfMonitor
long long out_data_size = 0;
long long in_data_size = 0;
long long read_count = 0;
std::array<int, 30> entity_num = {};
};
namespace MetaData

@ -1 +1 @@
Subproject commit ff8c00652d5367595c4adee8f95306ae1a46236b
Subproject commit 1cf5fb6ba3f75c2b949962f9c12b39430c7ae2dc