Changeset 25394

Timestamp:
May 6, 2021, 6:49:34 PM (3 years ago)
Author:
wraitii
Message:

Fix Profiler1 "time per turn".

Actually call Turn() when a turn is processed.

Fixes #6144

Differential Revision: https://code.wildfiregames.com/D3885

Location:
ps/trunk/source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ps/trunk/source/ps/Game.cpp

    r25376 r25394  
    394394    if (deltaSimTime)
    395395    {
    396         // To avoid confusing the profiler, we need to trigger the new turn
    397         // while we're not nested inside any PROFILE blocks
    398         if (m_TurnManager->WillUpdate(deltaSimTime))
    399             g_Profiler.Turn();
    400 
    401396        // At the normal sim rate, we currently want to render at least one
    402397        // frame per simulation turn, so let maxTurns be 1. But for fast-forward
  • ps/trunk/source/ps/Profile.h

    r24352 r25394  
    1 /* Copyright (C) 2020 Wildfire Games.
     1/* Copyright (C) 202 Wildfire Games.
    22 * This file is part of 0 A.D.
    33 *
     
    3232
    3333#define PROFILE_AMORTIZE_FRAMES 30
    34 #define PROFILE_AMORTIZE_TURNS 1
     34#define PROFILE_AMORTIZE_TURNS
    3535
    3636class CProfileManager;
  • ps/trunk/source/simulation2/system/TurnManager.cpp

    r25170 r25394  
    6363}
    6464
    65 bool CTurnManager::WillUpdate(float simFrameLength) const
    66 {
    67     // Keep this in sync with the return value of Update()
    68 
    69     if (m_CurrentTurn > m_FinalTurn)
    70         return false;
    71 
    72     if (m_DeltaSimTime + simFrameLength < 0)
    73         return false;
    74 
    75     if (m_ReadyTurn <= m_CurrentTurn)
    76         return false;
    77 
    78     return true;
    79 }
    80 
    8165bool CTurnManager::Update(float simFrameLength, size_t maxTurns)
    8266{
     
    124108        if (m_ReadyTurn <= m_CurrentTurn && m_CommandDelay > 1)
    125109            break;
     110
     111
     112
     113
    126114
    127115        NotifyFinishedOwnCommands(m_CurrentTurn + m_CommandDelay);
  • ps/trunk/source/simulation2/system/TurnManager.h

    r25170 r25394  
    113113
    114114    /**
    115      * Returns whether Update(simFrameLength, ...) will process at least one new turn.
    116      * @param simFrameLength Length of the previous frame, in simulation seconds
    117      */
    118     bool WillUpdate(float simFrameLength) const;
    119 
    120     /**
    121115     * Advance the graphics by a certain time.
    122116     * @param simFrameLength Length of the previous frame, in simulation seconds
Note: See TracChangeset for help on using the changeset viewer.