mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-06 18:40:23 +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, "WorkQueue", mWorkQueue->getNumItems());
|
||||||
stats->setAttribute(frameNumber, "WorkThread", mWorkQueue->getNumActiveThreads());
|
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)
|
catch (const std::exception& e)
|
||||||
|
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
|
||||||
#include "mechanicsmanager.hpp"
|
|
||||||
#include "world.hpp"
|
|
||||||
|
|
||||||
MWBase::Environment* MWBase::Environment::sThis = nullptr;
|
MWBase::Environment* MWBase::Environment::sThis = nullptr;
|
||||||
|
|
||||||
MWBase::Environment::Environment()
|
MWBase::Environment::Environment()
|
||||||
@ -19,9 +16,3 @@ MWBase::Environment::~Environment()
|
|||||||
{
|
{
|
||||||
sThis = nullptr;
|
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>
|
#include <memory>
|
||||||
|
|
||||||
namespace osg
|
|
||||||
{
|
|
||||||
class Stats;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Resource
|
namespace Resource
|
||||||
{
|
{
|
||||||
class ResourceSystem;
|
class ResourceSystem;
|
||||||
@ -117,8 +112,6 @@ namespace MWBase
|
|||||||
assert(sThis != nullptr);
|
assert(sThis != nullptr);
|
||||||
return *sThis;
|
return *sThis;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reportStats(unsigned int frameNumber, osg::Stats& stats) const;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
|
#include <osg/Stats>
|
||||||
|
|
||||||
|
#include "sol/state_view.hpp"
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
|
|
||||||
#include <components/esm/luascripts.hpp>
|
#include <components/esm/luascripts.hpp>
|
||||||
@ -608,4 +612,9 @@ namespace MWLua
|
|||||||
mActionQueue.push_back(std::make_unique<FunctionAction>(&mLua, std::move(action), name));
|
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; }
|
bool isProcessingInputEvents() const { return mProcessingInputEvents; }
|
||||||
|
|
||||||
|
void reportStats(unsigned int frameNumber, osg::Stats& stats);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initConfiguration();
|
void initConfiguration();
|
||||||
LocalScripts* createLocalScripts(const MWWorld::Ptr& ptr,
|
LocalScripts* createLocalScripts(const MWWorld::Ptr& ptr,
|
||||||
|
@ -463,6 +463,8 @@ namespace Resource
|
|||||||
"Physics Objects",
|
"Physics Objects",
|
||||||
"Physics Projectiles",
|
"Physics Projectiles",
|
||||||
"Physics HeightFields",
|
"Physics HeightFields",
|
||||||
|
"",
|
||||||
|
"Lua UsedMemory",
|
||||||
});
|
});
|
||||||
|
|
||||||
static const auto longest = std::max_element(statNames.begin(), statNames.end(),
|
static const auto longest = std::max_element(statNames.begin(), statNames.end(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user