mirror of
https://github.com/EQEmu/Server.git
synced 2026-01-01 12:51:28 +00:00
Shared memory profiling
This commit is contained in:
parent
7fd3cc3483
commit
ac1a3d0743
@ -24,6 +24,7 @@
|
||||
#include "../common/eqemu_exception.h"
|
||||
|
||||
void LoadBaseData(SharedDatabase *database) {
|
||||
_eqp
|
||||
EQEmu::IPCMutex mutex("base_data");
|
||||
mutex.Lock();
|
||||
int records = (database->GetMaxBaseDataLevel() + 1);
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "../common/item_struct.h"
|
||||
|
||||
void LoadItems(SharedDatabase *database) {
|
||||
_eqp
|
||||
EQEmu::IPCMutex mutex("items");
|
||||
mutex.Lock();
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "../common/loottable.h"
|
||||
|
||||
void LoadLoot(SharedDatabase *database) {
|
||||
_eqp
|
||||
EQEmu::IPCMutex mutex("loot");
|
||||
mutex.Lock();
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/global_define.h"
|
||||
@ -35,11 +36,43 @@
|
||||
|
||||
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) {
|
||||
_eqp
|
||||
RegisterExecutablePlatform(ExePlatformSharedMemory);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
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");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
@ -175,6 +208,5 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
Log.CloseFileLogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "../common/faction.h"
|
||||
|
||||
void LoadFactions(SharedDatabase *database) {
|
||||
_eqp
|
||||
EQEmu::IPCMutex mutex("faction");
|
||||
mutex.Lock();
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
#include "../common/features.h"
|
||||
|
||||
void LoadSkillCaps(SharedDatabase *database) {
|
||||
_eqp
|
||||
EQEmu::IPCMutex mutex("skill_caps");
|
||||
mutex.Lock();
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "../common/spdat.h"
|
||||
|
||||
void LoadSpells(SharedDatabase *database) {
|
||||
_eqp
|
||||
EQEmu::IPCMutex mutex("spells");
|
||||
mutex.Lock();
|
||||
int records = database->GetMaxSpellID() + 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user