MCPcopy Create free account
hub / github.com/DaedalusX64/daedalus / UpdateFramerate

Function UpdateFramerate

Source/SysGL/HLEGraphics/GraphicsPluginGL.cpp:41–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39#endif
40
41static void UpdateFramerate()
42{
43#ifdef DAEDALUS_FRAMERATE_ANALYSIS
44 gTotalFrames++;
45#endif
46 gFlipCount++;
47
48 u64 now;
49 NTiming::GetPreciseTime( &now );
50
51 if(gLastFramerateCalcTime == 0)
52 {
53 u64 freq;
54 gLastFramerateCalcTime = now;
55
56 NTiming::GetPreciseFrequency( &freq );
57 gTicksPerSecond = freq;
58 }
59
60#ifdef DAEDALUS_FRAMERATE_ANALYSIS
61 if( gFramerateFile == NULL )
62 {
63 gFirstFrameTime = now;
64 gFramerateFile = fopen( "framerate.csv", "w" );
65 }
66 fprintf( gFramerateFile, "%d,%f\n", gTotalFrames, f32(now - gFirstFrameTime) / f32(gTicksPerSecond) );
67#endif
68
69 // If 1 second has elapsed since last recalculation, do it now
70 u64 ticks_since_recalc( now - gLastFramerateCalcTime );
71 if(ticks_since_recalc > gTicksPerSecond)
72 {
73 //gCurrentVblrate = float( gVblCount * gTicksPerSecond ) / float( ticks_since_recalc );
74 gCurrentFramerate = float( gFlipCount * gTicksPerSecond ) / float( ticks_since_recalc );
75
76 //gVblCount = 0;
77 gFlipCount = 0;
78 gLastFramerateCalcTime = now;
79
80#ifdef DAEDALUS_FRAMERATE_ANALYSIS
81 if( gFramerateFile != NULL )
82 {
83 fflush( gFramerateFile );
84 }
85#endif
86 }
87
88}
89}
90
91class CGraphicsPluginImpl : public CGraphicsPlugin

Callers 1

UpdateScreenMethod · 0.70

Calls 2

GetPreciseTimeFunction · 0.50
GetPreciseFrequencyFunction · 0.50

Tested by

no test coverage detected