[go: up one dir, main page]

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

Add cli argument to limit run time #2428

Merged
merged 7 commits into from
Jun 30, 2019
Merged

Conversation

williamlw999
Copy link
Contributor

If a user is granted sudo access only to btrfsslower.py and not kill or timeout, then user is unable to easily limit the runtime of btrfsslower.py. The optional cli argument stops execution of program after specified number of seconds passes.

If a user is granted sudo access only to btrfsslower.py and not kill or timeout, then user is unable to limit the runtime of btrfsslower.py. The optional cli argument stops execution of program after specified number of seconds passes.
@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

@yonghong-song
Copy link
Collaborator

Maybe change the option from "-s" to "-d". We have a few other tools to use "-d" or "-D" to indicate the duration. Not sure whether signal handler is needed here. For example, shmsnoop.py exits after the duration like

start_time = datetime.now()
while not args.duration or datetime.now() - start_time < args.duration:
    try:
        b.perf_buffer_poll(timeout=1000)
    except KeyboardInterrupt:
        exit()

Not 100% precise, but should be close.

Please also modify man page and example file.

Now utilizes the timeout functionality of perf_buffer_poll() to check the time conditional every second instead of using signals.
Update btrfsslower_example.txt with optional duration parameter
Update based on shmsnoop_examples.txt
Added -d Duration based on shmsnoop.8
Added -d Duration based on shmsnoop.8
@williamlw999
Copy link
Contributor Author

I've made changes to the implementation so that it's identical to shmsnoop and I have updated the exampls and man page. I'm not familiar with buildbot, but I'll start looking into how to run the tests.

@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

@williamlw999
Copy link
Contributor Author

Please let me know if there's anything else you'd like me to add!

@yonghong-song
Copy link
Collaborator

[buildbot, test this please]

@yonghong-song
Copy link
Collaborator

Looks good. Thanks!

@yonghong-song yonghong-song merged commit 8bd65dd into iovisor:master Jun 30, 2019
CrackerCat pushed a commit to CrackerCat/bcc that referenced this pull request Jul 31, 2024
If a user is granted sudo access only to btrfsslower.py and not kill or timeout, then user is unable to limit the runtime of btrfsslower.py. The optional cli argument stops execution of program after specified number of seconds passes.
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.

2 participants