mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-14 04:01:48 +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_zvScroll( 0 )
|
||||||
, m_zoneInfoWindow( nullptr )
|
, m_zoneInfoWindow( nullptr )
|
||||||
, m_zoneSrcLocHighlight( 0 )
|
, m_zoneSrcLocHighlight( 0 )
|
||||||
, m_zoneSrcLocHighlightActive( false )
|
|
||||||
, m_lockHighlight { -1 }
|
, m_lockHighlight { -1 }
|
||||||
, m_msgHighlight( nullptr )
|
, m_msgHighlight( nullptr )
|
||||||
, m_msgHighlightActive( false )
|
|
||||||
, m_gpuInfoWindow( nullptr )
|
, m_gpuInfoWindow( nullptr )
|
||||||
, m_callstackInfoWindow( 0 )
|
, m_callstackInfoWindow( 0 )
|
||||||
, m_memoryAllocInfoWindow( -1 )
|
, m_memoryAllocInfoWindow( -1 )
|
||||||
@ -270,9 +268,7 @@ View::View( FileRead& f )
|
|||||||
, m_zvScroll( 0 )
|
, m_zvScroll( 0 )
|
||||||
, m_zoneInfoWindow( nullptr )
|
, m_zoneInfoWindow( nullptr )
|
||||||
, m_zoneSrcLocHighlight( 0 )
|
, m_zoneSrcLocHighlight( 0 )
|
||||||
, m_zoneSrcLocHighlightActive( false )
|
|
||||||
, m_msgHighlight( nullptr )
|
, m_msgHighlight( nullptr )
|
||||||
, m_msgHighlightActive( false )
|
|
||||||
, m_gpuInfoWindow( nullptr )
|
, m_gpuInfoWindow( nullptr )
|
||||||
, m_callstackInfoWindow( 0 )
|
, m_callstackInfoWindow( 0 )
|
||||||
, m_memoryAllocInfoWindow( -1 )
|
, m_memoryAllocInfoWindow( -1 )
|
||||||
@ -1189,22 +1185,8 @@ bool View::DrawZoneFrames( const FrameData& frames )
|
|||||||
|
|
||||||
void View::DrawZones()
|
void View::DrawZones()
|
||||||
{
|
{
|
||||||
if( m_msgHighlightActive )
|
m_msgHighlight.Decay( nullptr );
|
||||||
{
|
m_zoneSrcLocHighlight.Decay( 0 );
|
||||||
m_msgHighlightActive = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_msgHighlight = nullptr;
|
|
||||||
}
|
|
||||||
if( m_zoneSrcLocHighlightActive )
|
|
||||||
{
|
|
||||||
m_zoneSrcLocHighlightActive = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_zoneSrcLocHighlight = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( m_zvStart == m_zvEnd ) return;
|
if( m_zvStart == m_zvEnd ) return;
|
||||||
assert( m_zvStart < m_zvEnd );
|
assert( m_zvStart < m_zvEnd );
|
||||||
@ -1395,7 +1377,6 @@ void View::DrawZones()
|
|||||||
}
|
}
|
||||||
ImGui::EndTooltip();
|
ImGui::EndTooltip();
|
||||||
m_msgHighlight = *it;
|
m_msgHighlight = *it;
|
||||||
m_msgHighlightActive = true;
|
|
||||||
}
|
}
|
||||||
it = next;
|
it = next;
|
||||||
}
|
}
|
||||||
@ -1617,7 +1598,6 @@ int View::DrawZoneLevel( const Vector<ZoneEvent*>& vec, bool hover, double pxns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_zoneSrcLocHighlight = ev.srcloc;
|
m_zoneSrcLocHighlight = ev.srcloc;
|
||||||
m_zoneSrcLocHighlightActive = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
char tmp[64];
|
char tmp[64];
|
||||||
@ -1723,7 +1703,6 @@ int View::DrawZoneLevel( const Vector<ZoneEvent*>& vec, bool hover, double pxns,
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_zoneSrcLocHighlight = ev.srcloc;
|
m_zoneSrcLocHighlight = ev.srcloc;
|
||||||
m_zoneSrcLocHighlightActive = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
++it;
|
++it;
|
||||||
@ -3951,7 +3930,6 @@ void View::DrawMessages()
|
|||||||
if( ImGui::IsItemHovered() )
|
if( ImGui::IsItemHovered() )
|
||||||
{
|
{
|
||||||
m_msgHighlight = v;
|
m_msgHighlight = v;
|
||||||
m_msgHighlightActive = true;
|
|
||||||
}
|
}
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
ImGui::NextColumn();
|
ImGui::NextColumn();
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "TracyDecayValue.hpp"
|
||||||
#include "TracyVector.hpp"
|
#include "TracyVector.hpp"
|
||||||
#include "TracyWorker.hpp"
|
#include "TracyWorker.hpp"
|
||||||
#include "tracy_flat_hash_map.hpp"
|
#include "tracy_flat_hash_map.hpp"
|
||||||
@ -185,11 +186,9 @@ private:
|
|||||||
|
|
||||||
const ZoneEvent* m_zoneInfoWindow;
|
const ZoneEvent* m_zoneInfoWindow;
|
||||||
const ZoneEvent* m_zoneHighlight;
|
const ZoneEvent* m_zoneHighlight;
|
||||||
uint64_t m_zoneSrcLocHighlight;
|
DecayValue<uint64_t> m_zoneSrcLocHighlight;
|
||||||
bool m_zoneSrcLocHighlightActive;
|
|
||||||
LockHighlight m_lockHighlight;
|
LockHighlight m_lockHighlight;
|
||||||
const MessageData* m_msgHighlight;
|
DecayValue<const MessageData*> m_msgHighlight;
|
||||||
bool m_msgHighlightActive;
|
|
||||||
const GpuEvent* m_gpuInfoWindow;
|
const GpuEvent* m_gpuInfoWindow;
|
||||||
const GpuEvent* m_gpuHighlight;
|
const GpuEvent* m_gpuHighlight;
|
||||||
uint64_t m_gpuInfoWindowThread;
|
uint64_t m_gpuInfoWindowThread;
|
||||||
|
@ -131,6 +131,7 @@
|
|||||||
<ClInclude Include="..\..\..\nfd\nfd_common.h" />
|
<ClInclude Include="..\..\..\nfd\nfd_common.h" />
|
||||||
<ClInclude Include="..\..\..\server\TracyBadVersion.hpp" />
|
<ClInclude Include="..\..\..\server\TracyBadVersion.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyCharUtil.hpp" />
|
<ClInclude Include="..\..\..\server\TracyCharUtil.hpp" />
|
||||||
|
<ClInclude Include="..\..\..\server\TracyDecayValue.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyEvent.hpp" />
|
<ClInclude Include="..\..\..\server\TracyEvent.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyFileHeader.hpp" />
|
<ClInclude Include="..\..\..\server\TracyFileHeader.hpp" />
|
||||||
<ClInclude Include="..\..\..\server\TracyFileRead.hpp" />
|
<ClInclude Include="..\..\..\server\TracyFileRead.hpp" />
|
||||||
|
@ -191,6 +191,9 @@
|
|||||||
<ClInclude Include="..\..\..\server\TracyStringDiscovery.hpp">
|
<ClInclude Include="..\..\..\server\TracyStringDiscovery.hpp">
|
||||||
<Filter>server</Filter>
|
<Filter>server</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\..\server\TracyDecayValue.hpp">
|
||||||
|
<Filter>server</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Natvis Include="DebugVis.natvis" />
|
<Natvis Include="DebugVis.natvis" />
|
||||||
|
Loading…
Reference in New Issue
Block a user