Skip to content

Commit 48b0d48

Browse files
committed
Merge branch 'string_ref_id_count' into 'master'
Report number of StringRefIds to osg stats See merge request OpenMW/openmw!5072
2 parents 88e15e7 + 0762157 commit 48b0d48

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
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/refid.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44

55
#include "components/misc/strings/lower.hpp"
66

7-
#include <charconv>
8-
#include <ostream>
97
#include <sstream>
108
#include <stdexcept>
11-
#include <system_error>
129
#include <variant>
1310

1411
namespace ESM

components/esm/stringrefid.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
#include "serializerefid.hpp"
33

44
#include <charconv>
5-
#include <iomanip>
6-
#include <mutex>
75
#include <ostream>
8-
#include <sstream>
96
#include <system_error>
107
#include <unordered_set>
118

@@ -145,4 +142,9 @@ namespace ESM
145142
id.mValue = &*it;
146143
return id;
147144
}
145+
146+
std::size_t StringRefId::totalCount()
147+
{
148+
return getRefIds().lock()->size();
149+
}
148150
}

components/esm/stringrefid.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <optional>
77
#include <string>
88
#include <string_view>
9-
#include <variant>
109

1110
#include <components/misc/notnullptr.hpp>
1211

@@ -50,6 +49,8 @@ namespace ESM
5049
// Similar to the constructor but only returns preexisting ids
5150
static std::optional<StringRefId> deserializeExisting(std::string_view value);
5251

52+
static std::size_t totalCount();
53+
5354
private:
5455
Misc::NotNullPtr<const std::string> mValue;
5556
};

components/esm3/loadcell.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace ESM
4040

4141
namespace ESM
4242
{
43-
const StringRefId Cell::sDefaultWorldspaceId = StringRefId("sys::default");
43+
const StringRefId Cell::sDefaultWorldspaceId("sys::default");
4444

4545
template <Misc::SameAsWithoutCvref<Cell::DATAstruct> T>
4646
void decompose(T&& v, const auto& f)

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)