From a9e1a9bddb144fbff7c802249d65a78efae9e9a7 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 24 Mar 2018 14:24:30 +0100 Subject: [PATCH] Calculate total time spent in source location. This simple solution doesn't handle recursion at all. --- server/TracyWorker.cpp | 2 ++ server/TracyWorker.hpp | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 91976b22..5e5ba4b3 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -1271,6 +1271,7 @@ void Worker::ProcessZoneEnd( const QueueZoneEnd& ev ) assert( it != m_data.sourceLocationZones.end() ); it->second.min = std::min( it->second.min, timeSpan ); it->second.max = std::max( it->second.max, timeSpan ); + it->second.total += timeSpan; } #endif } @@ -1671,6 +1672,7 @@ void Worker::ReadTimeline( FileRead& f, Vector& vec, uint16_t thread { it->second.min = std::min( it->second.min, timeSpan ); it->second.max = std::max( it->second.max, timeSpan ); + it->second.total += timeSpan; } } #endif diff --git a/server/TracyWorker.hpp b/server/TracyWorker.hpp index f993ed50..53f632bb 100644 --- a/server/TracyWorker.hpp +++ b/server/TracyWorker.hpp @@ -35,11 +35,16 @@ class Worker struct SourceLocationZones { - SourceLocationZones() : min( std::numeric_limits::max() ), max( std::numeric_limits::min() ) {} + SourceLocationZones() + : min( std::numeric_limits::max() ) + , max( std::numeric_limits::min() ) + , total( 0 ) + {} Vector zones; int64_t min; int64_t max; + int64_t total; }; struct DataBlock