File indexing completed on 2026-09-15 09:15:50
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 #include <NCollection_LinearVector.hxx>
0022
0023
0024 class Graphic3d_FrameStatsData
0025 {
0026 public:
0027 DEFINE_STANDARD_ALLOC
0028
0029
0030
0031
0032 double FrameRate() const { return myFps; }
0033
0034
0035
0036
0037
0038
0039
0040
0041 double FrameRateCpu() const { return myFpsCpu; }
0042
0043
0044 double ImmediateFrameRate() const { return myFpsImmediate; }
0045
0046
0047 double ImmediateFrameRateCpu() const { return myFpsCpuImmediate; }
0048
0049
0050 size_t CounterValue(Graphic3d_FrameStatsCounter theIndex) const { return myCounters[theIndex]; }
0051
0052
0053 size_t operator[](Graphic3d_FrameStatsCounter theIndex) const { return CounterValue(theIndex); }
0054
0055
0056 double TimerValue(Graphic3d_FrameStatsTimer theIndex) const { return myTimers[theIndex]; }
0057
0058
0059 double 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 NCollection_LinearVector<size_t> myCounters;
0084 NCollection_LinearVector<double> myTimers;
0085 NCollection_LinearVector<double> myTimersMin;
0086 NCollection_LinearVector<double> myTimersMax;
0087 double myFps;
0088 double myFpsCpu;
0089 double myFpsImmediate;
0090 double 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(size_t theNbFrames, bool theIsFinal);
0102
0103
0104 Standard_EXPORT void Reset();
0105
0106
0107 void operator=(const Graphic3d_FrameStatsData& theOther)
0108 {
0109 Graphic3d_FrameStatsData::operator=(theOther);
0110 }
0111
0112
0113 double& ChangeFrameRate() { return myFps; }
0114
0115
0116 double& ChangeFrameRateCpu() { return myFpsCpu; }
0117
0118
0119 double& ChangeImmediateFrameRate() { return myFpsImmediate; }
0120
0121
0122 double& ChangeImmediateFrameRateCpu() { return myFpsCpuImmediate; }
0123
0124
0125 OSD_Timer& ChangeTimer(Graphic3d_FrameStatsTimer theTimer) { return myOsdTimers[theTimer]; }
0126
0127
0128 size_t& ChangeCounterValue(Graphic3d_FrameStatsCounter theIndex) { return myCounters[theIndex]; }
0129
0130
0131 size_t& operator[](Graphic3d_FrameStatsCounter theIndex) { return ChangeCounterValue(theIndex); }
0132
0133
0134 double& ChangeTimerValue(Graphic3d_FrameStatsTimer theIndex) { return myTimers[theIndex]; }
0135
0136
0137 double& operator[](Graphic3d_FrameStatsTimer theIndex) { return ChangeTimerValue(theIndex); }
0138
0139 protected:
0140 NCollection_LinearVector<OSD_Timer> myOsdTimers;
0141 NCollection_LinearVector<double> myTimersPrev;
0142 };
0143
0144 #endif