mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-23 06:44:35 +00:00
Abstracted away one-frame-decay values.
This commit is contained in:
parent
44e027ad11
commit
1d0203ac17
47
server/TracyDecayValue.hpp
Normal file
47
server/TracyDecayValue.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef __TRACYDECAYVALUE_HPP__
|
||||
#define __TRACYDECAYVALUE_HPP__
|
||||
|
||||
#include "../common/TracyForceInline.hpp"
|
||||
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
class DecayValue
|
||||
{
|
||||
public:
|
||||
DecayValue( const T& init )
|
||||
: m_value( init )
|
||||
, m_active( false )
|
||||
{
|
||||
}
|
||||
|
||||
tracy_force_inline operator const T& () const { return m_value; }
|
||||
|
||||
tracy_force_inline DecayValue& operator=( const T& value )
|
||||
{
|
||||
m_value = value;
|
||||
m_active = true;
|
||||
return *this;
|
||||
}
|
||||
|
||||
tracy_force_inline void Decay( const T& value )
|
||||
{
|
||||
if( m_active )
|
||||
{
|
||||
m_active = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_value = value;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
T m_value;
|
||||
bool m_active;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -226,10 +226,8 @@ View::View( const char* addr )
|
||||
, m_zvScroll( 0 )
|
||||
, m_zoneInfoWindow( nullptr )
|
||||
, m_zoneSrcLocHighlight( 0 )
|
||||
, m_zoneSrcLocHighlightActive( false )
|
||||
, m_lockHighlight { -1 }
|
||||
, m_msgHighlight( nullptr )
|
||||
, m_msgHighlightActive( false )
|
||||
, m_gpuInfoWindow( nullptr )
|
||||
, m_callstackInfoWindow( 0 )
|
||||
, m_memoryAllocInfoWindow( -1 )
|
||||
@ -270,9 +268,7 @@ View::View( FileRead& f )
|
||||
, m_zvScroll( 0 )
|
||||
, m_zoneInfoWindow( nullptr )
|
||||
, m_zoneSrcLocHighlight( 0 )
|
||||
, m_zoneSrcLocHighlightActive( false )
|
||||
, m_msgHighlight( nullptr )
|
||||
, m_msgHighlightActive( false )
|
||||
, m_gpuInfoWindow( nullptr )
|
||||
, m_callstackInfoWindow( 0 )
|
||||
, m_memoryAllocInfoWindow( -1 )
|
||||
@ -1189,22 +1185,8 @@ bool View::DrawZoneFrames( const FrameData& frames )
|
||||
|
||||
void View::DrawZones()
|
||||
{
|
||||
if( m_msgHighlightActive )
|
||||
{
|
||||
m_msgHighlightActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_msgHighlight = nullptr;
|
||||
}
|
||||
if( m_zoneSrcLocHighlightActive )
|
||||
{
|
||||
m_zoneSrcLocHighlightActive = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_zoneSrcLocHighlight = 0;
|
||||
}
|
||||
m_msgHighlight.Decay( nullptr );
|
||||
m_zoneSrcLocHighlight.Decay( 0 );
|
||||
|
||||
if( m_zvStart == m_zvEnd ) return;
|
||||
assert( m_zvStart < m_zvEnd );
|
||||
@ -1395,7 +1377,6 @@ void View::DrawZones()
|
||||
}
|
||||
ImGui::EndTooltip();
|
||||
m_msgHighlight = *it;
|
||||
m_msgHighlightActive = true;
|
||||
}
|
||||
it = next;
|
||||
}
|
||||
@ -1617,7 +1598,6 @@ int View::DrawZoneLevel( const Vector<ZoneEvent*>& vec, bool hover, double pxns,
|
||||
}
|
||||
|
||||
m_zoneSrcLocHighlight = ev.srcloc;
|
||||
m_zoneSrcLocHighlightActive = true;
|
||||
}
|
||||
}
|
||||
char tmp[64];
|
||||
@ -1723,7 +1703,6 @@ int View::DrawZoneLevel( const Vector<ZoneEvent*>& vec, bool hover, double pxns,
|
||||
}
|
||||
|
||||
m_zoneSrcLocHighlight = ev.srcloc;
|
||||
m_zoneSrcLocHighlightActive = true;
|
||||
}
|
||||
|
||||
++it;
|
||||
@ -3951,7 +3930,6 @@ void View::DrawMessages()
|
||||
if( ImGui::IsItemHovered() )
|
||||
{
|
||||
m_msgHighlight = v;
|
||||
m_msgHighlightActive = true;
|
||||
}
|
||||
ImGui::PopID();
|
||||
ImGui::NextColumn();
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include "TracyDecayValue.hpp"
|
||||
#include "TracyVector.hpp"
|
||||
#include "TracyWorker.hpp"
|
||||
#include "tracy_flat_hash_map.hpp"
|
||||
@ -185,11 +186,9 @@ private:
|
||||
|
||||
const ZoneEvent* m_zoneInfoWindow;
|
||||
const ZoneEvent* m_zoneHighlight;
|
||||
uint64_t m_zoneSrcLocHighlight;
|
||||
bool m_zoneSrcLocHighlightActive;
|
||||
DecayValue<uint64_t> m_zoneSrcLocHighlight;
|
||||
LockHighlight m_lockHighlight;
|
||||
const MessageData* m_msgHighlight;
|
||||
bool m_msgHighlightActive;
|
||||
DecayValue<const MessageData*> m_msgHighlight;
|
||||
const GpuEvent* m_gpuInfoWindow;
|
||||
const GpuEvent* m_gpuHighlight;
|
||||
uint64_t m_gpuInfoWindowThread;
|
||||
|
@ -131,6 +131,7 @@
|
||||
<ClInclude Include="..\..\..\nfd\nfd_common.h" />
|
||||
<ClInclude Include="..\..\..\server\TracyBadVersion.hpp" />
|
||||
<ClInclude Include="..\..\..\server\TracyCharUtil.hpp" />
|
||||
<ClInclude Include="..\..\..\server\TracyDecayValue.hpp" />
|
||||
<ClInclude Include="..\..\..\server\TracyEvent.hpp" />
|
||||
<ClInclude Include="..\..\..\server\TracyFileHeader.hpp" />
|
||||
<ClInclude Include="..\..\..\server\TracyFileRead.hpp" />
|
||||
|
@ -191,6 +191,9 @@
|
||||
<ClInclude Include="..\..\..\server\TracyStringDiscovery.hpp">
|
||||
<Filter>server</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\server\TracyDecayValue.hpp">
|
||||
<Filter>server</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include="DebugVis.natvis" />
|
||||
|
Loading…
Reference in New Issue
Block a user