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 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;
private:
void Output();

View File

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