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

Debug: Remove Excess System Calls #4052

Merged

Conversation

dthain
Copy link
Member

@dthain dthain commented Feb 2, 2025

Proposed Changes

On Linux, every single debug() event was resulting in the following system calls:

stat("/etc/localtime")
getpid()
getpid()
getpid()
write(fd,event)

With the sort of extensive debugging output emitted by taskvine, the cost of debug messages was becoming surprisingly high. This PR reduces the cost to:

getpid()
write(fd,event)

Note that getpid() was previously cached and the system call optimized away, but this is no longer true:
https://sourceware.org/glibc/wiki/Release/2.25#pid_cache_removal

It turns out that it is surprisingly hard to catch all variations of fork() in order to invalidate such a cached value.

Maybe we don't need to write it to every debug line?

Merge Checklist

The following items must be completed before PRs can be merged.
Check these off to verify you have completed all steps.

  • make test Run local tests prior to pushing.
  • make format Format source code to comply with lint policies. Note that some lint errors can only be resolved manually (e.g., Python)
  • make lint Run lint on source code prior to pushing.
  • Manual Update: Update the manual to reflect user-visible changes.
  • Type Labels: Select a github label for the type: bugfix, enhancement, etc.
  • Product Labels: Select a github label for the product: TaskVine, Makeflow, etc.
  • PR RTM: Mark your PR as ready to merge.

…localtime() for every debug event.

- Rename debug_getpid -> debug_child_getpid to clarify purpose for sole use in parrot.
@dthain
Copy link
Member Author

dthain commented Feb 3, 2025

Merge when you are ready...

@btovar btovar merged commit abb440b into cooperative-computing-lab:master Feb 3, 2025
10 checks passed
btovar pushed a commit that referenced this pull request Feb 6, 2025
* - Modify debug() to avoid making excess system calls to getpid() and localtime() for every debug event.
- Rename debug_getpid -> debug_child_getpid to clarify purpose for sole use in parrot.

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

Successfully merging this pull request may close these issues.

2 participants