mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 20:45:34 +00:00
Merge branch 'lua_stats_used_memory_48' into 'openmw-48'
Report used memory by Lua interpreter (0.48) See merge request OpenMW/openmw!2445
This commit is contained in:
commit
37ee7170cb
6 changed files with 16 additions and 25 deletions
|
@ -440,7 +440,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,17 +4,6 @@
|
||||||
|
|
||||||
#include <components/resource/resourcesystem.hpp>
|
#include <components/resource/resourcesystem.hpp>
|
||||||
|
|
||||||
#include "world.hpp"
|
|
||||||
#include "scriptmanager.hpp"
|
|
||||||
#include "dialoguemanager.hpp"
|
|
||||||
#include "journal.hpp"
|
|
||||||
#include "soundmanager.hpp"
|
|
||||||
#include "mechanicsmanager.hpp"
|
|
||||||
#include "inputmanager.hpp"
|
|
||||||
#include "windowmanager.hpp"
|
|
||||||
#include "statemanager.hpp"
|
|
||||||
#include "luamanager.hpp"
|
|
||||||
|
|
||||||
MWBase::Environment *MWBase::Environment::sThis = nullptr;
|
MWBase::Environment *MWBase::Environment::sThis = nullptr;
|
||||||
|
|
||||||
MWBase::Environment::Environment()
|
MWBase::Environment::Environment()
|
||||||
|
@ -27,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;
|
||||||
|
@ -118,8 +113,6 @@ namespace MWBase
|
||||||
assert(sThis != nullptr);
|
assert(sThis != nullptr);
|
||||||
return *sThis;
|
return *sThis;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reportStats(unsigned int frameNumber, osg::Stats& stats) const;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#include "luamanagerimp.hpp"
|
#include "luamanagerimp.hpp"
|
||||||
|
|
||||||
|
#include <osg/Stats>
|
||||||
|
|
||||||
|
#include "sol/state_view.hpp"
|
||||||
|
|
||||||
#include <components/debug/debuglog.hpp>
|
#include <components/debug/debuglog.hpp>
|
||||||
|
|
||||||
#include <components/esm3/esmreader.hpp>
|
#include <components/esm3/esmreader.hpp>
|
||||||
|
@ -598,4 +602,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());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,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,
|
||||||
|
|
|
@ -453,6 +453,8 @@ void StatsHandler::setUpScene(osgViewer::ViewerBase *viewer)
|
||||||
"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…
Reference in a new issue