mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-20 22:08:22 +00:00
Metric prototype
This commit is contained in:
@@ -82,6 +82,7 @@ SET(zone_sources
|
||||
main.cpp
|
||||
map.cpp
|
||||
merc.cpp
|
||||
metric_event_types.cpp
|
||||
mob.cpp
|
||||
mob_ai.cpp
|
||||
mob_appearance.cpp
|
||||
|
||||
@@ -65,6 +65,8 @@ Entity::Entity()
|
||||
id = 0;
|
||||
initial_id = 0;
|
||||
spawn_timestamp = time(nullptr);
|
||||
|
||||
m_metric_event = nullptr;
|
||||
}
|
||||
|
||||
Entity::~Entity()
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/bodytypes.h"
|
||||
#include "../common/eq_constants.h"
|
||||
#include "../common/metric_event.h"
|
||||
|
||||
#include "position.h"
|
||||
#include "zonedump.h"
|
||||
@@ -121,6 +122,9 @@ public:
|
||||
const Bot* CastToBot() const;
|
||||
#endif
|
||||
|
||||
EQEmu::MetricEvent* GetMetricEvent() { return m_metric_event; }
|
||||
bool SetMetricEvent(EQEmu::MetricEvent* metric_event) { if (!m_metric_event) { m_metric_event = metric_event; return true; } else { return false; } }
|
||||
|
||||
protected:
|
||||
friend class EntityList;
|
||||
inline virtual void SetID(uint16 set_id) {
|
||||
@@ -135,6 +139,8 @@ private:
|
||||
uint16 id;
|
||||
uint16 initial_id;
|
||||
time_t spawn_timestamp;
|
||||
|
||||
EQEmu::MetricEvent* m_metric_event;
|
||||
};
|
||||
|
||||
class EntityList
|
||||
|
||||
@@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "../common/eqemu_exception.h"
|
||||
#include "../common/spdat.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/metric_manager.h"
|
||||
|
||||
#include "api_service.h"
|
||||
#include "zone_config.h"
|
||||
@@ -111,6 +112,7 @@ const SPDat_Spell_Struct* spells;
|
||||
int32 SPDAT_RECORDS = -1;
|
||||
const ZoneConfig *Config;
|
||||
double frame_time = 0.0;
|
||||
EQEmu::MetricManager metrics;
|
||||
|
||||
void Shutdown();
|
||||
void UpdateWindowTitle(char* iNewTitle);
|
||||
@@ -537,6 +539,7 @@ int main(int argc, char** argv) {
|
||||
quest_manager.Process();
|
||||
}
|
||||
|
||||
metrics.Process();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
Copyright (C) 2001-2020 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../common/metric_event.h"
|
||||
#include "npc.h"
|
||||
|
||||
class NPC::EventNpcStatsMonitor : EQEmu::MetricEvent {
|
||||
public:
|
||||
|
||||
virtual EventType GetEventType() const { return EventType::eventNpcStatsMonitor; }
|
||||
|
||||
virtual void Process() {}
|
||||
|
||||
virtual void Flush() {}
|
||||
|
||||
virtual void Finalize() { MetricEvent::Finalize(); }
|
||||
|
||||
virtual void Expire() { MetricEvent::Expire(); }
|
||||
};
|
||||
+13
-1
@@ -448,6 +448,18 @@ uint32 NPC::GetRoamboxMinDelay() const
|
||||
|
||||
NPC::~NPC()
|
||||
{
|
||||
auto metric_event = GetMetricEvent();
|
||||
if (metric_event) {
|
||||
|
||||
switch (metric_event->GetEventType()) {
|
||||
case EQEmu::MetricEvent::EventType::eventNpcStatsMonitor:
|
||||
metric_event->Finalize();
|
||||
SetMetricEvent(nullptr);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AI_Stop();
|
||||
|
||||
if(proximity != nullptr) {
|
||||
@@ -3195,4 +3207,4 @@ void NPC::AIYellForHelp(Mob *sender, Mob *attacker)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ namespace EQEmu
|
||||
class NPC : public Mob
|
||||
{
|
||||
public:
|
||||
class EventNpcStatsMonitor;
|
||||
|
||||
static NPC* SpawnNPC(const char* spawncommand, const glm::vec4& position, Client* client = nullptr);
|
||||
static bool SpawnZoneController();
|
||||
static int8 GetAILevel(bool iForceReRead = false);
|
||||
|
||||
Reference in New Issue
Block a user