From 704096b1394f1232770fca65b27f61f2edf8fbe0 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Sun, 20 Aug 2017 12:05:20 +0900 Subject: [PATCH] profile: fix process level aggregation bug --- kernel/profile.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/profile.c b/kernel/profile.c index f2c0cfc2..d434ad7d 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -228,14 +228,16 @@ void profile_print_proc_stats(struct process *proc) if (!proc->profile_events[i].cnt) continue; - __kprintf("PID: %4d (%24s): %6u %6luk \n", +// __kprintf("PID: %4d (%24s): %6u %6luk \n", + __kprintf("PID: %4d (%24s): %6u %6lu \n", proc->pid, profile_event_names[i - PROFILE_EVENT_MIN], proc->profile_events[i].cnt, (proc->profile_events[i].tsc / (proc->profile_events[i].cnt ? proc->profile_events[i].cnt : 1)) - / 1000, +// / 1000 + , (proc->profile_events[i].tsc && proc->profile_elapsed_ts ? proc->profile_events[i].tsc * 100 @@ -510,6 +512,8 @@ int do_profile(int flag) if (flag & PROF_ON) { _thread->profile = 1; + if (!_thread->profile_start_ts) + _thread->profile_start_ts = now_ts; } else if (flag & PROF_OFF) { if (_thread->profile) {