mirror of
https://github.com/EQEmu/Server.git
synced 2026-03-04 00:02:24 +00:00
Shared memory profiling
This commit is contained in:
parent
7fd3cc3483
commit
ac1a3d0743
@ -24,6 +24,7 @@
|
|||||||
#include "../common/eqemu_exception.h"
|
#include "../common/eqemu_exception.h"
|
||||||
|
|
||||||
void LoadBaseData(SharedDatabase *database) {
|
void LoadBaseData(SharedDatabase *database) {
|
||||||
|
_eqp
|
||||||
EQEmu::IPCMutex mutex("base_data");
|
EQEmu::IPCMutex mutex("base_data");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
int records = (database->GetMaxBaseDataLevel() + 1);
|
int records = (database->GetMaxBaseDataLevel() + 1);
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include "../common/item_struct.h"
|
#include "../common/item_struct.h"
|
||||||
|
|
||||||
void LoadItems(SharedDatabase *database) {
|
void LoadItems(SharedDatabase *database) {
|
||||||
|
_eqp
|
||||||
EQEmu::IPCMutex mutex("items");
|
EQEmu::IPCMutex mutex("items");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "../common/loottable.h"
|
#include "../common/loottable.h"
|
||||||
|
|
||||||
void LoadLoot(SharedDatabase *database) {
|
void LoadLoot(SharedDatabase *database) {
|
||||||
|
_eqp
|
||||||
EQEmu::IPCMutex mutex("loot");
|
EQEmu::IPCMutex mutex("loot");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
|
|
||||||
|
|||||||
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "../common/global_define.h"
|
#include "../common/global_define.h"
|
||||||
@ -35,11 +36,43 @@
|
|||||||
|
|
||||||
EQEmuLogSys Log;
|
EQEmuLogSys Log;
|
||||||
|
|
||||||
|
void CatchSignal(int sig_num)
|
||||||
|
{
|
||||||
|
#ifdef EQPERF_ENABLED
|
||||||
|
char time_str[128];
|
||||||
|
time_t result = time(nullptr);
|
||||||
|
strftime(time_str, sizeof(time_str), "%Y_%m_%d__%H_%M_%S", localtime(&result));
|
||||||
|
|
||||||
|
std::string prof_name = "./profile/shared_memory_";
|
||||||
|
prof_name += time_str;
|
||||||
|
prof_name += ".log";
|
||||||
|
|
||||||
|
std::ofstream profile_out(prof_name, std::ofstream::out);
|
||||||
|
if(profile_out.good()) {
|
||||||
|
_eqp_dump(profile_out, 10);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
_eqp
|
||||||
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
||||||
Log.LoadLogSettingsDefaults();
|
Log.LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
|
if(signal(SIGINT, CatchSignal) == SIG_ERR) {
|
||||||
|
Log.Out(Logs::Detail, Logs::Error, "Could not set signal handler");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(signal(SIGTERM, CatchSignal) == SIG_ERR) {
|
||||||
|
Log.Out(Logs::Detail, Logs::Error, "Could not set signal handler");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if(signal(SIGBREAK, CatchSignal) == SIG_ERR) {
|
||||||
|
Log.Out(Logs::Detail, Logs::Error, "Could not set signal handler");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
Log.Out(Logs::General, Logs::Status, "Shared Memory Loader Program");
|
Log.Out(Logs::General, Logs::Status, "Shared Memory Loader Program");
|
||||||
if(!EQEmuConfig::LoadConfig()) {
|
if(!EQEmuConfig::LoadConfig()) {
|
||||||
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||||
@ -175,6 +208,5 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Log.CloseFileLogs();
|
Log.CloseFileLogs();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include "../common/faction.h"
|
#include "../common/faction.h"
|
||||||
|
|
||||||
void LoadFactions(SharedDatabase *database) {
|
void LoadFactions(SharedDatabase *database) {
|
||||||
|
_eqp
|
||||||
EQEmu::IPCMutex mutex("faction");
|
EQEmu::IPCMutex mutex("faction");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@
|
|||||||
#include "../common/features.h"
|
#include "../common/features.h"
|
||||||
|
|
||||||
void LoadSkillCaps(SharedDatabase *database) {
|
void LoadSkillCaps(SharedDatabase *database) {
|
||||||
|
_eqp
|
||||||
EQEmu::IPCMutex mutex("skill_caps");
|
EQEmu::IPCMutex mutex("skill_caps");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
|
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
#include "../common/spdat.h"
|
#include "../common/spdat.h"
|
||||||
|
|
||||||
void LoadSpells(SharedDatabase *database) {
|
void LoadSpells(SharedDatabase *database) {
|
||||||
|
_eqp
|
||||||
EQEmu::IPCMutex mutex("spells");
|
EQEmu::IPCMutex mutex("spells");
|
||||||
mutex.Lock();
|
mutex.Lock();
|
||||||
int records = database->GetMaxSpellID() + 1;
|
int records = database->GetMaxSpellID() + 1;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user