-
Notifications
You must be signed in to change notification settings - Fork 423
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 scan through all PIDs to find parent PID command #817
base: master
Are you sure you want to change the base?
Conversation
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.
ps
does not support the -q
flag on MacOS. This can't be merged as is.
Can you post some timing info (time ps -o comm= -p "$PPID"
) from the situations that you think this is slow?
If this is really a problem, we could try to have two different paths for those that support the -q
flag vs those that don't.
Oops, |
I'm probably missing something, but why was a separate option added? If |
I'm not sure why
after running 1000
If different code paths for different systems are possible, then |
What file are you proposing to read? If you want to try to implement it, here are a few tips:
|
There's one command that takes a long time after profiling bash startup.
We currently scan though all processes just to find out $PPID command.
The time to do it grows linearly with a number of processes running.
Let's fix that.
Compare:
strace -e openat ps -o comm= -p $PPID
vs
strace -e openat ps -o comm= -q $PPID
Technical checklist:
IFS
_LP_FIRST_INDEX
_LP_PERCENT
_LP_SHELL_*
)tests/test_*.sh
files)tests.sh
shellcheck.sh
(requires shellcheck)... versionadded:: X.Y
or.. versionchanged:: Y.Z
docs/docs-lint.sh
(requires Python 3 andrequirements.txt
installed (
cd docs/; python3 -m venv venv; . venv/bin/activate; pip install -r requirements.txt
))