mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 18:23:54 +02:00
Using the std::chrono to measure the physics time
This commit is contained in:
parent
9b1a887469
commit
cfaf75e196
2 changed files with 10 additions and 4 deletions
|
@ -4295,8 +4295,8 @@ void Application::idle() {
|
|||
}
|
||||
|
||||
{
|
||||
workload::Timings timings(1, PerformanceTimer::getTimerRecord("/idle/update/simulation").getAverage());
|
||||
_gameWorkload.updateSimulationTimings(timings);
|
||||
// workload::Timings timings(1, PerformanceTimer::getTimerRecord("/idle/update/simulation").getAverage());
|
||||
// _gameWorkload.updateSimulationTimings(timings);
|
||||
_gameWorkload.updateViews(_viewFrustum, getMyAvatar()->getHeadPosition());
|
||||
_gameWorkload._engine->run();
|
||||
}
|
||||
|
@ -5277,7 +5277,9 @@ void Application::update(float deltaTime) {
|
|||
{
|
||||
PROFILE_RANGE(simulation_physics, "Simulation");
|
||||
PerformanceTimer perfTimer("simulation");
|
||||
|
||||
if (_physicsEnabled) {
|
||||
auto t0 = std::chrono::high_resolution_clock::now();
|
||||
{
|
||||
PROFILE_RANGE(simulation_physics, "PrePhysics");
|
||||
PerformanceTimer perfTimer("prePhysics)");
|
||||
|
@ -5365,6 +5367,10 @@ void Application::update(float deltaTime) {
|
|||
// NOTE: the PhysicsEngine stats are written to stdout NOT to Qt log framework
|
||||
_physicsEngine->dumpStatsIfNecessary();
|
||||
}
|
||||
auto t1 = std::chrono::high_resolution_clock::now();
|
||||
workload::Timings timings(1);
|
||||
timings[0] = float(std::chrono::nanoseconds(t1 - t0).count() * 0.000001);
|
||||
_gameWorkload.updateSimulationTimings(timings);
|
||||
|
||||
if (!_aboutToQuit) {
|
||||
// NOTE: the getEntities()->update() call below will wait for lock
|
||||
|
|
|
@ -34,13 +34,13 @@ void ControlViews::run(const workload::WorkloadContextPointer& runContext, const
|
|||
outViews.clear();
|
||||
outViews = inViews;
|
||||
|
||||
if (_data.regulateViewRanges) {
|
||||
if (_data.regulateViewRanges && inTimings.size()) {
|
||||
regulateViews(outViews, inTimings);
|
||||
}
|
||||
}
|
||||
|
||||
float wtf_adjust(float current, float timing) {
|
||||
float error = -((timing * 0.001f) - 2.0f);
|
||||
float error = -((timing) - 2.0f);
|
||||
if (error < 0.0f) {
|
||||
current += 0.2f * (error) / 16.0f;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue