1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-03 20:43:08 +00:00

Merge branch 'string_ref_id_count' into 'master'

Report number of StringRefIds to osg stats

See merge request OpenMW/openmw!5072
This commit is contained in:
Evil Eye 2025-12-27 16:50:30 +00:00
commit 48b0d48e9a
6 changed files with 11 additions and 9 deletions

View file

@ -333,6 +333,8 @@ bool OMW::Engine::frame(unsigned frameNumber, float frametime)
mMechanicsManager->reportStats(frameNumber, *stats);
mWorld->reportStats(frameNumber, *stats);
mLuaManager->reportStats(frameNumber, *stats);
stats->setAttribute(frameNumber, "StringRefId Count", static_cast<double>(ESM::StringRefId::totalCount()));
}
mStereoManager->updateSettings(Settings::camera().mNearClip, Settings::camera().mViewingDistance);

View file

@ -4,11 +4,8 @@
#include "components/misc/strings/lower.hpp"
#include <charconv>
#include <ostream>
#include <sstream>
#include <stdexcept>
#include <system_error>
#include <variant>
namespace ESM

View file

@ -2,10 +2,7 @@
#include "serializerefid.hpp"
#include <charconv>
#include <iomanip>
#include <mutex>
#include <ostream>
#include <sstream>
#include <system_error>
#include <unordered_set>
@ -145,4 +142,9 @@ namespace ESM
id.mValue = &*it;
return id;
}
std::size_t StringRefId::totalCount()
{
return getRefIds().lock()->size();
}
}

View file

@ -6,7 +6,6 @@
#include <optional>
#include <string>
#include <string_view>
#include <variant>
#include <components/misc/notnullptr.hpp>
@ -50,6 +49,8 @@ namespace ESM
// Similar to the constructor but only returns preexisting ids
static std::optional<StringRefId> deserializeExisting(std::string_view value);
static std::size_t totalCount();
private:
Misc::NotNullPtr<const std::string> mValue;
};

View file

@ -40,7 +40,7 @@ namespace ESM
namespace ESM
{
const StringRefId Cell::sDefaultWorldspaceId = StringRefId("sys::default");
const StringRefId Cell::sDefaultWorldspaceId("sys::default");
template <Misc::SameAsWithoutCvref<Cell::DATAstruct> T>
void decompose(T&& v, const auto& f)

View file

@ -74,7 +74,7 @@ namespace Resource
"",
"Lua UsedMemory",
"",
"",
"StringRefId Count",
"",
};