profile: fix process level aggregation bug

This commit is contained in:
Balazs Gerofi
2017-08-20 12:05:20 +09:00
parent 99ca46663b
commit 704096b139

View File

@@ -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) {