Skip to content

Commit

Permalink
libbpf-tools: update numamove for libbpf 1.0
Browse files Browse the repository at this point in the history
Switch to libbpf 1.0 mode and adapt libbpf API usage accordingly.

Signed-off-by: Andrii Nakryiko <[email protected]>
  • Loading branch information
anakryiko committed Dec 20, 2021
1 parent 08301e9 commit 824ffd2
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions libbpf-tools/numamove.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,9 @@ int main(int argc, char **argv)
if (err)
return err;

libbpf_set_strict_mode(LIBBPF_STRICT_ALL);
libbpf_set_print(libbpf_print_fn);

err = bump_memlock_rlimit();
if (err) {
fprintf(stderr, "failed to increase rlimit: %d\n", err);
return 1;
}

obj = numamove_bpf__open_and_load();
if (!obj) {
fprintf(stderr, "failed to open and/or load BPF object\n");
Expand All @@ -108,18 +103,15 @@ int main(int argc, char **argv)

signal(SIGINT, sig_handler);

printf("%-10s %18s %18s\n", "TIME", "NUMA_migrations",
"NUMA_migrations_ms");
printf("%-10s %18s %18s\n", "TIME", "NUMA_migrations", "NUMA_migrations_ms");
while (!exiting) {
sleep(1);
time(&t);
tm = localtime(&t);
strftime(ts, sizeof(ts), "%H:%M:%S", tm);
printf("%-10s %18lld %18lld\n", ts,
__atomic_exchange_n(&obj->bss->num, 0,
__ATOMIC_RELAXED),
__atomic_exchange_n(&obj->bss->latency, 0,
__ATOMIC_RELAXED));
__atomic_exchange_n(&obj->bss->num, 0, __ATOMIC_RELAXED),
__atomic_exchange_n(&obj->bss->latency, 0, __ATOMIC_RELAXED));
}

cleanup:
Expand Down

0 comments on commit 824ffd2

Please sign in to comment.