Skip to content

Commit 0762157

Browse files
committed
Report number of StringRefIds
1 parent fc297f7 commit 0762157

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

apps/openmw/engine.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ bool OMW::Engine::frame(unsigned frameNumber, float frametime)
333333
mMechanicsManager->reportStats(frameNumber, *stats);
334334
mWorld->reportStats(frameNumber, *stats);
335335
mLuaManager->reportStats(frameNumber, *stats);
336+
337+
stats->setAttribute(frameNumber, "StringRefId Count", static_cast<double>(ESM::StringRefId::totalCount()));
336338
}
337339

338340
mStereoManager->updateSettings(Settings::camera().mNearClip, Settings::camera().mViewingDistance);

components/esm/stringrefid.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,9 @@ namespace ESM
142142
id.mValue = &*it;
143143
return id;
144144
}
145+
146+
std::size_t StringRefId::totalCount()
147+
{
148+
return getRefIds().lock()->size();
149+
}
145150
}

components/esm/stringrefid.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ namespace ESM
4949
// Similar to the constructor but only returns preexisting ids
5050
static std::optional<StringRefId> deserializeExisting(std::string_view value);
5151

52+
static std::size_t totalCount();
53+
5254
private:
5355
Misc::NotNullPtr<const std::string> mValue;
5456
};

components/resource/stats.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace Resource
7474
"",
7575
"Lua UsedMemory",
7676
"",
77-
"",
77+
"StringRefId Count",
7878
"",
7979
};
8080

0 commit comments

Comments
 (0)