This commit is contained in:
aozhiwei 2023-11-04 22:10:58 +08:00
parent b3c10edf1c
commit d7d6f59f87
2 changed files with 19 additions and 0 deletions

View File

@ -17,6 +17,12 @@ private:
long long buff_num = 0; long long buff_num = 0;
long long bt_co_num = 0; long long bt_co_num = 0;
long long agent_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;
private: private:
void Output(); void Output();

View File

@ -2,15 +2,18 @@
#include "weakptr.h" #include "weakptr.h"
#include "creature.h" #include "creature.h"
#include "roomobstacle.h" #include "roomobstacle.h"
#include "perf.h"
CreatureWeakPtrChunk::CreatureWeakPtrChunk() CreatureWeakPtrChunk::CreatureWeakPtrChunk()
{ {
INIT_LIST_HEAD(&ptrs_); INIT_LIST_HEAD(&ptrs_);
++Perf::Instance()->c_wptr_chunk_num;
} }
CreatureWeakPtrChunk::~CreatureWeakPtrChunk() CreatureWeakPtrChunk::~CreatureWeakPtrChunk()
{ {
Clear(); Clear();
--Perf::Instance()->c_wptr_chunk_num;
} }
void CreatureWeakPtrChunk::Clear() void CreatureWeakPtrChunk::Clear()
@ -32,6 +35,7 @@ void CreatureWeakPtrChunk::Set(Creature* c)
CreatureWeakPtr::CreatureWeakPtr() CreatureWeakPtr::CreatureWeakPtr()
{ {
INIT_LIST_HEAD(&entry_); INIT_LIST_HEAD(&entry_);
++Perf::Instance()->c_wptr_num;
} }
CreatureWeakPtr::CreatureWeakPtr(const CreatureWeakPtr& x) CreatureWeakPtr::CreatureWeakPtr(const CreatureWeakPtr& x)
@ -81,6 +85,7 @@ CreatureWeakPtr&& CreatureWeakPtr::operator=(CreatureWeakPtr&& x)
CreatureWeakPtr::~CreatureWeakPtr() CreatureWeakPtr::~CreatureWeakPtr()
{ {
Reset(); Reset();
--Perf::Instance()->c_wptr_num;
} }
void CreatureWeakPtr::Reset() void CreatureWeakPtr::Reset()
@ -117,11 +122,13 @@ void CreatureWeakPtr::Detach()
RoomObstacleWeakPtrChunk::RoomObstacleWeakPtrChunk() RoomObstacleWeakPtrChunk::RoomObstacleWeakPtrChunk()
{ {
INIT_LIST_HEAD(&ptrs_); INIT_LIST_HEAD(&ptrs_);
++Perf::Instance()->o_wptr_chunk_num;
} }
RoomObstacleWeakPtrChunk::~RoomObstacleWeakPtrChunk() RoomObstacleWeakPtrChunk::~RoomObstacleWeakPtrChunk()
{ {
Clear(); Clear();
--Perf::Instance()->o_wptr_chunk_num;
} }
void RoomObstacleWeakPtrChunk::Clear() void RoomObstacleWeakPtrChunk::Clear()
@ -143,6 +150,7 @@ void RoomObstacleWeakPtrChunk::Set(RoomObstacle* c)
RoomObstacleWeakPtr::RoomObstacleWeakPtr() RoomObstacleWeakPtr::RoomObstacleWeakPtr()
{ {
INIT_LIST_HEAD(&entry_); INIT_LIST_HEAD(&entry_);
++Perf::Instance()->o_wptr_num;
} }
RoomObstacleWeakPtr::RoomObstacleWeakPtr(const RoomObstacleWeakPtr& x) RoomObstacleWeakPtr::RoomObstacleWeakPtr(const RoomObstacleWeakPtr& x)
@ -189,6 +197,7 @@ RoomObstacleWeakPtr&& RoomObstacleWeakPtr::operator=(RoomObstacleWeakPtr&& x)
RoomObstacleWeakPtr::~RoomObstacleWeakPtr() RoomObstacleWeakPtr::~RoomObstacleWeakPtr()
{ {
Reset(); Reset();
++Perf::Instance()->o_wptr_num;
} }
void RoomObstacleWeakPtr::Reset() void RoomObstacleWeakPtr::Reset()
@ -225,11 +234,13 @@ void RoomObstacleWeakPtr::Detach()
EntityWeakPtrChunk::EntityWeakPtrChunk() EntityWeakPtrChunk::EntityWeakPtrChunk()
{ {
INIT_LIST_HEAD(&ptrs_); INIT_LIST_HEAD(&ptrs_);
++Perf::Instance()->e_wptr_chunk_num;
} }
EntityWeakPtrChunk::~EntityWeakPtrChunk() EntityWeakPtrChunk::~EntityWeakPtrChunk()
{ {
Clear(); Clear();
--Perf::Instance()->e_wptr_chunk_num;
} }
void EntityWeakPtrChunk::Clear() void EntityWeakPtrChunk::Clear()
@ -251,6 +262,7 @@ void EntityWeakPtrChunk::Set(Entity* c)
EntityWeakPtr::EntityWeakPtr() EntityWeakPtr::EntityWeakPtr()
{ {
INIT_LIST_HEAD(&entry_); INIT_LIST_HEAD(&entry_);
++Perf::Instance()->e_wptr_num;
} }
EntityWeakPtr::EntityWeakPtr(const EntityWeakPtr& x) EntityWeakPtr::EntityWeakPtr(const EntityWeakPtr& x)
@ -297,6 +309,7 @@ EntityWeakPtr&& EntityWeakPtr::operator=(EntityWeakPtr&& x)
EntityWeakPtr::~EntityWeakPtr() EntityWeakPtr::~EntityWeakPtr()
{ {
Reset(); Reset();
--Perf::Instance()->e_wptr_num;
} }
void EntityWeakPtr::Reset() void EntityWeakPtr::Reset()