From d8671bc2a0fead7655b9e80736db33d84f14025c Mon Sep 17 00:00:00 2001 From: Almudena Garcia Date: Thu, 31 Oct 2019 01:53:52 +0100 Subject: proc: add support for last_processor Read last_processor (new member) from thread_info structures, and fill stat structure with this. * configure.ac: Check whether thread_sched_info structure includes `last_processor' member. * proc/info.c (S_proc_getprocinfo) [HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR]: Set `last_processor' field. * procfs/process.c (process_file_gc_stat) [HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR]: Set last processor proc field to `thsi->last_processor'. [!HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR]: Set last processor proc field to 0. --- proc/info.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'proc') diff --git a/proc/info.c b/proc/info.c index f2e60114..2ea2a114 100644 --- a/proc/info.c +++ b/proc/info.c @@ -713,6 +713,14 @@ S_proc_getprocinfo (struct proc *callerp, *flags &= ~PI_FETCH_THREAD_SCHED; err = 0; } + +#ifdef HAVE_STRUCT_THREAD_SCHED_INFO_LAST_PROCESSOR + /* If the structure read doesn't include last_processor field, assume + CPU 0. */ + if (thcount < 8) + thds[i]->last_processor = 0; +#endif + } /* Note that there are thread wait entries only for those threads -- cgit v1.2.3