From 56ee0787c93469a9ed1e1fdf1780c31343e80f81 Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Tue, 7 Mar 2017 15:17:11 +0900 Subject: [PATCH] profiler: function to clear process level logs --- kernel/profile.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/profile.c b/kernel/profile.c index 49bd9fa2..e5f33ddb 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -375,6 +375,14 @@ void profile_dealloc_proc_events(struct process *proc) kfree(proc->profile_events); } +void static profile_clear_process(struct process *proc) +{ + if (!proc->profile_events) return; + + memset(proc->profile_events, 0, + sizeof(*proc->profile_events) * PROFILE_EVENT_MAX); +} + void static profile_clear_thread(struct thread *thread) { if (!thread->profile_events) return; @@ -436,6 +444,9 @@ int do_profile(int flag) } } + if (flag & PROF_CLEAR) { + profile_clear_process(proc); + } mcs_rwlock_reader_unlock_noirq(&proc->threads_lock, &lock); /* Make sure future threads profile as well */