File indexing completed on 2025-01-18 10:03:48
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Graphic3d_FrameStatsData_HeaderFile
0015 #define _Graphic3d_FrameStatsData_HeaderFile
0016
0017 #include <NCollection_Array1.hxx>
0018 #include <Graphic3d_FrameStatsCounter.hxx>
0019 #include <Graphic3d_FrameStatsTimer.hxx>
0020 #include <OSD_Timer.hxx>
0021
0022 #include <vector>
0023
0024
0025 class Graphic3d_FrameStatsData
0026 {
0027 public:
0028 DEFINE_STANDARD_ALLOC
0029
0030
0031
0032
0033 Standard_Real FrameRate() const { return myFps; }
0034
0035
0036
0037
0038
0039
0040
0041 Standard_Real FrameRateCpu() const { return myFpsCpu; }
0042
0043
0044 Standard_Real ImmediateFrameRate() const { return myFpsImmediate; }
0045
0046
0047 Standard_Real ImmediateFrameRateCpu() const { return myFpsCpuImmediate; }
0048
0049
0050 Standard_Size CounterValue (Graphic3d_FrameStatsCounter theIndex) const { return myCounters[theIndex]; }
0051
0052
0053 Standard_Size operator[] (Graphic3d_FrameStatsCounter theIndex) const { return CounterValue (theIndex); }
0054
0055
0056 Standard_Real TimerValue (Graphic3d_FrameStatsTimer theIndex) const { return myTimers[theIndex]; }
0057
0058
0059 Standard_Real operator[] (Graphic3d_FrameStatsTimer theIndex) const { return TimerValue (theIndex); }
0060
0061
0062 Standard_EXPORT Graphic3d_FrameStatsData();
0063
0064
0065 Standard_EXPORT Graphic3d_FrameStatsData(const Graphic3d_FrameStatsData& theOther);
0066
0067
0068 Standard_EXPORT Graphic3d_FrameStatsData(Graphic3d_FrameStatsData&& theOther) noexcept;
0069
0070
0071 Standard_EXPORT Graphic3d_FrameStatsData& operator= (const Graphic3d_FrameStatsData& theOther);
0072
0073
0074 Standard_EXPORT Graphic3d_FrameStatsData& operator= (Graphic3d_FrameStatsData&& theOther) noexcept;
0075
0076
0077 Standard_EXPORT void Reset();
0078
0079
0080 Standard_EXPORT void FillMax (const Graphic3d_FrameStatsData& theOther);
0081
0082 protected:
0083 std::vector<Standard_Size> myCounters;
0084 std::vector<Standard_Real> myTimers;
0085 std::vector<Standard_Real> myTimersMin;
0086 std::vector<Standard_Real> myTimersMax;
0087 Standard_Real myFps;
0088 Standard_Real myFpsCpu;
0089 Standard_Real myFpsImmediate;
0090 Standard_Real myFpsCpuImmediate;
0091 };
0092
0093
0094 class Graphic3d_FrameStatsDataTmp : public Graphic3d_FrameStatsData
0095 {
0096 public:
0097
0098 Standard_EXPORT Graphic3d_FrameStatsDataTmp();
0099
0100
0101 Standard_EXPORT void FlushTimers (Standard_Size theNbFrames, bool theIsFinal);
0102
0103
0104 Standard_EXPORT void Reset();
0105
0106
0107 void operator= (const Graphic3d_FrameStatsData& theOther) { Graphic3d_FrameStatsData::operator= (theOther); }
0108
0109
0110 Standard_Real& ChangeFrameRate() { return myFps; }
0111
0112
0113 Standard_Real& ChangeFrameRateCpu() { return myFpsCpu; }
0114
0115
0116 Standard_Real& ChangeImmediateFrameRate() { return myFpsImmediate; }
0117
0118
0119 Standard_Real& ChangeImmediateFrameRateCpu() { return myFpsCpuImmediate; }
0120
0121
0122 OSD_Timer& ChangeTimer (Graphic3d_FrameStatsTimer theTimer) { return myOsdTimers[theTimer]; }
0123
0124
0125 Standard_Size& ChangeCounterValue (Graphic3d_FrameStatsCounter theIndex) { return myCounters[theIndex]; }
0126
0127
0128 Standard_Size& operator[] (Graphic3d_FrameStatsCounter theIndex) { return ChangeCounterValue (theIndex); }
0129
0130
0131 Standard_Real& ChangeTimerValue (Graphic3d_FrameStatsTimer theIndex) { return myTimers[theIndex]; }
0132
0133
0134 Standard_Real& operator[] (Graphic3d_FrameStatsTimer theIndex) { return ChangeTimerValue (theIndex); }
0135
0136 protected:
0137 std::vector<OSD_Timer> myOsdTimers;
0138 std::vector<Standard_Real> myTimersPrev;
0139 };
0140
0141 #endif