From 866ca000ed085919023d35c3b668cee37e68ca9b Mon Sep 17 00:00:00 2001 From: FILIPPONE Jerome <jerome@filippone.fr> Date: Tue, 19 Nov 2024 04:38:59 +0000 Subject: [PATCH] Upload New File --- .../SEANCE_02-19NOV2024/sf1a.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 UE701/SEMESTRE__2024_25/SEANCE_02-19NOV2024/sf1a.c diff --git a/UE701/SEMESTRE__2024_25/SEANCE_02-19NOV2024/sf1a.c b/UE701/SEMESTRE__2024_25/SEANCE_02-19NOV2024/sf1a.c new file mode 100644 index 0000000..211b8f1 --- /dev/null +++ b/UE701/SEMESTRE__2024_25/SEANCE_02-19NOV2024/sf1a.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