mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 03:32:36 +00:00
Report used memory by Lua interpreter
This commit is contained in:
parent
b1cf4ace3c
commit
4de8ea30c8
@ -442,7 +442,9 @@ bool OMW::Engine::frame(float frametime)
|
||||
stats->setAttribute(frameNumber, "WorkQueue", mWorkQueue->getNumItems());
|
||||
stats->setAttribute(frameNumber, "WorkThread", mWorkQueue->getNumActiveThreads());
|
||||
|
||||
mEnvironment.reportStats(frameNumber, *stats);
|
||||
mMechanicsManager->reportStats(frameNumber, *stats);
|
||||
mWorld->reportStats(frameNumber, *stats);
|
||||
mLuaManager->reportStats(frameNumber, *stats);
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
@ -4,9 +4,6 @@
|
||||
|
||||
#include <components/resource/resourcesystem.hpp>
|
||||
|
||||
#include "mechanicsmanager.hpp"
|
||||
#include "world.hpp"
|
||||
|
||||
MWBase::Environment* MWBase::Environment::sThis = nullptr;
|
||||
|
||||
MWBase::Environment::Environment()
|
||||
@ -19,9 +16,3 @@ MWBase::Environment::~Environment()
|
||||
{
|
||||
sThis = nullptr;
|
||||
}
|
||||
|
||||
void MWBase::Environment::reportStats(unsigned int frameNumber, osg::Stats& stats) const
|
||||
{
|
||||
mMechanicsManager->reportStats(frameNumber, stats);
|
||||
mWorld->reportStats(frameNumber, stats);
|
||||
}
|
||||
|
@ -5,11 +5,6 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace osg
|
||||
{
|
||||
class Stats;
|
||||
}
|
||||
|
||||
namespace Resource
|
||||
{
|
||||
class ResourceSystem;
|
||||
@ -117,8 +112,6 @@ namespace MWBase
|
||||
assert(sThis != nullptr);
|
||||
return *sThis;
|
||||
}
|
||||
|
||||
void reportStats(unsigned int frameNumber, osg::Stats& stats) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include <osg/Stats>
|
||||
|
||||
#include "sol/state_view.hpp"
|
||||
|
||||
#include <components/debug/debuglog.hpp>
|
||||
|
||||
#include <components/esm/luascripts.hpp>
|
||||
@ -608,4 +612,9 @@ namespace MWLua
|
||||
mActionQueue.push_back(std::make_unique<FunctionAction>(&mLua, std::move(action), name));
|
||||
}
|
||||
|
||||
void LuaManager::reportStats(unsigned int frameNumber, osg::Stats& stats)
|
||||
{
|
||||
const sol::state_view state(mLua.sol());
|
||||
stats.setAttribute(frameNumber, "Lua UsedMemory", state.memory_used());
|
||||
}
|
||||
}
|
||||
|
@ -127,6 +127,8 @@ namespace MWLua
|
||||
|
||||
bool isProcessingInputEvents() const { return mProcessingInputEvents; }
|
||||
|
||||
void reportStats(unsigned int frameNumber, osg::Stats& stats);
|
||||
|
||||
private:
|
||||
void initConfiguration();
|
||||
LocalScripts* createLocalScripts(const MWWorld::Ptr& ptr,
|
||||
|
@ -463,6 +463,8 @@ namespace Resource
|
||||
"Physics Objects",
|
||||
"Physics Projectiles",
|
||||
"Physics HeightFields",
|
||||
"",
|
||||
"Lua UsedMemory",
|
||||
});
|
||||
|
||||
static const auto longest = std::max_element(statNames.begin(), statNames.end(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user