From bee530148037b621e5febc1b92a74590a8b88761 Mon Sep 17 00:00:00 2001 From: FILIPPONE Jerome <jerome@filippone.fr> Date: Thu, 20 Oct 2022 04:36:39 +0000 Subject: [PATCH] Upload New File --- f1a.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 f1a.c diff --git a/f1a.c b/f1a.c new file mode 100644 index 0000000..211b8f1 --- /dev/null +++ b/f1a.c @@ -0,0 +1,20 @@ +#include <stdio.h> +#include <unistd.h> +#include <sys/syscall.h> +#include <sys/types.h> + +int main() { + + unsigned cpu, node; + + // Get current CPU core and NUMA node via system call + // Note this has no glibc wrapper so we must call it directly + syscall(SYS_getcpu, &cpu, &node, NULL); + + // Display information + printf("This program is running on CPU core %u and NUMA node %u.\n\n", cpu, node); + + return 0; + +} + -- GitLab