BVB Source Codes

CRYENGINE Show CalculationStopper.h Source code

Return Download CRYENGINE: download CalculationStopper.h Source code - Download CRYENGINE Source code - Type:.h
  1. // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
  2.  
  3. /********************************************************************
  4.    -------------------------------------------------------------------------
  5.    File name:   CalculationStopper.h
  6.    $Id$
  7.    Description: Temp file holding code extracted from CAISystem.h/cpp
  8.  
  9.    -------------------------------------------------------------------------
  10.    History:
  11.  
  12.  *********************************************************************/
  13.  
  14. #ifndef _CALCULATIONSHOPPER_H_
  15. #define _CALCULATIONSHOPPER_H_
  16.  
  17. //#define CALIBRATE_STOPPER
  18. //#define DEBUG_STOPPER
  19. //#define STOPPER_CAN_USE_COUNTER
  20.  
  21. /// Used to determine when a calculation should stop. Normally this would be after a certain time (dt). However,
  22. /// if m_useCounter has been set then the times are internally converted to calls to ShouldCalculationStop using
  23. /// callRate, which should have been estimated previously
  24. class CCalculationStopper
  25. {
  26. public:
  27.         /// name is used during calibration. fCalculationTime is the amount of time (in seconds).
  28.         /// fCallsPerSecond is for when we are running in "counter" mode - the time
  29.         /// gets converted into a number of calls to ShouldCalculationStop
  30.         CCalculationStopper(const char* szName, float fCalculationTime, float fCallsPerSecond);
  31.         bool  ShouldCalculationStop() const;
  32.         float GetSecondsRemaining() const;
  33.  
  34. #ifdef STOPPER_CAN_USE_COUNTER
  35.         static bool m_useCounter;
  36. #endif
  37.  
  38. private:
  39.         CTimeValue m_endTime;
  40.  
  41. #ifdef STOPPER_CAN_USE_COUNTER
  42.         mutable unsigned m_stopCounter; // if > 0 use this - stop when it's 0
  43.         float            m_fCallsPerSecond;
  44. #endif // STOPPER_CAN_USE_COUNTER
  45.  
  46. #ifdef DEBUG_STOPPER
  47.         static bool m_neverStop; // for debugging
  48. #endif
  49.  
  50. #ifdef CALIBRATE_STOPPER
  51. public:
  52.         mutable unsigned m_calls;
  53.         float            m_dt;
  54.         string           m_name;
  55.         /// the pair is calls and time (seconds)
  56.         typedef std::map<string, std::pair<unsigned, float>> TMapCallRate;
  57.         static TMapCallRate m_mapCallRate;
  58. #endif
  59. };
  60.  
  61. #endif
  62.  
downloadCalculationStopper.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