Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 30, 2008, 3:27:39 PM (15 years ago)
Author:
rgrieder
Message:

Moved tick time measurement to GSRoot. The values get combined with the one from GSGraphics.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/presentation/src/orxonox/gamestates/GSRoot.h

    r2485 r2549  
    3131
    3232#include "OrxonoxPrereqs.h"
     33
     34#include <list>
    3335#include <OgreLog.h>
    3436#include "core/RootGameState.h"
     
    4042    {
    4143        friend class ClassIdentifier<GSRoot>;
     44
     45    public:
     46        struct statisticsTickInfo
     47        {
     48            uint64_t    tickTime;
     49            uint32_t    tickLength;
     50        };
     51   
    4252    public:
    4353        GSRoot();
     
    5262        void pause();
    5363        float getTimeFactor() { return this->timeFactor_; }
     64
     65        float getAvgTickTime() { return this->avgTickTime_; }
     66        float getAvgFPS()      { return this->avgFPS_; }
     67
     68        inline void addTickTime(uint32_t length)
     69            { assert(!this->statisticsTickTimes_.empty()); this->statisticsTickTimes_.back().tickLength += length; }
    5470
    5571    private:
     
    6985        Shell*                shell_;
    7086        LuaBind*              luaBind_;
     87
     88        // variables for time statistics
     89        uint32_t              frameCount_;
     90        uint64_t              statisticsStartTime_;
     91        std::list<statisticsTickInfo>
     92                              statisticsTickTimes_;
     93        uint32_t              periodTickTime_;
     94        float                 avgFPS_;
     95        float                 avgTickTime_;
     96
     97        // config values
     98        unsigned int          statisticsRefreshCycle_;
     99        unsigned int          statisticsAvgLength_;
    71100
    72101        // console commands
Note: See TracChangeset for help on using the changeset viewer.