BVB Source Codes

CRYENGINE Show StatsManager.h Source code

Return Download CRYENGINE: download StatsManager.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. // -------------------------------------------------------------------------
  4. //  File name:   StatsManager.h
  5. //  Created:     15/09/2008 by Matthew
  6. //  Description: Stores global AI statistics and provides display/output methods
  7. //  Notes:       Should become a flexible bag of numbers with a strong visualisation
  8. //               Should also support any stats stored locally in the code
  9. // -------------------------------------------------------------------------
  10. //  History:
  11. //
  12. //  Wishlist:    Could categorise as debug or performance
  13. //               Smoothing over frames is very handy - with a visual indication of update?
  14. //               Pause...
  15. //
  16. ////////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef __AISTATSMANAGER
  19. #define __AISTATSMANAGER
  20.  
  21. #pragma once
  22.  
  23. // Currently available stats
  24. enum EStatistics
  25. {
  26.         eStat_ActiveActors,                                     // Enabled AI Actors
  27.         eStat_FullUpdates,                                      // Full updates performed in a frame
  28.         eStat_SyncTPSQueries,                                   // TPS queries called synchronously this frame
  29.         eStat_AsyncTPSQueries,                                  // TPS queries called _Asynchronously_ this frame
  30.         eStat_Last                                              // Sentinel value
  31. };
  32.  
  33. // Ideas: //    (TPS) eStat_GenerationTime, eStat_TotalTime,
  34.  
  35. enum EStatsReset
  36. {
  37.         eStatReset_Frame,                                        // Reset just values accumulated over a frame
  38.         eStatReset_All,                                          // Reset all values
  39. };
  40.  
  41. class CStatsManager
  42. {
  43. public:
  44.         CStatsManager(void);
  45.         ~CStatsManager(void);
  46.  
  47.         void  Reset(EStatsReset eReset);
  48.  
  49.         float GetStat(EStatistics eStat)
  50.         {
  51.                 assert(eStat < eStat_Last);
  52.                 return m_fValues[eStat];
  53.         }
  54.  
  55.         void SetStat(EStatistics eStat, float fValue)
  56.         {
  57.                 assert(eStat < eStat_Last);
  58.                 m_fValues[eStat] = fValue;
  59.         }
  60.  
  61.         // Convenience method - it's very common for these to be integers and few problems converting
  62.         void SetStat(EStatistics eStat, int iValue)
  63.         { SetStat(eStat, static_cast<float>(iValue)); }
  64.  
  65.         void Render();
  66.  
  67. private:
  68.         void InitDescriptions();
  69.  
  70.         enum EStatFlags
  71.         {
  72.                 eSF_FrameReset = 1,                                    // Accumulated over a frame, so 0 on frame-reset
  73.                 eSF_Integer    = 1 << 1,                               // Actually an integer - treat it as such
  74.         };
  75.  
  76.         struct SStatMetadata
  77.         {
  78.                 char        description[20];  // Short textual description - bounded at 20 to fit neatly on screen
  79.                 int         flags;            // EStatFlags     specifying how to treat the value
  80.                 const char* format;           // Optional printf format specifier
  81.         };
  82.  
  83.         float*               m_fValues;
  84.         const SStatMetadata* m_sMetadata;
  85. };
  86.  
  87. #endif // __AISTATSMANAGER
  88.  
downloadStatsManager.h Source code - Download CRYENGINE Source code
Related Source Codes/Software:
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top