From 758862e27221a4160476f615e40de56224c5978d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Dejean?= Date: Fri, 26 Jun 2015 07:57:54 +0200 Subject: [PATCH] Add proc_affinity example. --- examples/pprint.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/examples/pprint.c b/examples/pprint.c index 20a7e9a8..7c1e9ebf 100644 --- a/examples/pprint.c +++ b/examples/pprint.c @@ -328,6 +328,28 @@ static void pprint_get_proc_mem(pid_t pid) } +static void pprint_get_proc_affinity(pid_t pid) +{ + glibtop_proc_affinity buf; + guint32 i; + guint16* cpus; + + cpus = glibtop_get_proc_affinity(&buf, pid); + + HEADER_PPRINT(glibtop_get_proc_affinity); + PPRINT(flags, "%#llx"); + PPRINT(number, "%u"); + PPRINT(all, "%d"); + + printf("\taffinity="); + for (i = 0; i < buf.number; i++) { + printf("%d, ", cpus[i]); + } + putchar('\n'); + + FOOTER_PPRINT(); +} + int main() { @@ -360,6 +382,7 @@ int main() pprint_get_proc_kernel(getpid()); pprint_get_proc_mem(getpid()); + pprint_get_proc_affinity(getpid()); glibtop_close();