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

Do not disable stats via procfs if already enabled #34

Merged
merged 3 commits into from
Apr 25, 2024

Conversation

jfernandez
Copy link
Contributor

@jfernandez jfernandez commented Apr 24, 2024

If a user is using bpftop on a kernel older than 5.8, we will attempt to enable BPF stats globally using the procfs file /proc/sys/kernel/bpf_stats_enabled. With this change, we will only enable BPF stats via procfs if they are not already active. Thus, we will not modify the settings upon exit if the stats were previously enabled. This change ensures we do not deactivate BPF stats at shutdown if they were already turned on by the user before running bpftop.

I also did refactoring to make this logic easier to read.

src/main.rs Outdated Show resolved Hide resolved
Co-authored-by: haze <isnt@haze.cool>
src/main.rs Outdated Show resolved Hide resolved
@jfernandez jfernandez merged commit fd31a58 into main Apr 25, 2024
1 check passed
@jfernandez jfernandez deleted the conditional-enable branch April 25, 2024 01:41
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

Successfully merging this pull request may close these issues.

5 participants