Skip to content

Commit

Permalink
libbpf-tools/offcputime: Print application starting message
Browse files Browse the repository at this point in the history
Print starting message like python version does
But not implement to print thread_context and stack_context

Python version starting message
  $ sudo python3 ./offcputime.py
  Tracing off-CPU time (us) of all threads by user + kernel stack... Hit Ctrl-C to end.

  $ sudo python3 ./offcputime.py 30
  Tracing off-CPU time (us) of all threads by user + kernel stack for 30 secs.

libbpf-tools version(with this patch) starting message
  $ sudo ./offcputime
  Tracing off-CPU time (us)... Hit Ctrl-C to end.

  $ sudo ./offcputime 30
  Tracing off-CPU time (us) for 30 secs.
  • Loading branch information
Bojun-Seo authored and yonghong-song committed Jul 28, 2024
1 parent d1a90d2 commit 7e28060
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions libbpf-tools/offcputime.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,11 @@ int main(int argc, char **argv)

signal(SIGINT, sig_handler);

printf("Tracing off-CPU time (us)");
if (env.duration < 99999999)
printf(" for %d secs.\n", env.duration);
else
printf("... Hit Ctrl-C to end.\n");
/*
* We'll get sleep interrupted when someone presses Ctrl-C (which will
* be "handled" with noop by sig_handler).
Expand Down

0 comments on commit 7e28060

Please sign in to comment.