Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for access to performance counters? #2351

Closed
vsoch opened this issue May 18, 2024 · 6 comments
Closed

Example for access to performance counters? #2351

vsoch opened this issue May 18, 2024 · 6 comments

Comments

@vsoch
Copy link

vsoch commented May 18, 2024

I have a Lima setup intended for eBPF, but I stopped when I didn't see see any hardware counters:

# perf list hw

List of pre-defined events (to be used in -e):

I'm not sure if this is a special flag / setting needed to my yaml, or I just chose the wrong base image. Any help would be appreciated! I'm using this setup. https://github.com/converged-computing/flux-lima/tree/main/ebpf

The basics seem to work, but I think I need this additional permission to test some of the go ebpf examples. Thank you!

@vsoch
Copy link
Author

vsoch commented May 18, 2024

Ah! Liz Rice has an example!

https://raw.githubusercontent.com/lizrice/learning-ebpf/main/learning-ebpf.yaml

I will try this and report back.

@vsoch
Copy link
Author

vsoch commented May 18, 2024

Actually this looks to be the same one I started from, albeit many months ago. 😢 I'll start fresh anyway in case something is different.

@afbjorklund
Copy link
Member

Not sure what you were expecting?

anders@lima-default:/home/anders$ sudo apt install linux-tools-generic
...
anders@lima-default:/home/anders$ perf list hw

List of pre-defined events (to be used in -e or -M):

anders@lima-default:/home/anders$ sudo perf list hw

List of pre-defined events (to be used in -e or -M):

  branch-instructions OR branches                    [Hardware event]
  branch-misses                                      [Hardware event]
  bus-cycles                                         [Hardware event]
  cache-misses                                       [Hardware event]
  cache-references                                   [Hardware event]
  cpu-cycles OR cycles                               [Hardware event]
  instructions                                       [Hardware event]
  ref-cycles                                         [Hardware event]

And I don't think using perf requires bpf*...


* Only for bpf-output, as far as I know?

https://www.brendangregg.com/perf.html#eBPF

@afbjorklund
Copy link
Member

This is awesome: https://github.com/lizrice/learning-ebpf 💚 for when you don't have root (or sudo)

I've also provided a Lima config file with the packages you need for building the code pre-installed.

@vsoch
Copy link
Author

vsoch commented May 29, 2024

I think that was probably just my mistake to not use sudo, thanks for the tips @afbjorklund.

@vsoch vsoch closed this as completed May 29, 2024
@afbjorklund
Copy link
Member

There is a subtle # ,
as opposed to $ prompt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants