From dcc2b3fb09277b47e0bc03c9d8b4d2e64f2e9ba9 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 12 Nov 2017 01:12:28 +0100 Subject: [PATCH] Save/load GPU events. --- server/TracyView.cpp | 57 ++++++++++++++++++++++++++++++++++++++++++++ server/TracyView.hpp | 2 ++ 2 files changed, 59 insertions(+) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 61c07d05..42c1af6b 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -351,6 +351,16 @@ View::View( FileRead& f ) m_threads.push_back( td ); } + f.Read( &sz, sizeof( sz ) ); + m_gpuData.reserve( sz ); + for( uint64_t i=0; i(); + ReadTimeline( f, ctx->timeline ); + ctx->showFull = true; + m_gpuData.push_back( ctx ); + } + f.Read( &sz, sizeof( sz ) ); m_plots.reserve( sz ); for( uint64_t i=0; itimeline ); + } + sz = m_plots.size(); f.Write( &sz, sizeof( sz ) ); for( auto& plot : m_plots ) @@ -3691,6 +3708,24 @@ void View::WriteTimeline( FileWrite& f, const Vector& vec ) } } +void View::WriteTimeline( FileWrite& f, const Vector& vec ) +{ + uint64_t sz = vec.size(); + f.Write( &sz, sizeof( sz ) ); + + for( auto& v : vec ) + { + f.Write( &v->cpuStart, sizeof( v->cpuStart ) ); + f.Write( &v->cpuEnd, sizeof( v->cpuEnd ) ); + f.Write( &v->gpuStart, sizeof( v->gpuStart ) ); + f.Write( &v->gpuEnd, sizeof( v->gpuEnd ) ); + f.Write( &v->srcloc, sizeof( v->srcloc ) ); + f.Write( &v->name, sizeof( v->name ) ); + f.Write( &v->thread, sizeof( v->thread ) ); + WriteTimeline( f, v->child ); + } +} + void View::ReadTimeline( FileRead& f, Vector& vec ) { uint64_t sz; @@ -3713,4 +3748,26 @@ void View::ReadTimeline( FileRead& f, Vector& vec ) } } +void View::ReadTimeline( FileRead& f, Vector& vec ) +{ + uint64_t sz; + f.Read( &sz, sizeof( sz ) ); + vec.reserve( sz ); + + for( uint64_t i=0; i(); + vec.push_back( zone ); + + f.Read( &zone->cpuStart, sizeof( zone->cpuStart ) ); + f.Read( &zone->cpuEnd, sizeof( zone->cpuEnd ) ); + f.Read( &zone->gpuStart, sizeof( zone->gpuStart ) ); + f.Read( &zone->gpuEnd, sizeof( zone->gpuEnd ) ); + f.Read( &zone->srcloc, sizeof( zone->srcloc ) ); + f.Read( &zone->name, sizeof( zone->name ) ); + f.Read( &zone->thread, sizeof( zone->thread ) ); + ReadTimeline( f, zone->child ); + } +} + } diff --git a/server/TracyView.hpp b/server/TracyView.hpp index 51ec8e91..7032c21b 100644 --- a/server/TracyView.hpp +++ b/server/TracyView.hpp @@ -150,7 +150,9 @@ private: void Write( FileWrite& f ); void WriteTimeline( FileWrite& f, const Vector& vec ); + void WriteTimeline( FileWrite& f, const Vector& vec ); void ReadTimeline( FileRead& f, Vector& vec ); + void ReadTimeline( FileRead& f, Vector& vec ); std::string m_addr;