Report CellPreloader stats

animationblending
elsid 5 months ago
parent 9a24e77d3f
commit ae41ebfc83
No known key found for this signature in database
GPG Key ID: 4DE04C198CBA7625

@ -4,6 +4,8 @@
#include <atomic>
#include <limits>
#include <osg/Stats>
#include <components/debug/debuglog.hpp>
#include <components/esm3/loadcell.hpp>
#include <components/loadinglistener/reporter.hpp>
@ -276,6 +278,7 @@ namespace MWWorld
{
oldestCell->second.mWorkItem->abort();
mPreloadCells.erase(oldestCell);
++mEvicted;
}
else
return;
@ -285,7 +288,8 @@ namespace MWWorld
mResourceSystem->getKeyframeManager(), mTerrain, mLandManager, mPreloadInstances));
mWorkQueue->addWorkItem(item);
mPreloadCells[&cell] = PreloadEntry(timestamp, item);
mPreloadCells.emplace(&cell, PreloadEntry(timestamp, item));
++mAdded;
}
void CellPreloader::notifyLoaded(CellStore* cell)
@ -300,6 +304,7 @@ namespace MWWorld
}
mPreloadCells.erase(found);
++mLoaded;
}
}
@ -329,6 +334,7 @@ namespace MWWorld
it->second.mWorkItem = nullptr;
}
mPreloadCells.erase(it++);
++mExpired;
}
else
++it;
@ -467,4 +473,12 @@ namespace MWWorld
mPreloadCells.clear();
}
void CellPreloader::reportStats(unsigned int frameNumber, osg::Stats& stats) const
{
stats.setAttribute(frameNumber, "CellPreloader Count", mPreloadCells.size());
stats.setAttribute(frameNumber, "CellPreloader Added", mAdded);
stats.setAttribute(frameNumber, "CellPreloader Evicted", mEvicted);
stats.setAttribute(frameNumber, "CellPreloader Loaded", mLoaded);
stats.setAttribute(frameNumber, "CellPreloader Expired", mExpired);
}
}

@ -2,11 +2,20 @@
#define OPENMW_MWWORLD_CELLPRELOADER_H
#include <components/sceneutil/workqueue.hpp>
#include <map>
#include <osg/Vec3f>
#include <osg/Vec4i>
#include <osg/ref_ptr>
#include <map>
namespace osg
{
class Stats;
}
namespace Resource
{
class ResourceSystem;
@ -76,6 +85,8 @@ namespace MWWorld
bool isTerrainLoaded(const CellPreloader::PositionCellGrid& position, double referenceTime) const;
void setTerrain(Terrain::World* terrain);
void reportStats(unsigned int frameNumber, osg::Stats& stats) const;
private:
void clearAllTasks();
@ -118,6 +129,10 @@ namespace MWWorld
std::vector<PositionCellGrid> mLoadedTerrainPositions;
double mLoadedTerrainTimestamp;
std::size_t mEvicted = 0;
std::size_t mAdded = 0;
std::size_t mExpired = 0;
std::size_t mLoaded = 0;
};
}

@ -1285,4 +1285,9 @@ namespace MWWorld
}
}
}
void Scene::reportStats(unsigned int frameNumber, osg::Stats& stats) const
{
mPreloader->reportStats(frameNumber, stats);
}
}

@ -19,6 +19,7 @@
namespace osg
{
class Vec3f;
class Stats;
}
namespace ESM
@ -203,6 +204,8 @@ namespace MWWorld
void testExteriorCells();
void testInteriorCells();
void reportStats(unsigned int frameNumber, osg::Stats& stats) const;
};
}

@ -3786,6 +3786,7 @@ namespace MWWorld
{
DetourNavigator::reportStats(mNavigator->getStats(), frameNumber, stats);
mPhysics->reportStats(frameNumber, stats);
mWorldScene->reportStats(frameNumber, stats);
}
void World::updateSkyDate()

@ -72,6 +72,11 @@ namespace Resource
"Physics Projectiles",
"Physics HeightFields",
"Lua UsedMemory",
"CellPreloader Count",
"CellPreloader Added",
"CellPreloader Evicted",
"CellPreloader Loaded",
"CellPreloader Expired",
"NavMesh Jobs",
"NavMesh Waiting",
"NavMesh Pushed",

Loading…
Cancel
Save