-
Notifications
You must be signed in to change notification settings - Fork 393
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
Calling process: Query more parents, disable full scan #984
Conversation
The full process scan could still be done on macOS and Windows, I don't think listing all processes requires thousands of syscalls there. |
I've updated @infokiller's docker script to benchmark this branch against 0.11.3 and 0.12.0 (see #977) and the results look good for this branch:
|
src/utils/process.rs
Outdated
info.find_sibling_in_refreshed_processes(my_pid, &extract_args) | ||
// The full scan is expensive and rarely successful, so disable it by default | ||
if std::env::vars() | ||
.any(|(k, v)| k == "DELTA_CALLING_PROCESS_QUERY_ALL" && v != "0" && v != "false") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use std::env::var
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just never bothered to look up the equivalent for the var()
call, which is .map_or(false, ...)
, until now :)
And I think the underlying getenv()
has to walk the environ list just the same.
Looks great @th1000s! One nitpick |
f191de4
to
5eadd64
Compare
Sorry the clippy error was nothing to do with this PR; I've rebased on master to get rid of it. I am curious whether you prefer |
Also, this PR is in Draft status: could you let me know whether it's ready to go out? (I'm quite keen to make a release soon with the new bat assets, and would like to include this) |
The env var DELTA_CALLING_PROCESS_QUERY_ALL re-enables this last resort method. However usually this is just an expensive scan which doesn't find the caller anyhow.
Because I can't test the behavior elsewhere I have only disabled the full scan on Linux now. Other OSes probably have faster syscalls for this query anyhow.
The 1.58 clippy wants to undo what the (I presume) 1.59 one suggested! |
Thanks very much @th1000s! |
Also look at grandparent process when determining the caller
Disable full process scans: The env var
DELTA_CALLING_PROCESS_QUERY_ALL
re-enables thislast resort method. However usually this is just an expensive scan which doesn't find the caller anyhow.