MCPcopy Create free account
hub / github.com/carbonengine/trinity / End

Method End

trinity/Tr2ProfileTimer.cpp:68–118  ·  view source on GitHub ↗

-------------------------------------------------------------

Source from the content-addressed store, hash-verified

66
67// -------------------------------------------------------------
68void Tr2ProfileTimer::End( Tr2RenderContext& renderContext )
69{
70 if( m_captureCpuTime )
71 {
72 auto endTime = CcpGetTimestamp();
73 m_cpuTime = float( double( endTime - m_beginTime ) / CcpGetTimestampFrequency() );
74 if( !m_statEntryCpu )
75 {
76 if( !m_statName.empty() )
77 {
78 m_statEntryCpu = GetOrCreateStatisticsEntry( m_statName + "/cpuTime" );
79 }
80 }
81 else if( m_statName.empty() )
82 {
83 m_statEntryCpu = nullptr;
84 }
85 else
86 {
87 m_statEntryCpu->Set( double( m_cpuTime ) );
88 }
89 }
90 else if( m_statEntryCpu )
91 {
92 m_statEntryCpu = nullptr;
93 }
94
95 if( m_gpuTimer.IsValid() )
96 {
97 m_gpuTimer.End( renderContext );
98 if( !m_statEntryGpu )
99 {
100 if( !m_statName.empty() )
101 {
102 m_statEntryGpu = GetOrCreateStatisticsEntry( m_statName + "/gpuTime" );
103 }
104 }
105 else if( m_statName.empty() )
106 {
107 m_statEntryGpu = nullptr;
108 }
109 else
110 {
111 m_statEntryGpu->Set( double( std::max( 0.f, m_gpuTimer.GetTime( renderContext ) ) ) );
112 }
113 }
114 else if( m_statEntryGpu )
115 {
116 m_statEntryGpu = nullptr;
117 }
118}
119
120// -------------------------------------------------------------
121bool Tr2ProfileTimer::GetCaptureGpuTime() const

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.80
SetMethod · 0.45
IsValidMethod · 0.45
GetTimeMethod · 0.45

Tested by

no test coverage detected