mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
Env variable to write OSG stats into file
This commit is contained in:
parent
32ee826a89
commit
d7a920a04b
@ -1,6 +1,7 @@
|
|||||||
#include "engine.hpp"
|
#include "engine.hpp"
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
@ -738,6 +739,14 @@ void OMW::Engine::go()
|
|||||||
mEnvironment.getWindowManager()->executeInConsole(mStartupScript);
|
mEnvironment.getWindowManager()->executeInConsole(mStartupScript);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::ofstream stats;
|
||||||
|
if (const auto path = std::getenv("OPENMW_OSG_STATS_FILE"))
|
||||||
|
{
|
||||||
|
stats.open(path, std::ios_base::out);
|
||||||
|
if (!stats)
|
||||||
|
Log(Debug::Warning) << "Failed to open file for stats: " << path;
|
||||||
|
}
|
||||||
|
|
||||||
// Start the main rendering loop
|
// Start the main rendering loop
|
||||||
osg::Timer frameTimer;
|
osg::Timer frameTimer;
|
||||||
double simulationTime = 0.0;
|
double simulationTime = 0.0;
|
||||||
@ -768,6 +777,12 @@ void OMW::Engine::go()
|
|||||||
simulationTime += dt;
|
simulationTime += dt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stats)
|
||||||
|
{
|
||||||
|
const auto frameNumber = mViewer->getFrameStamp()->getFrameNumber();
|
||||||
|
mViewer->getViewerStats()->report(stats, frameNumber);
|
||||||
|
}
|
||||||
|
|
||||||
mEnvironment.limitFrameRate(frameTimer.time_s());
|
mEnvironment.limitFrameRate(frameTimer.time_s());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user