mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 03:59:56 +00:00
Report stats for TileCachedRecastMeshManager
This commit is contained in:
parent
c3d02c0b41
commit
9e2f3fd0b4
6 changed files with 44 additions and 6 deletions
|
@ -217,7 +217,10 @@ namespace DetourNavigator
|
|||
|
||||
Stats NavMeshManager::getStats() const
|
||||
{
|
||||
return Stats{ .mUpdater = mAsyncNavMeshUpdater.getStats() };
|
||||
return Stats{
|
||||
.mUpdater = mAsyncNavMeshUpdater.getStats(),
|
||||
.mRecast = mRecastMeshManager.getStats(),
|
||||
};
|
||||
}
|
||||
|
||||
RecastMeshTiles NavMeshManager::getRecastMeshTiles() const
|
||||
|
|
|
@ -32,11 +32,19 @@ namespace DetourNavigator
|
|||
out.setAttribute(frameNumber, "NavMesh Cache Get", static_cast<double>(stats.mCache.mGetCount));
|
||||
out.setAttribute(frameNumber, "NavMesh Cache Hit", static_cast<double>(stats.mCache.mHitCount));
|
||||
}
|
||||
|
||||
void reportStats(const TileCachedRecastMeshManagerStats& stats, unsigned int frameNumber, osg::Stats& out)
|
||||
{
|
||||
out.setAttribute(frameNumber, "NavMesh Recast Tiles", static_cast<double>(stats.mTiles));
|
||||
out.setAttribute(frameNumber, "NavMesh Recast Objects", static_cast<double>(stats.mObjects));
|
||||
out.setAttribute(frameNumber, "NavMesh Recast Heightfields", static_cast<double>(stats.mHeightfields));
|
||||
out.setAttribute(frameNumber, "NavMesh Recast Water", static_cast<double>(stats.mWater));
|
||||
}
|
||||
}
|
||||
|
||||
void reportStats(const Stats& stats, unsigned int frameNumber, osg::Stats& out)
|
||||
{
|
||||
if (stats.mUpdater.has_value())
|
||||
reportStats(*stats.mUpdater, frameNumber, out);
|
||||
reportStats(stats.mUpdater, frameNumber, out);
|
||||
reportStats(stats.mRecast, frameNumber, out);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,9 +50,18 @@ namespace DetourNavigator
|
|||
NavMeshTilesCacheStats mCache;
|
||||
};
|
||||
|
||||
struct TileCachedRecastMeshManagerStats
|
||||
{
|
||||
std::size_t mTiles = 0;
|
||||
std::size_t mObjects = 0;
|
||||
std::size_t mHeightfields = 0;
|
||||
std::size_t mWater = 0;
|
||||
};
|
||||
|
||||
struct Stats
|
||||
{
|
||||
std::optional<AsyncNavMeshUpdaterStats> mUpdater;
|
||||
AsyncNavMeshUpdaterStats mUpdater;
|
||||
TileCachedRecastMeshManagerStats mRecast;
|
||||
};
|
||||
|
||||
void reportStats(const Stats& stats, unsigned int frameNumber, osg::Stats& out);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#include "tilecachedrecastmeshmanager.hpp"
|
||||
|
||||
#include "changetype.hpp"
|
||||
#include "gettilespositions.hpp"
|
||||
#include "recastmeshbuilder.hpp"
|
||||
#include "settingsutils.hpp"
|
||||
#include "stats.hpp"
|
||||
#include "updateguard.hpp"
|
||||
|
||||
#include <components/bullethelpers/aabb.hpp>
|
||||
|
@ -11,7 +13,6 @@
|
|||
#include <boost/geometry/geometry.hpp>
|
||||
|
||||
#include <limits>
|
||||
#include <vector>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
|
@ -429,6 +430,17 @@ namespace DetourNavigator
|
|||
return std::move(mChangedTiles);
|
||||
}
|
||||
|
||||
TileCachedRecastMeshManagerStats TileCachedRecastMeshManager::getStats() const
|
||||
{
|
||||
const std::lock_guard lock(mMutex);
|
||||
return TileCachedRecastMeshManagerStats{
|
||||
.mTiles = mCache.size(),
|
||||
.mObjects = mObjects.size(),
|
||||
.mHeightfields = mHeightfields.size(),
|
||||
.mWater = mWater.size(),
|
||||
};
|
||||
}
|
||||
|
||||
TileCachedRecastMeshManager::IndexPoint TileCachedRecastMeshManager::makeIndexPoint(
|
||||
const TilePosition& tilePosition)
|
||||
{
|
||||
|
|
|
@ -28,11 +28,11 @@
|
|||
#include <string>
|
||||
#include <string_view>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
class RecastMesh;
|
||||
struct TileCachedRecastMeshManagerStats;
|
||||
|
||||
class TileCachedRecastMeshManager
|
||||
{
|
||||
|
@ -81,6 +81,8 @@ namespace DetourNavigator
|
|||
|
||||
std::map<osg::Vec2i, ChangeType> takeChangedTiles(const UpdateGuard* guard);
|
||||
|
||||
TileCachedRecastMeshManagerStats getStats() const;
|
||||
|
||||
private:
|
||||
struct Report
|
||||
{
|
||||
|
|
|
@ -119,6 +119,10 @@ namespace Resource
|
|||
"NavMesh CachedTiles",
|
||||
"NavMesh Cache Get",
|
||||
"NavMesh Cache Hit",
|
||||
"NavMesh Recast Tiles",
|
||||
"NavMesh Recast Objects",
|
||||
"NavMesh Recast Heightfields",
|
||||
"NavMesh Recast Water",
|
||||
};
|
||||
|
||||
std::vector<std::string> statNames;
|
||||
|
|
Loading…
Reference in a new issue