Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/wolfpld/tracy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBartosz Taudul <wolf.pld@gmail.com>2019-08-14 21:16:11 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2019-08-14 21:16:11 +0300
commit9a364fe5fe14724a4cfc11c81d94b87f8dc46465 (patch)
tree351108a1318130c05675964b9e176693456fa40d /server/TracyWorker.hpp
parentcf4e04440edf0630675ad28ea9cd0e7964e5c756 (diff)
Cache context switch data queries.
Diffstat (limited to 'server/TracyWorker.hpp')
-rw-r--r--server/TracyWorker.hpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp
index c45a51c6..73a343fa 100644
--- a/server/TracyWorker.hpp
+++ b/server/TracyWorker.hpp
@@ -145,7 +145,14 @@ private:
struct DataBlock
{
- DataBlock() : zonesCnt( 0 ), lastTime( 0 ), frameOffset( 0 ), threadLast( std::numeric_limits<uint64_t>::max(), 0 ), threadDataLast( std::numeric_limits<uint64_t>::max(), nullptr ) {}
+ DataBlock()
+ : zonesCnt( 0 )
+ , lastTime( 0 )
+ , frameOffset( 0 )
+ , threadLast( std::numeric_limits<uint64_t>::max(), 0 )
+ , threadDataLast( std::numeric_limits<uint64_t>::max(), nullptr )
+ , ctxSwitchLast( std::numeric_limits<uint64_t>::max(), nullptr )
+ {}
std::shared_mutex lock;
StringDiscovery<FrameData*> frames;
@@ -198,6 +205,7 @@ private:
CrashEvent crashEvent;
flat_hash_map<uint64_t, ContextSwitch*, nohash<uint64_t>> ctxSwitch;
+ std::pair<uint64_t, ContextSwitch*> ctxSwitchLast;
};
struct MbpsBlock
@@ -277,7 +285,11 @@ public:
uint64_t GetFrameOffset() const { return m_data.frameOffset; }
const FrameData* GetFramesBase() const { return m_data.framesBase; }
const Vector<FrameData*>& GetFrames() const { return m_data.frames.Data(); }
- const ContextSwitch* const GetContextSwitchData( uint64_t thread ) const;
+ const ContextSwitch* const GetContextSwitchData( uint64_t thread )
+ {
+ if( m_data.ctxSwitchLast.first == thread ) return m_data.ctxSwitchLast.second;
+ return GetContextSwitchDataImpl( thread );
+ }
int64_t GetFrameTime( const FrameData& fd, size_t idx ) const;
int64_t GetFrameBegin( const FrameData& fd, size_t idx ) const;
@@ -479,6 +491,7 @@ private:
StringLocation StoreString( char* str, size_t sz );
uint16_t CompressThreadReal( uint64_t thread );
uint16_t CompressThreadNew( uint64_t thread );
+ const ContextSwitch* const GetContextSwitchDataImpl( uint64_t thread );
tracy_force_inline void ReadTimeline( FileRead& f, ZoneEvent* zone, uint16_t thread, int64_t& refTime );
tracy_force_inline void ReadTimelinePre042( FileRead& f, ZoneEvent* zone, uint16_t thread, int fileVer );