Keep track of number of context switches per CPU

Change-Id: I7a2194c8777a7efcd34e1ed7f4734da03fb4d433
This commit is contained in:
Balazs Gerofi
2019-09-26 12:24:18 +09:00
committed by Masamichi Takagi
parent 17a8f68d60
commit 1afc3d9b70
2 changed files with 6 additions and 2 deletions

View File

@ -100,6 +100,7 @@ struct cpu_local_var {
int in_interrupt;
int no_preempt;
int timer_enabled;
unsigned long nr_ctx_switches;
int kmalloc_initialized;
struct ihk_os_cpu_monitor *monitor;
struct rusage_percpu *rusage;

View File

@ -3518,8 +3518,11 @@ void schedule(void)
set_timer(1);
if (switch_ctx) {
dkprintf("schedule: %d => %d \n",
prev ? prev->tid : 0, next ? next->tid : 0);
++cpu_local_var(nr_ctx_switches);
dkprintf("%s: %d => %d [ctx sws: %lu]\n",
__func__,
prev ? prev->tid : 0, next ? next->tid : 0,
cpu_local_var(nr_ctx_switches));
if (prev && prev->ptrace_debugreg) {
save_debugreg(prev->ptrace_debugreg);