profile: refactor display code and fix ARM support

Change-Id: Ic48102c42abe17eed014f2bfe7523d0d6f03c2e9
This commit is contained in:
Balazs Gerofi
2019-08-13 15:23:09 +09:00
committed by Masamichi Takagi
parent c3c57940ba
commit 6aa7b50e26
3 changed files with 103 additions and 182 deletions

View File

@ -1497,6 +1497,19 @@ struct thread *arch_switch_context(struct thread *prev, struct thread *next)
}
}
#endif /*ENABLE_PERF*/
#ifdef PROFILE_ENABLE
if (prev && prev->profile && prev->profile_start_ts != 0) {
prev->profile_elapsed_ts +=
(rdtsc() - prev->profile_start_ts);
prev->profile_start_ts = 0;
}
if (next->profile && next->profile_start_ts == 0) {
next->profile_start_ts = rdtsc();
}
#endif
if (likely(prev)) {
tls_thread_switch(prev, next);