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 18:11:42 +0300
committerBartosz Taudul <wolf.pld@gmail.com>2019-08-14 18:12:48 +0300
commit3e01ca3269d7b96f01c25bf57c8b1021be4f9bcc (patch)
treedc7ff9d2a97ec0eea3601a8af0001a0b0c2b0b77 /server/TracyWorker.cpp
parent72918cda19275e5fad1c3c22b6dc85f38088d80c (diff)
Calculate how long thread was in running time.
Diffstat (limited to 'server/TracyWorker.cpp')
-rw-r--r--server/TracyWorker.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp
index a1be5640..a0e184d6 100644
--- a/server/TracyWorker.cpp
+++ b/server/TracyWorker.cpp
@@ -1161,15 +1161,21 @@ Worker::Worker( FileRead& f, EventType::Type eventMask )
f.Read2( thread, csz );
auto data = m_slab.AllocInit<ContextSwitch>();
data->v.reserve_exact( csz, m_slab );
+ int64_t runningTime = 0;
int64_t refTime = 0;
auto ptr = data->v.data();
for( uint64_t j=0; j<csz; j++ )
{
ptr->start = ReadTimeOffset( f, refTime );
- ptr->end = ReadTimeOffset( f, refTime );
+ int64_t diff;
+ f.Read( diff );
+ if( diff > 0 ) runningTime += diff;
+ refTime += diff;
+ ptr->end = refTime;
f.Read( &ptr->cpu, sizeof( ptr->cpu ) + sizeof( ptr->reason ) + sizeof( ptr->state ) );
ptr++;
}
+ data->runningTime = runningTime;
m_data.ctxSwitch.emplace( thread, data );
}
}
@@ -3728,6 +3734,8 @@ void Worker::ProcessContextSwitch( const QueueContextSwitch& ev )
item.end = time;
item.reason = ev.reason;
item.state = ev.state;
+
+ it->second->runningTime += time - item.start;
}
}
if( ev.newThread != 0 )