Rename Event to ZoneEvent.

This commit is contained in:
Bartosz Taudul 2017-10-22 15:37:24 +02:00
parent 97b3cccb1a
commit 7345ca5aa6
3 changed files with 43 additions and 43 deletions

View File

@ -16,7 +16,7 @@ struct TextData
#pragma pack( 1 )
struct Event
struct ZoneEvent
{
int64_t start;
int64_t end;
@ -25,11 +25,11 @@ struct Event
int8_t cpu_end;
TextData* text;
Event* parent;
Vector<Event*> child;
ZoneEvent* parent;
Vector<ZoneEvent*> child;
};
enum { EventSize = sizeof( Event ) };
enum { ZoneEventSize = sizeof( ZoneEvent ) };
struct LockEvent

View File

@ -564,7 +564,7 @@ void View::Process( const QueueItem& ev )
void View::ProcessZoneBegin( const QueueZoneBegin& ev )
{
auto zone = m_slab.AllocInit<Event>();
auto zone = m_slab.AllocInit<ZoneEvent>();
CheckSourceLocation( ev.srcloc );
@ -784,7 +784,7 @@ void View::CheckThreadString( uint64_t id )
ServerQuery( ServerQueryThreadString, id );
}
void View::CheckCustomString( uint64_t ptr, Event* dst )
void View::CheckCustomString( uint64_t ptr, ZoneEvent* dst )
{
assert( m_pendingCustomStrings.find( ptr ) == m_pendingCustomStrings.end() );
m_pendingCustomStrings.emplace( ptr, dst );
@ -918,20 +918,20 @@ View::ThreadData* View::NoticeThread( uint64_t thread )
}
}
void View::NewZone( Event* zone, uint64_t thread )
void View::NewZone( ZoneEvent* zone, uint64_t thread )
{
m_zonesCnt++;
Vector<Event*>* timeline = &NoticeThread( thread )->timeline;
Vector<ZoneEvent*>* timeline = &NoticeThread( thread )->timeline;
InsertZone( zone, nullptr, *timeline );
}
void View::UpdateZone( Event* zone )
void View::UpdateZone( ZoneEvent* zone )
{
assert( zone->end != -1 );
assert( std::upper_bound( zone->child.begin(), zone->child.end(), zone->end, [] ( const auto& l, const auto& r ) { return l < r->start; } ) == zone->child.end() );
}
void View::InsertZone( Event* zone, Event* parent, Vector<Event*>& vec )
void View::InsertZone( ZoneEvent* zone, ZoneEvent* parent, Vector<ZoneEvent*>& vec )
{
if( !vec.empty() )
{
@ -1158,7 +1158,7 @@ int64_t View::GetLastTime() const
return last;
}
int64_t View::GetZoneEnd( const Event& ev ) const
int64_t View::GetZoneEnd( const ZoneEvent& ev ) const
{
auto ptr = &ev;
for(;;)
@ -1169,7 +1169,7 @@ int64_t View::GetZoneEnd( const Event& ev ) const
}
}
Vector<Event*>& View::GetParentVector( const Event& ev )
Vector<ZoneEvent*>& View::GetParentVector( const ZoneEvent& ev )
{
if( ev.parent )
{
@ -1183,7 +1183,7 @@ Vector<Event*>& View::GetParentVector( const Event& ev )
if( it != t->timeline.end() && *it == &ev ) return t->timeline;
}
assert( false );
static Vector<Event*> empty;
static Vector<ZoneEvent*> empty;
return empty;
}
}
@ -1958,7 +1958,7 @@ void View::DrawZones()
}
}
int View::DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth )
int View::DrawZoneLevel( const Vector<ZoneEvent*>& vec, bool hover, double pxns, const ImVec2& wpos, int _offset, int depth )
{
auto it = std::lower_bound( vec.begin(), vec.end(), m_zvStart - m_delay, [] ( const auto& l, const auto& r ) { return l->end < r; } );
if( it == vec.end() ) return depth;
@ -2847,7 +2847,7 @@ void View::DrawMessages()
ImGui::End();
}
uint32_t View::GetZoneColor( const Event& ev )
uint32_t View::GetZoneColor( const ZoneEvent& ev )
{
return GetZoneColor( GetSourceLocation( ev.srcloc ) );
}
@ -2858,7 +2858,7 @@ uint32_t View::GetZoneColor( const QueueSourceLocation& srcloc )
return color != 0 ? ( color | 0xFF000000 ) : 0xFFCC5555;
}
uint32_t View::GetZoneHighlight( const Event& ev, bool migration )
uint32_t View::GetZoneHighlight( const ZoneEvent& ev, bool migration )
{
if( m_zoneInfoWindow == &ev )
{
@ -2882,7 +2882,7 @@ uint32_t View::GetZoneHighlight( const Event& ev, bool migration )
}
}
float View::GetZoneThickness( const Event& ev )
float View::GetZoneThickness( const ZoneEvent& ev )
{
if( m_zoneInfoWindow == &ev || m_zoneHighlight == &ev )
{
@ -2894,7 +2894,7 @@ float View::GetZoneThickness( const Event& ev )
}
}
void View::ZoomToZone( const Event& ev )
void View::ZoomToZone( const ZoneEvent& ev )
{
const auto end = GetZoneEnd( ev );
if( end - ev.start <= 0 ) return;
@ -2902,7 +2902,7 @@ void View::ZoomToZone( const Event& ev )
m_zvEndNext = end;
}
void View::ZoneTooltip( const Event& ev )
void View::ZoneTooltip( const ZoneEvent& ev )
{
int dmul = 1;
if( ev.text )
@ -2954,7 +2954,7 @@ void View::ZoneTooltip( const Event& ev )
ImGui::EndTooltip();
}
TextData* View::GetTextData( Event& zone )
TextData* View::GetTextData( ZoneEvent& zone )
{
if( !zone.text )
{
@ -3088,7 +3088,7 @@ void View::Write( FileWrite& f )
}
}
void View::WriteTimeline( FileWrite& f, const Vector<Event*>& vec )
void View::WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec )
{
uint64_t sz = vec.size();
f.Write( &sz, sizeof( sz ) );
@ -3118,7 +3118,7 @@ void View::WriteTimeline( FileWrite& f, const Vector<Event*>& vec )
}
}
void View::ReadTimeline( FileRead& f, Vector<Event*>& vec, Event* parent, const std::unordered_map<uint64_t, const char*>& stringMap )
void View::ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, ZoneEvent* parent, const std::unordered_map<uint64_t, const char*>& stringMap )
{
uint64_t sz;
f.Read( &sz, sizeof( sz ) );
@ -3126,7 +3126,7 @@ void View::ReadTimeline( FileRead& f, Vector<Event*>& vec, Event* parent, const
for( uint64_t i=0; i<sz; i++ )
{
auto zone = m_slab.AllocInit<Event>();
auto zone = m_slab.AllocInit<ZoneEvent>();
m_zonesCnt++;
vec.push_back( zone );

View File

@ -74,7 +74,7 @@ private:
uint64_t id;
bool showFull;
bool visible;
Vector<Event*> timeline;
Vector<ZoneEvent*> timeline;
Vector<MessageData*> messages;
};
@ -137,7 +137,7 @@ private:
void CheckString( uint64_t ptr );
void CheckThreadString( uint64_t id );
void CheckCustomString( uint64_t ptr, Event* dst );
void CheckCustomString( uint64_t ptr, ZoneEvent* dst );
void CheckSourceLocation( uint64_t ptr );
void AddString( uint64_t ptr, std::string&& str );
@ -150,10 +150,10 @@ private:
ThreadData* NoticeThread( uint64_t thread );
void NewZone( Event* zone, uint64_t thread );
void UpdateZone( Event* zone );
void NewZone( ZoneEvent* zone, uint64_t thread );
void UpdateZone( ZoneEvent* zone );
void InsertZone( Event* zone, Event* parent, Vector<Event*>& vec );
void InsertZone( ZoneEvent* zone, ZoneEvent* parent, Vector<ZoneEvent*>& vec );
void InsertLockEvent( LockMap& lockmap, LockEvent* lev, uint64_t thread );
void UpdateLockCount( LockMap& lockmap, size_t pos );
@ -167,8 +167,8 @@ private:
uint64_t GetFrameBegin( size_t idx ) const;
uint64_t GetFrameEnd( size_t idx ) const;
int64_t GetLastTime() const;
int64_t GetZoneEnd( const Event& ev ) const;
Vector<Event*>& GetParentVector( const Event& ev );
int64_t GetZoneEnd( const ZoneEvent& ev ) const;
Vector<ZoneEvent*>& GetParentVector( const ZoneEvent& ev );
const char* TimeToString( int64_t ns ) const;
const char* RealToString( double val, bool separator ) const;
const char* GetString( uint64_t ptr ) const;
@ -182,7 +182,7 @@ private:
void DrawFrames();
bool DrawZoneFrames();
void DrawZones();
int DrawZoneLevel( const Vector<Event*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth );
int DrawZoneLevel( const Vector<ZoneEvent*>& vec, bool hover, double pxns, const ImVec2& wpos, int offset, int depth );
int DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int offset, LockHighlight& highlight );
void DrawZoneInfoWindow();
int DrawPlots( int offset, double pxns, const ImVec2& wpos, bool hover );
@ -192,19 +192,19 @@ private:
void HandleZoneViewMouse( int64_t timespan, const ImVec2& wpos, float w, double& pxns );
uint32_t GetZoneColor( const Event& ev );
uint32_t GetZoneColor( const ZoneEvent& ev );
uint32_t GetZoneColor( const QueueSourceLocation& srcloc );
uint32_t GetZoneHighlight( const Event& ev, bool migration );
float GetZoneThickness( const Event& ev );
uint32_t GetZoneHighlight( const ZoneEvent& ev, bool migration );
float GetZoneThickness( const ZoneEvent& ev );
void ZoomToZone( const Event& ev );
void ZoneTooltip( const Event& ev );
void ZoomToZone( const ZoneEvent& ev );
void ZoneTooltip( const ZoneEvent& ev );
TextData* GetTextData( Event& zone );
TextData* GetTextData( ZoneEvent& zone );
void Write( FileWrite& f );
void WriteTimeline( FileWrite& f, const Vector<Event*>& vec );
void ReadTimeline( FileRead& f, Vector<Event*>& vec, Event* parent, const std::unordered_map<uint64_t, const char*>& stringMap );
void WriteTimeline( FileWrite& f, const Vector<ZoneEvent*>& vec );
void ReadTimeline( FileRead& f, Vector<ZoneEvent*>& vec, ZoneEvent* parent, const std::unordered_map<uint64_t, const char*>& stringMap );
std::string m_addr;
@ -232,11 +232,11 @@ private:
std::vector<float> m_mbps;
// not used for vis - no need to lock
std::unordered_map<uint64_t, std::vector<Event*>> m_zoneStack;
std::unordered_map<uint64_t, std::vector<ZoneEvent*>> m_zoneStack;
std::unordered_set<uint64_t> m_pendingStrings;
std::unordered_set<uint64_t> m_pendingThreads;
std::unordered_set<uint64_t> m_pendingSourceLocation;
std::unordered_map<uint64_t, Event*> m_pendingCustomStrings;
std::unordered_map<uint64_t, ZoneEvent*> m_pendingCustomStrings;
std::unordered_map<uint64_t, uint32_t> m_threadMap;
std::unordered_map<uint64_t, uint32_t> m_plotMap;
std::unordered_map<std::string, uint32_t> m_plotRev;
@ -269,8 +269,8 @@ private:
uint64_t m_zvHeight;
uint64_t m_zvScroll;
const Event* m_zoneInfoWindow;
const Event* m_zoneHighlight;
const ZoneEvent* m_zoneInfoWindow;
const ZoneEvent* m_zoneHighlight;
LockHighlight m_lockHighlight;
const MessageData* m_msgHighlight;