Abstracted the CDClient tables

There is now an option to utilize shared memory for some CDClient tables by adding `CD_PROVIDER_MEMORY=1` to the CMakeVariables.txt file.

Allows masterconfig.ini to specify another run command for the world server, to allow for easier debugging through `valgrind`.
This commit is contained in:
wincent
2022-08-11 16:36:03 +02:00
parent 45ae46f6f1
commit 56f371216b
23 changed files with 661 additions and 328 deletions

View File

@@ -445,7 +445,7 @@ Behavior::Behavior(const uint32_t behaviorId)
this->m_effectId = templateInDatabase.effectID;
this->m_effectHandle = *templateInDatabase.effectHandle != "" ? new std::string(*templateInDatabase.effectHandle) : nullptr;
this->m_effectHandle = new std::string(CDTable::GetString(templateInDatabase.effectHandle));
}

View File

@@ -1754,6 +1754,40 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
return;
}
#ifdef __linux__
if (chatCommand == "statm" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_DEVELOPER)
{
// Print and format the output of /proc/self/statm
std::ifstream statm("/proc/self/statm");
if (!statm.is_open())
{
ChatPackets::SendSystemMessage(sysAddr, u"Failed to open /proc/self/statm");
return;
}
// Scan for the different fields
uint64_t size, resident, share, text, lib, data, dirty;
statm >> size >> resident >> share >> text >> lib >> data >> dirty;
// Get the page size
size_t pageSize = sysconf(_SC_PAGESIZE);
// Print the output
ChatPackets::SendSystemMessage(
sysAddr,
u"Size: " + GeneralUtils::to_u16string((float) ((double) size * pageSize / 1.024e6)) +
u"MB\nResident: " + GeneralUtils::to_u16string((float) ((double) resident * pageSize / 1.024e6)) +
u"MB\nShared: " + GeneralUtils::to_u16string((float) ((double) share * pageSize / 1.024e6)) +
u"MB\nText: " + GeneralUtils::to_u16string((float) ((double) text * pageSize / 1.024e6)) +
u"MB\nLibrary: " + GeneralUtils::to_u16string((float) ((double) lib * pageSize / 1.024e6)) +
u"MB\nData: " + GeneralUtils::to_u16string((float) ((double) data * pageSize / 1.024e6)) +
u"MB\nDirty: " + GeneralUtils::to_u16string((float) ((double) dirty * pageSize / 1.024e6)) +
u"MB"
);
}
#endif
if (chatCommand == "rollloot" && entity->GetGMLevel() >= GAME_MASTER_LEVEL_OPERATOR && args.size() >= 3) {
uint32_t lootMatrixIndex = 0;
uint32_t targetLot = 0;